Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Basic Trigger Questions

715303Dec 10 2009 — edited Dec 10 2009
I am learning about triggers using http://cisnet.baruch.cuny.edu/holowczak/oracle/sqlplus/#storedproceduresandtriggers and other online resources. I need clarifications on few questions:

1. Once I write a trigger on the SQL PLUS Command Prompt and end with a /, where will the trigger be saved? Will it be permanent for all the sessions or that trigger will be available only for the current session?

2. Is there any other way to compile a trigger? I mean - "Typing line by line on the SQL PLUS Command Prompt and ending with /" Is that the only way to create and compile a trigger? Can't we write it on a .sql file and something to compile it? Well, I don't know hence just asking...

3. Say for example, I am creating a trigger with BEFORE INSERT ON table_name FOR EACH ROW. I have a code like
IF :new.col_name IS NULL THEN 
Now my question is, which record's value will be picked for new.col_name ? Is it the record which is about to be INSERTed? It's a BEFORE INSERT trigger. So, how will the new.col_name have the value as it is not yet inserted in the table.

Please advice!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 7 2010
Added on Dec 10 2009
2 comments
622 views