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

Home -> Community -> Usenet -> c.d.o.tools -> Re: Creating users conditionally on tablespace...

Re: Creating users conditionally on tablespace...

From: Christoph Pfrommer <Christoph.Pfrommer_at_oracle.com>
Date: Thu, 01 Mar 2001 23:26:58 +0100
Message-ID: <3A9ECCB2.CC36A5F2@oracle.com>

Steve Cummings wrote:

> I've tried doing something like this:
>
> var cnt number
> begin
> select count(*) into :cnt from user_tablespaces where tablespace_name =
> 'TEMP'
>
> if (cnt > 0) then
> create user TESTTMP identified by password default tablespace TESTTMP
> temporary tablespace TEMP;
> else
> create user TESTTMP identified by password default tablespace TESTTMP
> temporary tablespace TEMPORARY_DATA;
> end if;
> end;
>
> Unfortunately, Oracle complains about the CREATE USER statement.

"Oracle" complains here about an DDL-Statement within a PL/SQL block. But you can do it with dynamical SQL in your script:

begin
...
execute immediate 'create user ...';
...
end;

Best regards, Christoph. Received on Thu Mar 01 2001 - 16:26:58 CST

Original text of this message

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