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

Home -> Community -> Usenet -> c.d.o.server -> Re: Place SQL statements in PL/SQL procedure but failed...

Re: Place SQL statements in PL/SQL procedure but failed...

From: Vishal Makhija <vishal_at_taten.com.au>
Date: Tue, 11 Jan 2000 11:33:36 +1100
Message-ID: <387A7A60.60DE5C29@taten.com.au>


Hi David,

    Since u are using Oracle 7.3.3, u cannot just put DDL (Data Definition Language) statements in a procedure.

Infact, only in Oracle 8.0 & later, is there a way of putting DDL statements in proecdure w/o much hassles.

Since create table,drop table etc are DDL commands, u need to use dynamic SQL for the same. The buuilt-in pl/sql package:DBMS_SQL has functions/procedures to acheive this.

    The way of doing this is pretty simple and should be documented in any good PL/SQL book.

Hope that helps.

Regards,
--Vishal

laulau823_at_my-deja.com wrote:

> Hello all,
>
> I create the following procedure:
>
> create or replace procedure testing as
> begin
> create table a as ...
> create view b as ...
> truncate table c;
> drop table c;
> end;
>
> However, there is something wrong in compilation.
>
> How can I place the above SQL statements in PL/SQL procedure such
> that when I execute this procedure, the above SQL statements will be
> executed?
>
> I am using Oracle 7.3.3.
>
> Thanks,
> David
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
Received on Mon Jan 10 2000 - 18:33:36 CST

Original text of this message

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