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

Home -> Community -> Usenet -> c.d.o.tools -> Re: insert record of type date

Re: insert record of type date

From: <xmark.powell_at_eds.com.x>
Date: 27 Apr 2001 12:23:19 GMT
Message-ID: <9cbobn$j0a$1@news.netmar.com>

In article <jlDF6.23343$ii.2544010_at_afrodite.telenet-ops.be>, Gerry Stijlemans <gerry.stijlemans_at_pandora.be> writes:
>
>
>This is the Testdate.php
><HTML><HEAD></HEAD><BODY>
>insert into coxyyyzzzaaaa.test (dateoffbirth) values ('<?php echo
>$Day;?>-<?php echo $Month;?>-<?php echo $Year;?>')
><?php $conn = OCILogon("coxyyyzzzaaaa", "admin" , "companyx");
>$stmt = OCIParse($conn,"insert into coxyyyzzzaaaa.test (dateoffbirth) values
>('<?php echo $Day;?>-<?php echo $Month;?>-<?php echo $Year;?>')");
>OCIExecute($stmt);OCICommit($conn);OCIFreeStatement($stmt);OCILogoff($conn);
>?>
></BODY></HTML>
>
>OUTPUT I RECIEVED :
>insert into coxyyyzzzaaaa.test (dateoffbirth) values ('1-jan-1900')
>Warning: OCIStmtExecute: ORA-01858: a non-numeric character was found where
>a numeric was expected in c:\program
>files\apache group\apache\htdocs\examples\project\testdate.php on line 9
>
>However the insert generated as above is working is sqlplus, I 'm recieving
>the
>above error. If I 'm reading this message as wel , I think the system is
>handling the $Day ,$Month and $Year as text and not as number.
>How can I correct this whole thing ?????
>
>THX
>
>Gerry
>

By now you have hopefully figured out your problem but the if not your problem is probably that the default date format expected by Oracle is 'dd-mon-yy' and if you provide it anything else you need to use the to_date function with a format mask: to_date('01-jan-1900','dd-mon-yyyy').

If possible please post in plan text as the html makes the post hard to read. I have removed most of it in this reply.

Received on Fri Apr 27 2001 - 07:23:19 CDT

Original text of this message

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