The 'execute immediate ' stamt.?
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 4 of 4

Thread: The 'execute immediate ' stamt.?

  1. #1
    Join Date
    Dec 2000
    Posts
    255
    HI all

    What is the purpose of 'EXECUTE IMMEDIATE' statement in the PLSQL block. What purpose does it serve and how is it used? The reason I am asking is that I want to use multiple sql statements in PLSQL block?

    Amol

  2. #2
    Join Date
    Oct 2001
    Location
    Madrid, Spain
    Posts
    763
    http://www.dbasupport.com/oracle/ora8/page6.shtml

    In the future try to search before, there are a lot of threads on this topic in this forum.

    Cheers

    Angel

  3. #3
    Join Date
    Aug 2000
    Location
    Singapore
    Posts
    323
    EXECUTE IMMEDIATE IS A DYNAMIC STATEMENT. You can use this statement for example,
    DECLARE
    v_stmt VARCHAR2(200);
    BEGIN
    v_stmt :='TRUNCATE TABLE DEPT';
    EXECUTE IMMEDIATE v_stmt;
    END;

    It truncates the DEPT table. If I am not wrong it is just replacement of DBMS_SQL package, which we use normally for DYNAMIC SQLS.

    Correct me If I am wrong.

    Nagesh

  4. #4
    Join Date
    Apr 2001
    Location
    Brisbane, Queensland, Australia
    Posts
    1,203
    All I'm going to add is that it's a God Send compared to the dynamic cursors needed in Oracle8 to perform the same function.

    Cheers
    OCP 8i, 9i DBA
    Brisbane Australia

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width