Re: CREATE/TRUNCATE in PL/SQL???

From: Rich Bernat <rber_at_chevron.com>
Date: 1996/06/24
Message-ID: <4qmhs9$rvv_at_gaudi.lahabra.chevron.com>#1/1


Try this...
Note: this can also work on remote tables via database links.

/*DOC
Procedure to allow DDL for truncating tables */
create or replace procedure truncate_fdb_table(string in varchar2) as source_cursor integer;
ignore integer;
begin

	source_cursor := dbms_sql.open_cursor;
	dbms_sql.parse(source_cursor, 'truncate table ' ||string,dbms_sql.native);
	ignore:= dbms_sql.execute(source_cursor);
	dbms_sql.close_cursor(source_cursor);

end;
/

This allow you to run dynamic SQL.

Good Luck,
Rich

In <4qgg70$gi9_at_Steinlager.tip.net>, unknown (Mike) writes:
>Hi!
>I'm working on a data link between Visual Basic Client-programs
>through an Oracle (7.1) Data Base to a Unisys Mapper-system.
>This involves stored procedures in Oracle communicating with
>a C Batch program through DBMS_PIPE.
>However, since I4m not a very experienced Oracle User I have some
>problems with the stored procedures.
>
>1. I need to store data in an Oracle Table with the (new) name
>sent to the procedure as a parameter. But it seems I can't use
>neither CREATE nor TRUNCATE in PL/SQL. I can use them in SQLPlus
>but that doesn4t help me very much. What do I do?
>
>2. How do use a table name in a variable in for example a SELECT.
>i.e. select * from mytable
>where mytable is the table with the name contained in the variable
>mytable??
>
>Grateful for answers since at the moment I seem to be stucked.
>
>Michael Stenfelt
>Sweden
>
Received on Mon Jun 24 1996 - 00:00:00 CEST

Original text of this message