View previous topic :: View next topic
|
Author |
Message |
harish_2480
New User
Joined: 07 Jun 2007 Posts: 23 Location: USA
|
|
|
|
Hi All,
We had written one DB2 stored procedure and worked fine. This will be called remotely by Java application. then we changed two cursors where condition for Timestamp. we used
substr(char(timestamp),1,16) = substr(char(:variable),1,16). This is working fine through QMF and we tested the stored procedure as batch program, it worked there also. but when this was called by Java application, then it's not working. It's saying successful but not updating or inserting anything in the database. Please if anyone have or encountered this kind of issue in Stored procedure, Please help me.
Thank you & regards,
Harish. |
|
Back to top |
|
|
singhju
New User
Joined: 01 Dec 2010 Posts: 25 Location: Gurgaon
|
|
|
|
Harish,
you are saying that you cahnged two cursors and then you are saying it is not updating or inserting into database. Little bit confused.
Can you please give some more details like what exact operation are you trying to do and what is the value in :varibale? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Have you considered that the insert/update has happened and was then backed out. . .
Suggest you add some diagnostic test code to show if the insert/update SQL is being executed. |
|
Back to top |
|
|
GuyC
Senior Member
Joined: 11 Aug 2009 Posts: 1281 Location: Belgium
|
|
|
|
I'm absolutely not sure about this, as i can't find the details of an error I had a while back. But I'll mention it, maybe it points you in the right direction.
in Java or (any other dynamic SQL ?) you can not use parameter markers within functions
i.e. "substr(char(?),1,16) " won't prepare
substr(char(timestamp),1,16) = substr(char(:variable),1,16).
besides performance wise it would be better to make 2 variables :
1 containing fe. : '2011-01-12-12.06.00.000000'
and 1 cont. : '2011-01-12-12-06.59.999999'
and rewrite your query as "timestamp between :variable1 and variable2" |
|
Back to top |
|
|
|