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: Dynamic Tables

Re: Dynamic Tables

From: Tim Sawmiller <sawmillert_at_state.mi.us>
Date: Wed, 31 Jan 2001 13:50:01 -0500
Message-Id: <10758.127928@fatcity.com>


geez, what is this, dynamic table week? :-)

>>> anu_dewan_at_yahoo.co.uk 01/31/01 12:11PM >>>
Hi,

    I have to dynamically create a table and then dynamically get the count
  of the rows in a variable. i'm using Oracle 7.3.4. i have written the following code...but its not working.
please help me out.
thanx in advance.

CREATE OR REPLACE PROCEDURE CR_TABLE AS
A NUMBER;
QUERY1 VARCHAR2(200);
QUERY2 VARCHAR2(200);

CUR1 INTEGER;
CUR2 INTEGER;
RET1 INTEGER;
RET2 INTEGER;

BEGIN
CURSOR1:=3DDBMS_SQL.OPEN_CURSOR;
QUERY1:=3D'CREATE TABLE CR AS SELECT * FROM INS'; DBMS_SQL.PARSE(CUR1,QUERY1,DBMS_SQL.V7); RET1:=3DDBMS_SQL.EXECUTE(CUR1);
DBMS_SQL.CLOSE_CURSOR(CUR1);
DBMS_OUTPUT.PUT_LINE('TABLE CREATED');
CUR2:=3DDBMS_SQL.OPEN_CURSOR;
QUERY2:=3D'SELECT COUNT(*) FROM CR';
DBMS_SQL.PARSE(CUR2,QUERY2,DBMS_SQL.V7); RET2:=3DDBMS_SQL.EXECUTE_AND_FETCH(CUR2); A:=3DDBMS_SQL.LAST_ROW_COUNT;
DBMS_SQL.CLOSE_CURSOR(CUR2);
DBMS_OUTPUT.PUT_LINE('ROWS COUNTED');
END; -anurag

Do You Yahoo!?
Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk=20 or your free @yahoo.ie address at http://mail.yahoo.ie=20 --=20
Please see the official ORACLE-L FAQ: http://www.orafaq.com=20 --=20
Author: =3D?iso-8859-1?q?anurag=3D20dewan?=3D   INET: anu_dewan_at_yahoo.co.uk=20
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 - 12:50:01 CST

Original text of this message

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