Page 1 of 1

what actually done by EXECUTE COMMAND in dynamic sql?

PostPosted: Tue Dec 14, 2010 7:27 pm
by sandip kumar mondal
for fetching record by using cursor in dynamic sql sometime we dont need the execute command.why?

Re: what actually done by EXECUTE COMMAND in dynamic sql?

PostPosted: Tue Dec 14, 2010 7:43 pm
by GuyC
a fetch doesn't need a prepare because it is done during cursor declare/prepare/open

Re: what actually done by EXECUTE COMMAND in dynamic sql?

PostPosted: Wed Dec 29, 2010 4:50 pm
by chandrababun
The SQL statement EXECUTE IMMEDIATE causes an SQL statement to prepare and execute, dynamically, at run time. The EXECUTE IMMEDIATE statement must be placed in the PROCEDURE DIVISION.

Re: what actually done by EXECUTE COMMAND in dynamic sql?

PostPosted: Wed Dec 29, 2010 8:10 pm
by Akatsukami
chandrababun wrote:The SQL statement EXECUTE IMMEDIATE causes an SQL statement to prepare and execute, dynamically, at run time. The EXECUTE IMMEDIATE statement must be placed in the PROCEDURE DIVISION.

Unless, of course, one is using PL/I, Rexx, C/370, Java, or some language other than COBOL.