30 pts.
 Oracle-developers
WHILE ASSIGNING A VALUE TO PROCESSED_TIME=:NEW.JMS_TIMESTAMP-:NEW.INS_TIME (All are timestamp type ) how to subtract that one.

 CREATE OR REPLACE TRIGGER SAUUSER.TRG_MSGES_STATISTICS AFTER UPDATE OR UPDATE ON SAUUSER.TSAU_PRE_MSGES REFERENCING NEW AS NEW OLD AS OLD FOR EACH ROW DECLARE BEGIN IF INSERTING THEN INSERT INTO TSAU_MSGES_STATISTICS(PORTCODE,MSG_ID,DOCTYPE,MSGTYPE,SUBMISSION_TIME) VALUES(:NEW.PORTCODE, :NEW.MSG_ID, :NEW.DOCTYPE, :NEW.MSGTYPE, :NEW.INS_TIME ); END IF; IF UPDATING THEN UPDATE TSAU_MSGES_STATISTICS SET MSG_STATUS =:NEW.PROC_STATUS, RESPONSE_TIME =:NEW.JMS_TIMESTAMP, PROCESSED_TIME = :NEW.JMS_TIMESTAMP - :NEW.INS_TIME WHERE MSG_ID =:NEW.MSG_ID; END IF; EXCEPTION WHEN OTHERS THEN dbms_output.put_line( 'error in execute on TSAU_PRE_MSGES' ); END;



Software/Hardware used:
toad 9.5
ASKED: July 6, 2010  11:50 AM
UPDATED: July 7, 2010  1:33 PM

Answer Wiki:
When you subtract two TIMESTAMP columns you get a time difference, not a date, and the resulting data type is INTERVAL DAY(x) TO SECOND(y). You could add this result to another TIMESTAMP to get a TIMESTAMP result, but I'm not sure why you would want to do that. You might want to provide some example data showing the two timestamps you would subtract and the resulting timestamp you would want to get, to clarify your requirement.
Last Wiki Answer Submitted:  July 6, 2010  2:31 pm  by  carlosdl   63,535 pts.
All Answer Wiki Contributors:  carlosdl   63,535 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

Rizwan, this is the same question you asked the other day. And you got the same answer.

Doing math on a TIMESTAMP does not yield a TIMESTAMP. It cannot. It does not. It should not. The difference between two dates is not a date, it is a number of days.

 5,205 pts.

 

processed_time column belongs to tsau_msges_statistics table, jms_timestamp and ins_time belongs to tsau_pre_msges, i need to subtract (jms_timestamp and ins_time ) and assign to processed_time in update trigger.
jms_timestamp is a response_time ,
ins_time is a submission_time after subtracting this vl get response time that is wht i need. so plse help me urgently

 30 pts.

 

We can see what columns belong to what tables in your code, and unfortunately you didn’t provide any additional details, nor did you provide example data.

As previously mentioned, the short answer is “you can’t”.

Arithmetic operations between timestamps columns don’t produce timestamp results.

Your response time column should be of some INTERVAL data type.

 63,535 pts.