Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Pro*C and trigger
Matthias Rogel wrote:
> damorgan wrote:
> > lomba wrote:
> >
> >
> >>"damorgan" <damorgan_at_exesolutions.com> a écrit dans le message de news:
> >>3DF4CE4B.CDB2956D_at_exesolutions.com...
> >>
> >>
> >>>Have you carefully thought out what you are doing and the implications
> >>>thereof?
> >>
> >>Absolutely not :(
> >>
> >>The problem is that I have an application to start which has to initialize
> >>my database, supposing I never accessed to this db before. You see an other
> >>solution to "insert" this trigger ?
> >>
> >>--
> >>lomba
> >
> >
> > Triggers are not something that should be built on-the-fly. The solution is to
> > build the trigger in the database as part of a set-up routine.
> >
> > What you are doing is a recipe for disaster unless the C program to which you
> > alude is a set-up program.
> >
> > Dan Morgan
> >
>
> Dan:
> great remark
> but, as far as I understand lomba, the program he wants to write is also
> a set-up program
> Do U have a hint for him in this case ? No :-(
>
> lomba:
> you could try with the Pro*C construct EXECUTE IMMEDIATE
> (note there is also an execute immediate construct in PL/SQL, but I
> don't speak of this now)
>
> the Syntax is something like
> EXEC SQL EXECUTE IMMEDIATE :statement ;
> where statement is a character string host variable.
> (take a look at your Pro*C programmers guide)
>
> Does this work ?
>
> Good luck,
>
> Matthias
The only ways to perform DDL on the fly are native dynamic SQL and the DBMS_SQL package.
I'd choose the one easiest to implement across multiple versions and editions. Meaning that if you are building something to use on version 7.x or 8.0 you might want to stay away from NDS and use the built-in package.
Dan Morgan Received on Tue Dec 10 2002 - 17:41:47 CST
![]() |
![]() |