Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Oracle Trigger
Rajesh Patel wrote:
> I had a sql file that just had Creates for
> tables/views. Then I tried to add a trigger.
>
> I was using a jdbc connection to send the sql
> file to the database. That worked great until
> I added the trigger. I kept getting errors from
> oracle.
>
> So I used to SQL Plus to run in the sql file,
> everything worked fine.
>
> So I have concluded that inorder to run in a trigger
> or any PL/SQL code I need to use SQL plus to
> send it to the database.
>
> Am I correct?
>
> Raj
Your conclusion is incorrect but your solution is correct.
DDL to create a trigger requires the use of dynamic SQL. Using the DBMS_SQL package, or native dynamic SQL, you can easily build tables, views, triggers, packages, etc.
On the practical side it is a terrible practice to ever build objects using a JDBC connection from what, I presume, is a front-end. Build objects in SQL*Plus ... they are not transactional ... they are permanent parts of the schema and should be treated as such.
-- Daniel Morgan http://www.outreach.washington.edu/ext/certificates/oad/oad_crs.asp http://www.outreach.washington.edu/ext/certificates/aoa/aoa_crs.asp damorgan_at_x.washington.edu (replace 'x' with a 'u' to reply)Received on Tue Feb 03 2004 - 12:42:37 CST