Home » Developer & Programmer » Forms » Trigger program to track user information (Oracle 10.2.0 , OEL5 )
Trigger program to track user information [message #588328] Tue, 25 June 2013 01:40 Go to next message
rsb.oracle
Messages: 37
Registered: April 2013
Location: Chennai
Member
Hello everyone ;

I have a trigger program to track updated information's on perks column.
i am failing to finish systime in my trigger program.

SQL> desc user_track;
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 EID                                                NUMBER
 ENAME                                              VARCHAR2(15)
 OLD_PERKS                                          NUMBER
 NEW_PERKS                                          NUMBER
 UNAME                                              VARCHAR2(15)
 ACTION_DATE                                        DATE
 ACTION_TIME                                        DATE

SQL> create or replace trigger tri_track
  2  After UPDATE ON EMP
  3  FOR EACH ROW
  4  BEGIN
  5  insert into user_track(EID,ENAME,OLD_PERKS,NEW_PERKS ,UNAME,ACTION_DATE,ACTION_TME) values
  6  (:old.eid, :old.ename , :old.perks, :new.perks,user, sysdate, to_char(sysdate , 'HH24:MI:SS')
  7  from dual;
  8  end;
  9  /

Warning: Trigger created with compilation errors.

SQL> show errors;
Errors for TRIGGER TRI_TRACK:

LINE/COL ERROR
-------- -----------------------------------------------------------------
2/1      PL/SQL: SQL Statement ignored
3/95     PL/SQL: ORA-00917: missing comma


Re: Trigger program to track user information [message #588329 is a reply to message #588328] Tue, 25 June 2013 01:43 Go to previous messageGo to next message
rsb.oracle
Messages: 37
Registered: April 2013
Location: Chennai
Member
This was my old program and it works fine , additionally i tried to add HH:MI:SS ,.. but getting error.


SQL> create or replace trigger tri_track
  2  After UPDATE ON EMP
  3  FOR EACH ROW
  4  BEGIN
  5  insert into user_track values(:old.eid, :old.ename , :old.perks, :new.perks,
  6  user, sysdate);
  7  end;
  8  /

Trigger created.

SQL> select * From user_track;

       EID ENAME            OLD_PERKS  NEW_PERKS UNAME           ACTION_DA
---------- --------------- ---------- ---------- --------------- ---------
         1 RED                    990        940 HR              25-JUN-13
         1 RED                    940        940 HR              25-JUN-13
Re: Trigger program to track user information [message #588332 is a reply to message #588329] Tue, 25 June 2013 01:56 Go to previous messageGo to next message
rsb.oracle
Messages: 37
Registered: April 2013
Location: Chennai
Member
I done it !

create or replace trigger tri_track
  2  After UPDATE ON EMP
  3  FOR EACH ROW
  4  BEGIN
  5   insert into user_track(EID,ENAME,OLD_PERKS,NEW_PERKS ,UNAME,ACTION_DATE,ACTION_TIME)
  6  values
  7  (:old.eid, :old.ename , :old.perks, :new.perks,user, sysdate, to_char(sysdate, 'HH24:MI:SS'));
  8  end;
  9  /

Trigger created.


Re: Trigger program to track user information [message #588340 is a reply to message #588332] Tue, 25 June 2013 03:51 Go to previous message
cookiemonster
Messages: 10573
Registered: September 2008
Location: Rainy Manchester
Senior Member
What's the point of the action_time column? action_date has the time.
Previous Topic: ORA-01841 error....
Next Topic: Creating Domain Failed while Configuring Oracle Forms Instance
Goto Forum:
  


Current Time: Sun Apr 20 03:35:22 CDT 2014

Total time taken to generate the page: 0.07663 seconds