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: create table grants and Dynamic SQL question

Re: create table grants and Dynamic SQL question

From: Jim Kennedy <kennedy-downwithspammersfamily_at_attbi.net>
Date: Mon, 24 May 2004 02:13:02 GMT
Message-ID: <OScsc.13505$hi6.1404890@attbi_s53>

"FlameDance" <FlameDance_at_gmx.de> wrote in message news:c8qfd3$nkl$07$1_at_news.t-online.com...
> Hi,
>
> given 2 users a and b, I would like to do the following:
>
> connect a/password_at_instance
> create table b.test (x number);
> drop table b.test;
>
> Is this possible in Oracle 9.2, and if yes, which grants will I have to
set?
>
> Is it furthermore possible to put it into dynamic SQL?
>
> DECLARE
> Cmd VARCHAR2(100);
> BEGIN
> Cmd := 'CREATE TABLE data.test (x number)';
> EXECUTE IMMEDIATE Cmd;
> -- do something with test
> Cmd := 'DROP TABLE data.test';
> EXECUTE IMMEDIATE Cmd;
> END;
> /
>
> I'm NOT looking for a temporary PL/SQL table, I need a persistent
> regular table, just under another user. Another idea would be to let the
> dynamic Cmd run as user b - but how could I invoke that from a PL/SQL
> package running as user a?
>
> Stephan

Don't do this. You probably don't need to do this in the first place. This is not MS SQL Server or Sybase. But if you really, reallly think you need to do something like this then use global temporary tables (see documentation or asktom.oracle.com and do a search). Then you don't have to do the whole create table dance.
Jim Received on Sun May 23 2004 - 21:13:02 CDT

Original text of this message

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