View previous topic :: View next topic
|
Author |
Message |
brahmanandareddy
New User
Joined: 16 Dec 2004 Posts: 44 Location: Hyderabad
|
|
|
|
Please let me know if there are any mistakes in the below program. I did not get this executed when i tried to.
IDENTIFICATION DIVISION.
PROGRAM-ID. DYNAM1.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 WS-REC.
49 WS-LEN PIC S9(4) COMPT.
49 WS-TXT PIC X(100).
PROCEDURE DIVISION.
MOVE 45 TO WS-LEN.
MOVE 'DELETE * FROM EMP WHERE EMPNO = 1200' TO WS-TXT.
EXEC SQL
PREPARE DYN FROM WS-REC
END-EXEC.
EXEC SQL
EXECUTE DYN
END-EXEC.
STOP RUN.
In the above program EMP table is existing with a record 1200. I could run and execute error-free, but in the EMP table that particular record is not getting deleted. What is the error in the above pgm.
Also observe below........
after moving the statements like the above pgm i want to execute directly without preparing...... is the below one enough and correct
EXEC SQL
EXECUTE IMMEDIATE :WS-REC
END-EXEC. |
|
Back to top |
|
|
ashok_bln Warnings : 1 New User
Joined: 19 Feb 2005 Posts: 5 Location: bangalore
|
|
|
|
hello reddy
this is very small mistake.
u should not use * in the following sentence
'DELETE * FROM EMP WHERE EMPNO = 1200'
it should look like this
'DELETE FROM EMP WHERE EMPNO = 1200'
i think this will work
bye
ashok
080-23413623
bln_ashok@yahoo.co.in |
|
Back to top |
|
|
khamarutheen
Active Member
Joined: 23 Aug 2005 Posts: 677 Location: NJ
|
|
|
|
hi frnd,
MOVE 1200 TO EMPNO.
MOVE 45 TO WS-LEN.
MOVE 'DELETE * FROM EMP WHERE EMPNO = :EMPNO' TO WS-TXT.
Hope it will work.. check out and let me know. |
|
Back to top |
|
|
|