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 -> Trigger Problems with to_date()

Trigger Problems with to_date()

From: clanos <clandos_at_yahoo.com>
Date: Mon, 12 Jan 2004 17:38:30 +0100
Message-ID: <4002cd87$0$261$4d4ebb8e@read.news.de.uu.net>


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. Received on Mon Jan 12 2004 - 10:38:30 CST

Original text of this message

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