By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,846 Members | 1,211 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,846 IT Pros & Developers. It's quick & easy.

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

100+
P: 127
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
Share this Question
Share on Google+
1 Reply


P: 20
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.