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

Home -> Community -> Mailing Lists -> Oracle-L -> Re: newbie: dyamic SQL again

Re: newbie: dyamic SQL again

From: Viktor <stant_98_at_yahoo.com>
Date: Wed, 31 Jan 2001 11:53:51 -0800
Message-ID: <F001.002A61D8.20010131111557@fatcity.com>

I am not quite sure what error you are geting since you did not specify it.

But you will definately need to have explicit direct 'CREATE TABLE' privilege, then you may want to try this:
CREATE OR REPLACE PROCEDURE CR_TABLE AS QUERY1 VARCHAR2(200);
QUERY2 VARCHAR2(200);
CUR1 INTEGER;
RET1 INTEGER;
A NUMBER; BEGIN
CUR1:=DBMS_SQL.OPEN_CURSOR;
QUERY1:='CREATE TABLE CR AS SELECT * FROM INS'; DBMS_SQL.PARSE(CUR1,QUERY1,DBMS_SQL.V7); RET1:=DBMS_SQL.EXECUTE(CUR1);
DBMS_SQL.CLOSE_CURSOR(CUR1);
DBMS_OUTPUT.PUT_LINE('TABLE CREATED');
CUR1:=DBMS_SQL.OPEN_CURSOR;
DBMS_SQL.PARSE(CUR1,'SELECT COUNT(*) FROM CR',DBMS_SQL.V7);
DBMS_SQL.DEFINE_COLUMN (cur1, 1, a);
RET1:=DBMS_SQL.EXECUTE_AND_FETCH(CUR1);

DBMS_SQL.COLUMN_VALUE (cur1, 1, a);
DBMS_SQL.CLOSE_CURSOR(CUR1);
DBMS_OUTPUT.PUT_LINE(a||' - '||'ROWS COUNTED');
END;
/
Get personalized email addresses from Yahoo! Mail - only $35 a year! http://personal.mail.yahoo.com/
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Viktor
  INET: stant_98_at_yahoo.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Wed Jan 31 2001 - 13:53:51 CST

Original text of this message

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