DBAsupport.com Forums - Powered by vBulletin
Results 1 to 4 of 4

Thread: dbms package

  1. #1
    Join Date
    Nov 2000
    Posts
    245
    I try to

    alter user user_name account lock;
    alter system kill session 'c_sid, c_serial';

    from a procedure get error.
    11/3 PLS-00103: Encountered the symbol "ALTER" when expecting one of
    the following:
    begin declare end exit for goto if loop mod null pragma raise
    return select update while
    <<
    close current delete fetch lock insert open rollback
    savepoint set sql commit



    I assume I have to use dbms package to do it

    Could anyone tell me which dbms package I can use?

    thanks

  2. #2
    Join Date
    Nov 2000
    Location
    greenwich.ct.us
    Posts
    9,092
    Use dynamic sql to issue this command. See http://technet.oracle.com/docs/produ...dynam.htm#8074 for details.
    Jeff Hunter

  3. #3
    Join Date
    Oct 2000
    Location
    Saskatoon, SK, Canada
    Posts
    3,925
    You cannot directly execute the DDL from a procedure. The way to do that is

    Code:
          procedure .... (p_username VARCHAR2(100))IS
             v_sql_text VARCHAR2(1000);
          BEGIN
             v_sql_text := 'ALTER USER '||p_username ||' ACCOUNT LOCK';
    
             EXECUTE IMMEDIATE v_sql_text;
             .
             :
          END;
          /
          show errors;

    Sam
    Thanx
    Sam



    Life is a journey, not a destination!


  4. #4
    Join Date
    Nov 2000
    Posts
    245

    thanks, I got it

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