Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> Re: DDL statements in a trigger?
In article <8t17l7$oka$1_at_nnrp1.deja.com>,
jonterje_at_link.no wrote:
> Hello all,
>
> My company uses a third party application development tool that only
> allows us to do simple selects, inserts, updates and deletes against
an
> Oracle 8.1.5 database. (I know this doesn't sound very impressive, but
> there are other very good reasons for using this tool.) From this
tool
> we need to create sequences "on-the-fly" for the applications we are
> developing. I have tried to come up with a solution to this, given the
> limitations we develop under. I had an idea that an insert into a
table
> could fire a trigger that creates the sequence we need, but Oracle
will
> not let me put DDL statements inside the trigger:
>
> CREATE TABLE Counters(
> sequenceName varchar2(30) not null);
>
> create or replace trigger Counters_trig
> before insert on Counters
> for each row
> begin
> create sequence :new.sequenceName;
> end;
>
> insert into counters values ('test_cnt');
>
> select test_cnt.nextval from dual;
>
> Obviously, this does not work. Does anyone know a workaround? Or is
> there an entierly different solution?
>
> --
> Jon-Terje Lilleby
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>
DDL can be processed by means of execute immediate in 8.1.5 and beyond
and dbms_sql in 8.0.6 and before.
All well documented.
Hth,
-- Sybrand Bakker, Oracle DBA All standard disclaimers apply ------------------------------------------------------------------------ Sent via Deja.com http://www.deja.com/ Before you buy.Received on Mon Oct 23 2000 - 06:42:43 CDT