+ Reply to Thread
Results 1 to 4 of 4

Alter Table in PL/SQL

  1. Alter Table in PL/SQL

    I am using the following statement
    ALTER TABLE abc ENABLE PRIMARY KEY
    This statement works fine if I issue it in SQLPlus. It also work
    fine inside a simple sql script. However it does not work in th
    following PL/SQL script

    BEGI
    ALTER TABLE abc ENABLE PRIMARY KEY
    END


    I get an error on the Alter Table line stating that another statemen
    was expected and then it provides a long list of nearly all PL/SQ
    statements. Is there something I have to do before I can use an Alte
    Table statement after a Begin statement in a script
    Thanks for your time


  2. Re: Alter Table in PL/SQL

    DDL in PL/SQL? Take a look at dynamic SQL.

    Cheers.

    Carlos.


  3. Re: Alter Table in PL/SQL

    "willpwr" wrote in
    message news:y7ydnVJhIYCuscLeRVn_vA@giganews.com
    > I am using the following statement:
    > ALTER TABLE abc ENABLE PRIMARY KEY;
    > This statement works fine if I issue it in SQLPlus. It also works
    > fine inside a simple sql script. However it does not work in the
    > following PL/SQL script:
    >
    > BEGIN
    > ALTER TABLE abc ENABLE PRIMARY KEY;
    > END;
    > /
    >
    > I get an error on the Alter Table line stating that another statement
    > was expected and then it provides a long list of nearly all PL/SQL
    > statements. Is there something I have to do before I can use an Alter
    > Table statement after a Begin statement in a script?
    > Thanks for your time.



    BEGIN
    EXECUTE IMMEDIATE('ALTER TABLE abc ENABLE PRIMARY KEY');
    END;


  4. DDL indead not possible in PLSQL

    Indead

    DDL is not possible in PLSQL, and execute immediate works well
    Remember: also an automatic commit is done
    If you have an older version of the database, you can use the packag
    DBMS_SQL

    Hope this helps

    Roel Hogendoor
    More information on Tech Oracle Applications and Tech Oracle can b
    found in the Knowledge Base on
    http://www.altasen.co


+ Reply to Thread