what actually done by EXECUTE COMMAND in dynamic sql?



IBM's flagship relational database management system

what actually done by EXECUTE COMMAND in dynamic sql?

Postby sandip kumar mondal » Tue Dec 14, 2010 7:27 pm

for fetching record by using cursor in dynamic sql sometime we dont need the execute command.why?
sandip kumar mondal
 
Posts: 6
Joined: Wed Dec 08, 2010 9:52 pm
Has thanked: 0 time
Been thanked: 0 time

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

Postby GuyC » Tue Dec 14, 2010 7:43 pm

a fetch doesn't need a prepare because it is done during cursor declare/prepare/open
I can explain it to you, but i can not understand it for you.
GuyC
 
Posts: 315
Joined: Tue Aug 11, 2009 3:23 pm
Has thanked: 1 time
Been thanked: 4 times

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

Postby chandrababun » Wed Dec 29, 2010 4:50 pm

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.
chandrababun
 
Posts: 3
Joined: Wed Oct 20, 2010 2:36 pm
Has thanked: 0 time
Been thanked: 0 time

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

Postby Akatsukami » Wed Dec 29, 2010 8:10 pm

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.
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1058
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times


Return to DB2

 


  • Related topics
    Replies
    Views
    Last post