Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Trigger Problems with to_date()

Re: Trigger Problems with to_date()

From: Daniel Morgan <damorgan_at_x.washington.edu>
Date: Mon, 12 Jan 2004 18:12:41 -0800
Message-ID: <1073959884.628401@yasure>


clanos wrote:

> Hi there,
> I'm using php/pear to connect to several databases. One is oracle. When I'm
> adding a german formated date string to a date field in oracle usually the
> rdbms returns an error
>
> insert into table (datefield) values ('1.1.2004 10:10:10')
>
> what I hav to do is using to_date.
>
> insert into table (datefield) values (to_date('1.1.2004 10:10:10'))
>
> Since I using php-pear I dont want to add extra code to the web site, I
> started to write an oracle trigger to convert my date string into a oracle
> readable format.
>
> unfortunately my trigger:
> ----
> CREATE OR REPLACE TRIGGER DATECONVERT
> BEFORE
> INSERT
> ON SERVERAUSFALL
> REFERENCING OLD AS OLD NEW AS NEW
> FOR EACH ROW
> begin
> :new.von := to_date(:new.von,'dd/mm/yyyy hh24:mi:ss');
> :new.bis := to_date(:new.bis,'dd/mm/yyyy hh24:mi:ss');
>
> //:new.von = '24.10.2004'
> //:new.bis = '24.10.2004'
> end;
> ----
>
> doesn't work.
> I still get the same error message
> "[1]: (Error): ORA-01830: date format picture ends before converting entire
> input string"
>
> What am I doing wrong?
>
>
> P.

Your map "dd/mm/yyyy" contains slashes ... your data does not ... it contains periods.

-- 
Daniel Morgan
http://www.outreach.washington.edu/ext/certificates/oad/oad_crs.asp
http://www.outreach.washington.edu/ext/certificates/aoa/aoa_crs.asp
damorgan_at_x.washington.edu
(replace 'x' with a 'u' to reply)
Received on Mon Jan 12 2004 - 20:12:41 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US