Alex Rivera | Logout

What is the syntax to use a Select statement inside a PL/SQL Trigger?

Asked 2008-10-14T20:12:05.057
10

This is what I currently have:

CREATE OR REPLACE TRIGGER MYTRIGGER
AFTER INSERT ON SOMETABLE
FOR EACH ROW    

DECLARE
 v_emplid varchar2(10);    

BEGIN
 SELECT
  personnum into v_emplid
 FROM PERSON
 WHERE PERSONID = :new.EMPLOYEEID;

dbms_output.put(v_emplid);

/* INSERT INTO SOMEOTHERTABLE USING v_emplid and some of the other values from the trigger table*/

END MYTRIGGER;    

DBA_ERRORS has this error: PL/SQL: ORA-00923: FROM keyword not found where expected

Edit
Report

1 Answer

-3

I would not use a select statment in a trigger ever. Insert into the table rather than a select into. Once the table already exists select into does not work in most databases.

answered 2008-10-14T20:15:15.813

Your Answer