Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: newbie: dyamic SQL again
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;
-- 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
![]() |
![]() |