467,912 Members | 1,639 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,912 developers. It's quick & easy.

Urgent! How to bind an numeric value for a Dynamic SQL Statement inside Stored Proc

100+
Hello All,

I am using a Dynamic SQL Statement inside a Stored Procedure. I am using IBM DB2 V8.1 database.

When i want to have the values to be filled in dynamically, i use the parameter marker (?). I dont have any issues if the value is of type VARCHAR. But I get an error if i bind a value other than Varchar (String) say, an Integer. The error I get is "The statement "<stmt what i prepare>" is too long".

See the statements i use :

DECLARE v_STMT VARCHAR(5000);
--
SET v_STMT = 'INSERT INTO <Schema>.<tableName> (col1,col2) VALUES (?,?)';
--
PREPARE s1 FROM v_STMT;
--
EXECUTE s1 USING val1,val2;


Can anybody please assist me how or what should i do if one of the values being Numeric and TimeStamp.

I have even tried with CAST(? AS INTEGER) for the appropriate value's placeholder as well. But its not working.

Any immediate help is much appreciable and i thank you all in advance.
Apr 2 '07 #1
  • viewed: 1654
Share:
1 Reply
How was the stored procedure created?
Apr 4 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

9 posts views Thread by Stefan Bauer | last post: by
28 posts views Thread by Tamir Khason | last post: by
33 posts views Thread by dembla | last post: by
8 posts views Thread by ginnisharma1 | last post: by
1 post views Thread by alok sengar | last post: by
17 posts views Thread by Saps | last post: by
3 posts views Thread by N. Spiker | last post: by
1 post views Thread by rajesh.us.it.recruiter | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.