Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: stored procedure

Re: stored procedure

From: fumi <fumi_at_tpts5.seed.net.tw>
Date: 26 Oct 1999 16:49:35 GMT
Message-ID: <7v4m2v$gdm$3@news.seed.net.tw>

Koen Van Tolhuyzen <Koen.VanTolhuyzen_at_cronos.be> wrote in message news:7v1h4a$l2o$1_at_news3.Belgium.EU.net...
> Hi, I created a stored procedure to create a user, but I keep on getting an
> error.
> Can anyone tell me what is wrong ? I'm using Oracle 8i.
>
> SQL> create or replace PROCEDURE CREATE_USER
> 2 (p_username IN VARCHAR2
> 3 ,p_password IN VARCHAR2)
> 4 IS
> 5 BEGIN
> 6 EXECUTE IMMEDIATE 'CREATE USER ' || p_username || 'IDENTIFIED BY ' ||
> p_password || ';' ;
> 7 EXECUTE IMMEDIATE 'GRANT CONNECT TO ' || p_username || ';' ;
> 8 end;
> 9 /
>
> Procedure created.
>
> SQL> call create_user('fab','fab');
> call create_user('fab','fab')
> *
> ERROR at line 1:
> ORA-00922: missing or invalid option
> ORA-06512: at "SYSTEM.CREATE_USER", line 6
> ORA-06512: at line 1

  1. Eliminate the semicolon ';' in the end of SQL statement.
  2. Put a space before 'IDENTIFIED BY'. That's why the error ORA-922 occured.
  3. Make sure the definer has the directly granted privileges. In default, only SYS (but not SYSTEM) has such privileges.
Received on Tue Oct 26 1999 - 11:49:35 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US