If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > SQL0811N error in stored procedure. please help urgent!!!

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-02-09, 14:24
mohit1286 mohit1286 is offline
Registered User
 
Join Date: Oct 2009
Posts: 1
SQL0811N error in stored procedure. please help urgent!!!

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

my stored procedure is-->

create procedure temp_bill(in UPC_cd character(6))
language sql
begin
declare prod_cd character(8);declare prod_desc varchar(30);declare discount decimal(2,2);declare
prod_sp decimal(7,2);declare
counts int;declare deal_check char(6);select
deal_id into deal_check from db2admin.product where db2admin.product.upc_cd=UPC_cd;if deal_check is not null then select
prod_id,prod_desc,buy_discount,prod_sp into prod_cd,prod_desc,discount,prod_sp from db2admin.product,db2admin.deal where
db2admin.product.upc_cd=UPC_cd and db2admin.deal.deal_id=db2admin.product.deal_id;els e select prod_id,
prod_desc,prod_sp into prod_cd,prod_desc,discount,prod_sp from db2admin.product
where db2admin.product.upc_cd=upc_cd;end if;end


please help its urgent!!
Reply With Quote
  #2 (permalink)  
Old 10-02-09, 14:53
Lenny77 Lenny77 is offline
Registered User
 
Join Date: Jul 2009
Location: NY
Posts: 886
You have to change:

select
prod_id,prod_desc,buy_discount,prod_sp
into prod_cd,prod_desc,discount,prod_sp from db2admin.product,db2admin.deal where
db2admin.product.upc_cd=UPC_cd and db2admin.deal.deal_id=db2admin.product.deal_id
FETCH FIRST ROW ONLY;

or


select prod_id,
prod_desc,prod_sp into prod_cd,prod_desc,discount,prod_sp from db2admin.product
where db2admin.product.upc_cd=upc_cd
FETCH FIRST ROW ONLY;

Lenny



or
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On