dbTalk Databases Forums  

how to pass value to a stored procedure at runtime....

comp.databases.ibm-db2 comp.databases.ibm-db2


Discuss how to pass value to a stored procedure at runtime.... in the comp.databases.ibm-db2 forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Alias
 
Posts: n/a

Default how to pass value to a stored procedure at runtime.... - 04-28-2005 , 03:55 PM






Hi Guys ,
I have to create a procedure which has a cursor declared
inside as :

Declare c_1 cursor for select name,dept,sal,desig from employee where
join_date < ( current timestamp - 100 days);


Is it possible to pass the value 100 at the run time ? I m stuck with
the correct syntax to do it but of no avail . I have tried :

Declare c_1 cursor for select name,dept,sal,desig from employee where
join_date < ( current timestamp ||'-'||p_number||' days)';
where p_number is an IN variable of int type.
But its not working .

Please excuse my ignorance as I m new to db2 .

Thanks .


Reply With Quote
  #2  
Old   
Serge Rielau
 
Posts: n/a

Default Re: how to pass value to a stored procedure at runtime.... - 04-28-2005 , 04:29 PM






Alias wrote:
Quote:
Hi Guys ,
I have to create a procedure which has a cursor declared
inside as :

Declare c_1 cursor for select name,dept,sal,desig from employee where
join_date < ( current timestamp - 100 days);


Is it possible to pass the value 100 at the run time ? I m stuck with
the correct syntax to do it but of no avail . I have tried :

Declare c_1 cursor for select name,dept,sal,desig from employee where
join_date < ( current timestamp ||'-'||p_number||' days)';
where p_number is an IN variable of int type.
But its not working .

Please excuse my ignorance as I m new to db2 .

Thanks .

Have you tried the obvious?

Declare c_1 cursor for select name,dept,sal,desig from employee where
join_date < ( current timestamp - p_number days);

Cheers
Serge
--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab


Reply With Quote
Reply




Thread Tools
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.