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

Difference bitween Static and Dynamic SQL.


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

New User


Joined: 28 Jul 2005
Posts: 5

PostPosted: Thu Aug 04, 2005 3:20 pm
Reply with quote

Hi All,


What is the Difference bitween Static and Dynamic SQL.


Regards,
Murali.
Back to top
View user's profile Send private message
ashokkumarsahu

New User


Joined: 03 Aug 2005
Posts: 5
Location: bangalore

PostPosted: Thu Aug 04, 2005 3:34 pm
Reply with quote

In case of static call goth the called program and calling program are loaded into main memory at atime but in case of dynamic call called program is loaeded at the time of call only .
Back to top
View user's profile Send private message
sravani

New User


Joined: 17 Jul 2005
Posts: 2

PostPosted: Thu Aug 04, 2005 9:23 pm
Reply with quote

Hi,

A static SQL is hard coded in the program/stored proc when the the columns and conditions to be used are fixed.

Dynamic SQL is used when the query need to be midfitied based on different conditions.

Preparing the dynamic SQL:
EXEC SQL
PREPARE DYNAMIC_CSR <Dynamic_Cursor_Name>
FROM :WS-DYNAM-SQL-AREA <working storage area definitions>
END-EXEC

Regards,
Sravani
Back to top
View user's profile Send private message
bonniem

New User


Joined: 09 Aug 2005
Posts: 67

PostPosted: Tue Aug 09, 2005 10:37 am
Reply with quote

Hi,

I would like to add one more point. Static SQL is bound at program preparation time whereas dynamic SQL is bound at run time. Which of course has lesser performance than static SQL.
Back to top
View user's profile Send private message
niranjan.sinha@gmail.com

New User


Joined: 16 Aug 2005
Posts: 1

PostPosted: Tue Aug 16, 2005 2:13 pm
Reply with quote

1) For Static Call we use Compiler option NODYNM, But Dynamic Call we use Compiler option DYNAM.

2) For Static Call load module is very large,but for Dynamic call load module size is very small.

3) For Static call access path is created while compiling, but for Dynamic call access path is created at run time.
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 Using Dynamic file handler in the Fil... COBOL Programming 2
No new posts JCL Dynamic System Symbols JCL & VSAM 3
No new posts Timestamp difference and its average ... DB2 11
No new posts Synctool-dynamic split job for varyin... JCL & VSAM 7
No new posts Difference when accessing dataset in ... JCL & VSAM 7
Search our Forums:

Back to Top