i am getting error of SQL0811N in db2 stored procedure. please help its urgent!!!

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mohit1286
    New Member
    • Oct 2009
    • 1

    i am getting error of SQL0811N in db2 stored procedure. please help its urgent!!!

    my stored procedure in db2 is--->
    create procedure temp_bill(in UPC_cd character(6))
    language sql
    begin
    declare prod_cd character(8);de clare prod_desc varchar(30);dec lare discount decimal(2,2);de clare
    prod_sp decimal(7,2);de clare
    counts int;declare deal_check char(6);select
    deal_id into deal_check from db2admin.produc t where db2admin.produc t.upc_cd=UPC_cd ;if deal_check is not null then select
    prod_id,prod_de sc,buy_discount ,prod_sp into prod_cd,prod_de sc,discount,pro d_sp from db2admin.produc t,db2admin.deal where
    db2admin.produc t.upc_cd=UPC_cd and db2admin.deal.d eal_id=db2admin .product.deal_i d;else select prod_id,
    prod_desc,prod_ sp into prod_cd,prod_de sc,prod_sp from db2admin.produc t
    where db2admin.produc t.upc_cd=UPC_cd ;end if;end


    i am getting error of SQL0811N The result of a scalar fullselect, SELECT INTO statement, or VALUES INTO statement is more than one row.

    even my first select statement is having same error in this procedure.

    what should i do please help.its very urgent!!
  • Parnamwulan
    New Member
    • Apr 2008
    • 16

    #2
    Hello Mohit,

    you can do SELECT INTO only if the result returned is one value ... you have more values returned thats why the error SQL0811N

    If I would be you I will define the unique key on the deal_id column to be sure only one value is returned.

    Comment

    Working...