| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.tools -> Re: insert record of type date
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.
![]() |
![]() |