I am trying to create a trigger for my table. I have typed in the code as follows:
CREATE OR REPLACE TRIGGER INSERTCUSTOMER BEFORE Insert ON BIGDAVE FOR EACH ROW BEGIN INSERT INTO BIGDAVES_PAL VALUES(:new.SSN, :new.F_Name, :new.L_Name); END INSERTCUSTOMER;Whenever I hit enter, SQL Plus simply goes to the next line, as if it is expecting something else, and it will not execute the command. Do you think you know what I am doing wrong?
All you need to do is add a / (forward slash) as the last line of your script file, and that will run it. The ending semi-colon simply ends the trigger code, but it does not tell SQL Plus to run the code. The / will run the code in the buffer.
For More Information
- What do you think about this answer? E-mail the editors at [email protected] with your feedback.
- The Best Oracle Web Links: tips, tutorials, scripts, and more.
- Have an Oracle or SQL tip to offer your fellow DBAs and developers? The best tips submitted will receive a cool prize. Submit your tip today!
- Ask your technical Oracle and SQL questions -- or help out your peers by answering them -- in our live discussion forums.
- Ask the Experts yourself: Our SQL, database design, Oracle, SQL Server, DB2, metadata, object-oriented and data warehousing gurus are waiting to answer your toughest questions.