Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2010
    Posts
    1

    Unanswered: Execute Immediate Create User error

    I'm having difficulty with this script. Just want to create a user on the fly. Will install a cursor later so I can spin thru our employees and add a new user for each one.

    I'm getting the error:
    PLS-00103: Encountered the symbol "CREATE" when expecting one of the following:
    ( begin case declare exit for goto if loop mod null pragma ...
    ORA-06512: at line 15 (The execute immediate is on line 15)

    This is the output to the put_line, which is what I want:
    begin
    Create User O$PI\BILL Identified externally ;
    end;

    Finally, here is the code:
    declare

    t_user varchar2(20);
    t_stmt varchar2(1000);

    begin
    t_user := 'BILL';
    t_stmt := 'begin'||chr(10)||
    ' Create User '|| 'O$PI'|| '\' ||
    t_user || ' Identified externally ; '||chr(10)||
    'end;'|| chr(10);

    dbms_output.put_line(t_stmt);

    EXECUTE IMMEDIATE t_stmt;

    end;

    Any help is appreciated. Thanks
    Using Oracle 11.1
    Last edited by wildbill; 11-15-10 at 18:44.

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

Posting Permissions

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