473,472 Members | 2,137 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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

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 .

Nov 12 '05 #1
1 2661
Alias wrote:
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
Nov 12 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Jeff Thur | last post by:
I am running a SQL Stored Procedure that will give the user a count of how many records are in the database as per certain criteria. I'm using the Execute Scalar Method. I have no problem passing...
1
by: T.S.Negi | last post by:
Dear Techies, I making one stored procedure, which does some operation based on an interface hash (#) table ---- name #mydata. This stored has two section of code (seperated by parameter value...
7
by: Zlatko Matić | last post by:
Let's assume that we have a database on some SQL server (let it be MS SQL Server) and that we want to execute some parameterized query as a pass.through query. How can we pass parameters to the...
45
by: John | last post by:
Hi When developing vb.bet winform apps bound to sql server datasource, is it preferable to use SELECTs or stored procedure to read and write data from/to SQL Server? Why? Thanks Regards
4
by: CsharpGuy | last post by:
I took over an web app (C#) were the developer put everything in a has table then called a method to execute a stored procedure, now I'm running into some issues were if I do an update and a NULL...
3
by: Joseph Lu | last post by:
Hi, all I have a stored procedure created in SQL Server like the following lines. // stored proceudre code starts here CREATE PROCEDURE sp_insertdata @strdata varchar(250) , @rsult BIT...
2
by: rn5a | last post by:
How do I pass a NULL value to a field while inserting records in a SQL Server 2005 DB table using a stored procedure? I tried the following but it inserts an empty string & not a NULL value: ...
0
by: Afaque Khan | last post by:
HI All, I have a requirement, I need to pass table as IN parameter in the stored procedure. But when I do this it just says Table 'database.strtable' doesn't exist . Can you guys please advice...
1
by: FredZimmerman | last post by:
Is there a way to pass SecureString value (from C# web application) to a SQL 2005 stored procedure as Input parameter? How is it handled from both sides (application, and stored procedure)? ...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.