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 > stored procedure error

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-28-08, 08:25
oracle10gsingh oracle10gsingh is offline
Registered User
 
Join Date: Nov 2007
Posts: 72
stored procedure error

Hi guys !

i am creating a stored procedure

create procedure sp_date_param (IN inp_date,col_value varchar(50),tbl_name varchar(50)
LANGUAGE SQL
begin
select count(*) from tbl_name where col_value='inp_date'

end
o/s is aix 5.3 and db2 8.2.3 creating it via command editor !
logic is that i want to give the name of the table in my datastage job and this tbl_name table doesnot exist which i will be passing through my datastaje job .

please tell me what wrong am i doing ? what is the error why cant i parameterised the value in the procedure .
i tried the same with db2 workbench .but its not parsing as it is not taking date value

will appreciate a quick reply !!
thank you very much
oracle10gsingh !!
Reply With Quote
  #2 (permalink)  
Old 01-28-08, 09:11
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
First please read the manual on the correct syntax for the CREATE PROCEDURE statement. Your parameter list is not declared properly for one. Second, this question gets asked a lot. You need to use dynamic sql. Look into PREPARE and EXECUTE statements. Also search this forum as this question has been answered many times.

Andy
Reply With Quote
  #3 (permalink)  
Old 01-28-08, 12:46
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
Also, what should be done with the result of the query? You don't consume it...
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
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