IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

SQLCODE=-518


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
murugan_mf

Active User


Joined: 31 Jan 2008
Posts: 148
Location: Chennai, India

PostPosted: Mon Dec 08, 2008 7:56 pm
Reply with quote

I got an SQLCODE=-518 when I execute a dynamic SQL:

Code:
-518 THE EXECUTE STATEMENT DOES NOT IDENTIFY A VALID PREPARED STATEMENT


I have written a dynamic SQL which fetches a cursor.
after fteching the cursor immediately I am calling a sub proc which inserts into a table.
If I comment the call statement which calls insert query the cursor is
fetching all the rows. if I uncomment it it is throwing SQLCODE=-518.

I am bypassing the duplicate rows for the insert query by assiging sqlstate=00000.

Can any one suggest me the solution .
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Dec 08, 2008 10:38 pm
Reply with quote

Hello,

You need to post all of the sql.

Quote:
I am bypassing the duplicate rows for the insert query by assiging sqlstate=00000.
Please clarify what this is telling us.
Back to top
View user's profile Send private message
mallik4u

New User


Joined: 17 Sep 2008
Posts: 75
Location: bangalore

PostPosted: Tue Dec 09, 2008 12:52 pm
Reply with quote

Hi,

It would be better if you post the CURSOR declaration statement along with PREPARE statement of the SQL.
One possible problem, 'WITH HOLD' option might be missing in CURSOR declaration. This might be the problem only when your called program is also updating the same table what CURSOR is referring.


Thanks & Regards,
Mallik
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Dec 09, 2008 1:04 pm
Reply with quote

Hello,

Yes, all of the sql that is part of the problem process should be posted.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts SQLCODE = -122 while using the scalar... DB2 4
No new posts SQLCODE = -16002 when using XMLEXISTS DB2 1
No new posts Is SQLCODE -811 possible while fetchi... DB2 1
No new posts SQLCODE=-204 SQLSTATE=42704 DB2 4
No new posts Getting sqlcode 805 while executing R... DB2 10
Search our Forums:

Back to Top