DDL COMMANDS USED IN PL/SQL BLOCKS!POSSIBLE!
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 2 of 2

Thread: DDL COMMANDS USED IN PL/SQL BLOCKS!POSSIBLE!

  1. #1
    Join Date
    Feb 2001
    Posts
    286
    Hi !

    Working on Oracle v8i with OS as Win2000.

    !Could we use DDL commands in PL/SQL Blocks like in a Procedure as:

    EXECUTE IMMEDIATE ALTER TRIGGER TRIG_NAME DISABLE;
    OR
    EXEC DBMS_SQL PACKAGE.

    Could I have the syntax for this and what procedure/function are to be used with the above package.

    Thanks & Regards,

    Amit.

    Oracle DBA (OCP) v8i,v9i

  2. #2
    Join Date
    Dec 2001
    Location
    UK
    Posts
    1,684
    You've almost got it right yourself:

    EXECUTE IMMEDIATE 'ALTER TRIGGER TRIG_NAME DISABLE';

    Just remember that EXECUTE IMMEDIATE requires the command to be a string.

    This can be put into a stored procedure like:

    CREATE OR REPLACE PROCEDURE ddl_command (p_cmd IN VARCHAR2) IS
    BEGIN
    EXECUTE IMMEDIATE p_cmd;
    END;
    /

    The procedure owners priviledges will dictate which commands it can perform.

    Cheers
    Tim...
    OCP DBA 7.3, 8, 8i, 9i, 10g, 11g
    OCA PL/SQL Developer
    Oracle ACE Director
    My website: www.oracle-base.com
    My blog: www.oracle-base.com/blog

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