Q:

Getting compilation error in creating trigger in pl/sql

The following code consists of my project on sql. I'm having hard time finding trigger compilation error repeatedly.
 Warning: Trigger created with compilation errors.

I'm using oracle SQL.If this code segments is not enough then you can find the whole project in the following link:
https://github.com/Shauqi/PhotoGalleryDatabase.
 create table user1
    (
    user_id number(10) not null,
    name varchar(20),
    password number(12)
    );
 create table myaudit
    (
    new_name varchar2(30),
    old_name varchar2(30),
    user_name varchar2(30),
    entry_date varchar2(30),
    operation varchar2(30)
    );
set serveroutput on
CREATE OR REPLACE TRIGGER user1audit
BEFORE INSERT OR DELETE OR UPDATE ON user1
FOR EACH ROW
DECLARE  
 v_user  varchar2 (30);  v_date  varchar2(30);
BEGIN 
   SELECT user, TO_CHAR(sysdate, 'DD/MON/YYYY HH24:MI:SS') INTO v_user,  v_date    FROM dual;
  IF INSERTING THEN
  INSERT INTO myaudit (new_name,old_name, user_name, entry_date, operation) VALUES(:NEW.NAME, Null , v_user, v_date, 'Insert');
  ELSIF DELETING THEN
  INSERT INTO myaudit (new_name,old_name, user_name, entry_date, operation) VALUES(NULL,:OLD.NAME, v_user, v_date, 'Delete');
  ELSIF UPDATING THEN
  INSERT INTO myaudit (new_name,old_name, user_name, entry_date, operation) VALUES(:NEW.NAME, :OLD.NAME, v_user, v_date,'Update');
  END IF;
END;
 /

A:

Try this:
CREATE OR REPLACE TRIGGER user1audit
BEFORE INSERT OR DELETE OR UPDATE ON user1
FOR EACH ROW  

BEGIN 

  IF INSERTING THEN
  INSERT INTO myaudit (new_name,old_name, user_name, entry_date, operation) VALUES(:NEW.NAME, Null , user, TO_CHAR(sysdate, 'DD/MON/YYYY HH24:MI:SS'), 'Insert');
  ELSIF DELETING THEN
  INSERT INTO myaudit (new_name,old_name, user_name, entry_date, operation) VALUES(NULL,:OLD.NAME, user, TO_CHAR(sysdate, 'DD/MON/YYYY HH24:MI:SS') , 'Delete');
  ELSIF UPDATING THEN
  INSERT INTO myaudit (new_name,old_name, user_name, entry_date, operation) VALUES(:NEW.NAME, :OLD.NAME, user, TO_CHAR(sysdate, 'DD/MON/YYYY HH24:MI:SS'),'Update');
  END IF;
END;
 /

