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!