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 > create procedure with IN .. IN

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-16-06, 07:48
krReddy krReddy is offline
Registered User
 
Join Date: Oct 2006
Posts: 83
create procedure with IN .. IN

Can i use two "IN's" in a single procedure. If so please tell me whether below code is with right syntax. While executing it im getting some errors.


CREATE PROCEDURE test
(IN EMPLOYEE_NUMBER CHAR(10),
IN RATE DECIMAL(6,2))
LANGUAGE SQL
SELECT * FROM EMP ;
Reply With Quote
  #2 (permalink)  
Old 11-16-06, 12:02
guyprzytula guyprzytula is offline
Registered User
 
Join Date: Jun 2006
Posts: 471
sp

yes multi in is supported
why don't you indicate the error and when does it occur ?
see create procedure in info center for detailed info
__________________
Best Regards, Guy Przytula
DB2 UDB LUW certified V6/7/8
Reply With Quote
  #3 (permalink)  
Old 11-16-06, 12:41
krReddy krReddy is offline
Registered User
 
Join Date: Oct 2006
Posts: 83
thank u ,
i am unable to trace out this.i compared this syntax with db2 create procedure syntax in info centre.
error message 0104N an unexpected token "from" found after language

kindly resolve this
Reply With Quote
  #4 (permalink)  
Old 11-17-06, 00:25
manish21 manish21 is offline
Registered User
 
Join Date: Jan 2003
Posts: 35
You cannot directly write a select stmt in a stored proc. You will have to write a cursor for fetching the output of the select in some variables. For eg suppose the emp table has two smallint columns the syntax of the stored procedure can be

CREATE PROCEDURE test
(IN EMPLOYEE_NUMBER CHAR(10),
IN RATE DECIMAL(6,2))
LANGUAGE SQL
begin
Declare a smallint;
Declare b smallint;
declare c1 cursor for
SELECT * FROM EMP ;

fetch c1 into a,b;
end
Reply With Quote
  #5 (permalink)  
Old 11-17-06, 02:37
madayang1981 madayang1981 is offline
Registered User
 
Join Date: Nov 2006
Posts: 4
the cursor need open before fetch or close
Reply With Quote
  #6 (permalink)  
Old 11-23-06, 07:24
manish21 manish21 is offline
Registered User
 
Join Date: Jan 2003
Posts: 35
Thanks .Below is the corrected stmt

CREATE PROCEDURE test
(IN EMPLOYEE_NUMBER CHAR(10),
IN RATE DECIMAL(6,2))
LANGUAGE SQL
begin
Declare a smallint;
Declare b smallint;
declare c1 cursor for
SELECT * FROM EMP ;
open c1;
fetch c1 into a,b;
close c1;
end
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