Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

What is the Difference of Static SQL and Dynamic SQL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
penchalaiaht

New User


Joined: 22 Mar 2006
Posts: 2
Location: Bangalore

PostPosted: Sun Jan 21, 2007 3:11 am    Post subject: What is the Difference of Static SQL and Dynamic SQL
Reply with quote

Hi

could you give me the brief explanation for Static SQL and Dynamic SQL
Back to top
View user's profile Send private message

William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Sun Jan 21, 2007 3:55 am    Post subject:
Reply with quote

penchalaiaht,

FWIW (For What It's Worth):
Static has already been evaluated by the SQL optimizer and (hopefully) optimized for the best access to the data.
Dynamic has not (yet) been optimized and, with a throw of the dice, will get be optimized well (real time cpu goes here).
Static is, for instance, a select with all the conditions already decided, the actual values of the selection need to be decided but the structure of the select is already "poured in concrete", so to speak.
Dynamic is pretty much "freeflow", The actual conditions for the select have been determined at execution time.
Static can be "honed" to the most efficient select while, expending cpu real time, dynamic may or may not pick the best access path.

Is that enough?

Bill
Back to top
View user's profile Send private message
DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Mon Jan 22, 2007 5:42 am    Post subject: Re: What is the Difference of Static SQL and Dynamic SQL
Reply with quote

Penchalaiaht,

Static SQL is coded in your program and analyzed or prepared at compile time. You cannot change the SQL.

Dynamic SQL is constructed at execution time in working storage as a character field. (This would be done, perhaps, when a column exists in multiple tables or the column name you want to select is unknown until execution time) then prepared and executed. This method is not as efficient as static SQLs and may result in less than the best access to the data.

Please also take a look the links in this previous post Previous Post
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Dynamic array request/response contai... Suja.Sai CICS 2 Tue Jan 24, 2017 11:37 am
No new posts Difference between TWALENG and TWASIZE Arunkumar Chandrasekaran CICS 3 Tue Jan 03, 2017 12:57 pm
No new posts REXX DB2: Dynamic allocation of DB2.D... BHAS CLIST & REXX 3 Mon Dec 19, 2016 8:26 pm
No new posts Sticky: difference between ... DUMMY ... and ... enrico-sorichetti JCL & VSAM 0 Mon Oct 17, 2016 4:31 pm
No new posts Creating a dynamic sort card in JCL u... ChitraChhabra DFSORT/ICETOOL 4 Wed Aug 03, 2016 6:15 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us