Dynamic SQL

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Thilagavathiibm
    New Member
    • Jun 2007
    • 1

    Dynamic SQL

    Hi,

    Can anyone please tell me what is a Dynamic SQL and How it is differed from Static SQL?
  • frozenmist
    Recognized Expert New Member
    • May 2007
    • 179

    #2
    Hi,
    Dynamic Sql: Its like you build the query during run time.
    For example: suppose you dont know the table name on which you need to query on and you are getting it as input parameter to a procedure. Then you need to build the query as a string and execute it. In short , we know of the outcome of the query only during execution.

    eg: set v_string ='Insert into table1 values (1,2)';
    execute immediate v_string



    Static query: You can know the end result before running itself. Its like you know where all the query is going to affect.

    You can get more on dynamic sql in any sql tutorial...
    Cheers

    Comment

    Working...