Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Get the sql query in oracle trigger
eric.h.lin_at_gmail.com schreef:
> Hi,
>
> I am wondering if there is a way that you can get the SQL query string
> that triggers the Oracle Trigger.
>
> what I want to do is to write a INSERT/UPDATE trigger for all the
> tables, and in the trigger i will call a java function that will do
> some validation on the table name, columns and its data of course.
>
> Or is there a better way to achieve this?
>
Yes - as indicated, start reading the documentation!
Some facts:
if your SQL code comes to a point the trigger on the table fires, that
means the table name is correct - no sense in checking that.
if your SQL code uses wrong column names, your trigger won't fire; if
it does fire, your columns are OK - no sense in checking that.
Let your SQL code handle the data validation, or better yet: let the
database do it. Referential contraints in Oracle have been around since
V6, and are working since 7.0.
Need I say more? Time to start treating Oracle as a database, or rewrite your app to do it's own data storage. Received on Thu Mar 30 2006 - 03:15:54 CST