Error in PL/SQL block

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dilippanda
    New Member
    • Jun 2007
    • 26

    Error in PL/SQL block

    Hi,

    While executing the following block i am getting error as Insuffiecient privilege.

    CREATE OR REPLACE PROCEDURE ddl_create_proc (p_table_name IN VARCHAR2)
    AS
    l_stmt VARCHAR2(200);
    BEGIN
    DBMS_OUTPUT.put _line('STARTING ');
    l_stmt := 'create table '|| p_table_name || ' as (select * from emp )';
    EXECUTE IMMEDIATE l_stmt;
    DBMS_OUTPUT.PUT _LINE('end ');
    EXCEPTION
    WHEN OTHERS THEN
    DBMS_OUTPUT.PUT _LINE('exceptio n '||SQLERRM || 'message'||sqlc ode);
    END;

    exec ddl_create_proc ('TEMP');

    STARTING
    exception ORA-01031: insufficient privilegesmessa ge-1031.

    Please help me regarding this error.

    Thanks,
    Dilip
    09337877895
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    There could be 2 possible reasons.

    1. The user does not have create table previliges.
    2. The user does not have select previleges on the emp table.

    Comment

    • dilippanda
      New Member
      • Jun 2007
      • 26

      #3
      Hi,

      EMP table has been created in SCOTT user.
      I am able to create and select tables in that user.So that user has create table privileges and select privileges.

      Is there any other problem?

      Thanks,
      Dilip
      Originally posted by debasisdas
      There could be 2 possible reasons.

      1. The user does not have create table previliges.
      2. The user does not have select previleges on the emp table.

      Comment

      • debasisdas
        Recognized Expert Expert
        • Dec 2006
        • 8119

        #4
        Log in through the sys user and grant CREATE TABLE previleges to scott user or ask your DBA to do the same for you.

        It should work for you.

        I can't figure out any other problem

        Please try the above and do post back.

        Comment

        Working...