Geeks Talk

Prepare for your Next Interview




an interesting topic

This is a discussion on an interesting topic within the SQL forums, part of the Databases category; when to use dynamic sql rather than static sql if answer is in static sql one hve a fixed sql statement but where in dynamic sql u can build sql ...


Go Back   Geeks Talk > Databases > SQL

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 01-24-2008
Contributing Member
 
Join Date: Apr 2006
Location: kolkata(now in noida)
Posts: 56
Thanks: 9
Thanked 3 Times in 2 Posts
bhaski is on a distinguished road
an interesting topic

when to use dynamic sql rather than static sql

if answer is

in static sql one hve a fixed sql statement but where in dynamic sql u can build sql statements as charecter string at run time

den wat is the difference between ref cursor and dynamic sql

Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 01-24-2008
Contributing Member
 
Join Date: Sep 2007
Location: hyderabad
Posts: 37
Thanks: 5
Thanked 2 Times in 2 Posts
ashalalaxmi2002 is on a distinguished road
Re: an interesting topic

in normal PL/SQL block it will allow only DML statements to execute.if we are executing other than DML like DDL(CREATE ,ALTER ,DROP),DCL(GRANT,REVOKE) AND SESSION CONTROL LANGUAGE(CREATE SESSION) it will come out from the block and gives an error.
by using dynamic sql we can execute DDL ,DCL,SESSION CONTROL langueges.this is one advantage of dynamic sql.
Reply With Quote
  #3 (permalink)  
Old 01-24-2008
Contributing Member
 
Join Date: Apr 2006
Location: kolkata(now in noida)
Posts: 56
Thanks: 9
Thanked 3 Times in 2 Posts
bhaski is on a distinguished road
Re: an interesting topic

Quote:
Originally Posted by ashalalaxmi2002 View Post
in normal PL/SQL block it will allow only DML statements to execute.if we are executing other than DML like DDL(CREATE ,ALTER ,DROP),DCL(GRANT,REVOKE) AND SESSION CONTROL LANGUAGE(CREATE SESSION) it will come out from the block and gives an error.
by using dynamic sql we can execute DDL ,DCL,SESSION CONTROL langueges.this is one advantage of dynamic sql.
question is not advantage of dynamic sql but in such case i mentioned which is appropriate?
Reply With Quote
  #4 (permalink)  
Old 01-24-2008
Moderator
 
Join Date: Jun 2007
Location: Bangalore,India
Posts: 1,432
Thanks: 8
Thanked 125 Times in 112 Posts
debasisdas will become famous soon enoughdebasisdas will become famous soon enough
Re: an interesting topic

Quote:
Originally Posted by bhaski View Post
question is not advantage of dynamic sql but in such case i mentioned which is appropriate?
Use dynamic sql when the anme of the objects are not known in advance and passed only at runtime.
Reply With Quote
The Following User Says Thank You to debasisdas For This Useful Post:
  #5 (permalink)  
Old 02-12-2008
Junior Member
 
Join Date: Feb 2008
Posts: 11
Thanks: 0
Thanked 1 Time in 1 Post
expertsharingdotcom is on a distinguished road
Re: an interesting topic

use the execute immediate statement to do ddl statement in oracle
Reply With Quote
Reply

  Geeks Talk > Databases > SQL


Thread Tools
Display Modes


Similar Threads

Thread Thread Starter Forum Replies Last Post
B.Tech Project Topic sunnysharma85 Career Advice 1 12-26-2007 05:49 AM
Topic in Networking domain on J2EE Geek_Guest Career Advice 0 07-25-2007 11:31 PM
new GD topic vmshenoy Suggestions & Feedback 2 01-10-2007 03:34 AM
Newbie : there is no topic Ralfman68 Downloads 2 12-03-2006 07:40 PM
Question on topic Collection & Thread abdul.sayeed Java 0 11-30-2006 01:59 AM


All times are GMT -4. The time now is 12:59 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Copyright © 2008 GeekInterview.com. All Rights Reserved