Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I have this trigger in DB2 that I need to convert to ORACLE, but I don't know how it works in DB2 so i can translate it to a ORACLE one, I think it doesn't do anything.

CREATE TRIGGER ERRLOG_TRIGGER
  NO CASCADE BEFORE INSERT
  ON ERROR_LOG
  REFERENCING 
    NEW AS NEWROW
  FOR EACH ROW
BEGIN ATOMIC 
     SET NEWROW."ERRLOG_CREATEDON" = CURRENT TIMESTAMP;
END;

I see that date update, but what is it for?

share|improve this question

closed as off-topic by Jack Douglas Jan 23 at 22:31

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Too localized - this could be because your code has a typo, basic error, or is not relevant to most of our audience. Consider revising your question so that it appeals to a broader audience. As it stands, the question is unlikely to help other users (regarding typo questions, see this meta question for background)." – Jack Douglas
If this question can be reworded to fit the rules in the help center, please edit the question.

1  
I figured out that ERROR_LOG is a table on my own schema not a systemtable of DB2. –  Logar314159 Jan 23 at 22:27

1 Answer 1

up vote 2 down vote accepted

The trigger does something, it sets the ERRLOG_CREATEDON column to the current time.

In Oracle this should roughly be:

create or replace trigger errlog_trigger
  before insert on error_log
  for each row
begin
  :new.errlog_createdon := current_timestamp;
end;
/
share|improve this answer
    
Thank you, I should managed it by my own, I didn't see the clauses in DB2. –  Logar314159 Jan 23 at 22:30

Not the answer you're looking for? Browse other questions tagged or ask your own question.