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

REG:deletion in Embedded SQL


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

New User


Joined: 01 Sep 2005
Posts: 33

PostPosted: Fri Oct 26, 2007 6:18 pm
Reply with quote

Hi,

Generally we use following query to delete the entry from particular table.

EXEC SQL
DELETE FROM EMP
WHERE EMP_NO =:WS-EMP-NO
END-EXEC

If suppose an employee belongs to two dept and want to delete the emp from any one dept.

I have used following query,but I'm getting -84 sqlcode(Unacceptable SQL stmt)

EXEC SQL
DELETE FROM EMP
WHERE EMP_NO =: WS-EMP-NO AND
DEPT =: WS-DEPT
END-EXEC

I appreciate if anyone would provide exact syntact of above deletion.

Thanks
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: Fri Oct 26, 2007 8:53 pm
Reply with quote

Hello,

It appears as though you have invalid spaces between the ":" and the ws data-names. . .?
Code:
EXEC SQL
DELETE FROM EMP
WHERE EMP_NO =: WS-EMP-NO AND
DEPT =: WS-DEPT
END-EXEC


This (the code that works) does not.

Code:
EXEC SQL
DELETE FROM EMP
WHERE EMP_NO =:WS-EMP-NO
END-EXEC
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 cobol embedded sql COBOL Programming 7
No new posts Null Indicator value -2 means in Embe... DB2 2
No new posts [SQL0029] INTO clause missing from em... DB2 2
No new posts Embedded programs / link'ed programs CICS 5
No new posts DELETE query to have deletion of the ... DB2 2
Search our Forums:

Back to Top