Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Date/Time Trigger Problem
Hi Dave,
the following should work
CREATE OR REPLACE TRIGGER TR_YOUR_TABLE_BIU
BEFORE INSERT OR UPDATE ON YOUR_TABLE
FOR EACH ROW
DECLARE
v_datestr varchar2(20) :=to_char(:new.date,'ddmmyyyy')||:new.time;
BEGIN
:new.fulldatetime:=to_date(v_datestr,'ddmmyyyyhh24mi');
END ;
Hope that helps,
bye
Uli
<dcody_at_my-deja.com> schrieb in im Newsbeitrag:
80nqjq$599$1_at_nnrp1.deja.com...
> I have inherited a database in which there is a date field and a
> separate time field. This cannot be changed.
>
> What I want to do is create a trigger which will combine the values
> from these two fields (DATE) and (TIME) into a single new field named
> FULLDATETIME.
>
> For the life of me I cannot figure out the syntax to create the trigger.
>
> Functionally, we want to wind up wirh
>
> FULLDATETIME = DATE + TIME
>
> BTW DATE is a DATE field, but only the date portion is significant.
> TIME is a VARCHAR2(4), and is stored as military (24hr) time ('0435',
> '1543', etc.
>
> Can anyone help?
> Dave
>
>
>
>
> (http://mondrian.sba.com/forums/Index.cfm?CFApp=21&Message
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
Received on Mon Nov 15 1999 - 01:15:44 CST
![]() |
![]() |