1. Get rid of all advertisements and get unlimited access to documents by upgrading to Premium Membership. Upgrade to Premium Now and also get a Premium Badge!

Execute immediate

Discussion in 'SQL PL/SQL' started by krithika@2001, Jun 17, 2009.

  1. krithika@2001

    krithika@2001 Active Member

    Messages:
    30
    Likes Received:
    0
    Trophy Points:
    80
    Hi

    Can anybody explain the use of EXECUTE IMMEDIATE in SQL with example
     
  2. rajavu

    rajavu Forum Guru

    Messages:
    815
    Likes Received:
    52
    Trophy Points:
    610
    Location:
    @ Bangalore , India
    Execute Immediate is to be used in either PL/SQL block or or anonymous bloack and not in SQL. But It can be executed against SQL and PL/SQL block.

    Check this links for some simple examples.

    Link 1
    Link 2
     
  3. krithika@2001

    krithika@2001 Active Member

    Messages:
    30
    Likes Received:
    0
    Trophy Points:
    80
    Thanks raj
     
  4. sashraf

    sashraf Active Member

    Messages:
    11
    Likes Received:
    1
    Trophy Points:
    90
    Location:
    Hyderbad. India
    In plsql for execution of any DDL statement we require Execute immediate
     
  5. rajavu

    rajavu Forum Guru

    Messages:
    815
    Likes Received:
    52
    Trophy Points:
    610
    Location:
    @ Bangalore , India
    Not necessarily EXECUTE IMMEDIATE.

    Any type of Dynamic SQL will do the trick.ie, even DBMS_SQL package will do it for you.

    Though Execute immediate almost replaced the DBMS_SQL package , some times DBMS_SQL cannot be avoided.