Note that there are some explanatory texts on larger screens.

plurals
  1. POTrigger: Something wrong with the code
    primarykey
    data
    text
    <p>I have the following information with me:</p> <pre><code>The EMP table is as follows: EMPNO , ENAME, JOB, MGR, HIREDATE, SAL,COMM,DEPTNO Here is the DEPT table: DEPTNO, DNAME, LOC </code></pre> <p>Based on the following question:</p> <p><strong>create a table to log employee terminations. Include the empno, emp name, the date hired, the date terminated, and the name of the oracle user who terminated the employee.</strong></p> <p>I have created the following table in Oracle 11g, SQL Plus as follows:</p> <pre><code>CREATE TABLE employee_terminations_log( empno number(4), emp_name char(8), datehired date, dateterminated date, dbuser char(8) ); </code></pre> <p>Now, based on the following question :</p> <p><strong>Create a trigger on the emp table to insert relevant information into the employee termination log. The trigger must execute every time an employee is deleted.</strong></p> <p>I wrote the code for the trigger as follows:</p> <pre><code>create or replace trigger emp_termination_trigger after delete of empno on emp for each row begin insert into employee_termination-log values(:old.empno,:old.emp_name,:old.hiredate,sysdate,user); end; </code></pre> <p>But I'm getting the following error:</p> <pre><code>8 / after delete of empno on emp * ERROR at line 2: ORA-04073: column list not valid for this trigger type </code></pre> <p>Could anyone please tell me what's wrong in the above code for trigger? Basically I have to deleter the whole employee row and for that I have used the following statement in the above code. </p> <p>after delete of empno on emp</p> <p>Please let me know what's wrong.</p> <p>Thanks</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload