excii
asked on
Inserting date to oracle db with php ***URGENT, HELP ME****
Hi!
I have oracle8 db. When I select and print the date to html page date's format is 2002-05-24 00:00:00
Now I am trying to insert date to oracle db with INSERT INTO. Which format I should insert that date?
I have tried these SQL commands:
<?php
$connect = odbc_connect("db_name", "user", "pass") or die ("Can't connect");
$query = "INSERT INTO TABLE (DATE) VALUES ('09.06.2003')";
$result = odbc_exec($connect, $query);
odbc_close($connect);
?>
And I have tried these also:
$query = "INSERT INTO TABLE (DIARY_DATE) VALUES ('2002-06-09 00:00:00')";
$query = "INSERT INTO TABLE (DIARY_DATE) VALUES ('09.06.2003')";
I always get these errors:
SQL error: [Oracle][ODBC][Ora]ORA-018 61: literal does not match format string
SQL error: [Oracle][ODBC][Ora]ORA-018 43: not a valid month
Regards,
Exc
I have oracle8 db. When I select and print the date to html page date's format is 2002-05-24 00:00:00
Now I am trying to insert date to oracle db with INSERT INTO. Which format I should insert that date?
I have tried these SQL commands:
<?php
$connect = odbc_connect("db_name", "user", "pass") or die ("Can't connect");
$query = "INSERT INTO TABLE (DATE) VALUES ('09.06.2003')";
$result = odbc_exec($connect, $query);
odbc_close($connect);
?>
And I have tried these also:
$query = "INSERT INTO TABLE (DIARY_DATE) VALUES ('2002-06-09 00:00:00')";
$query = "INSERT INTO TABLE (DIARY_DATE) VALUES ('09.06.2003')";
I always get these errors:
SQL error: [Oracle][ODBC][Ora]ORA-018
SQL error: [Oracle][ODBC][Ora]ORA-018
Regards,
Exc
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
hmm... How can I see databases field types?
Could I do it with some SQL sentence with php or something?
Could I do it with some SQL sentence with php or something?
ASKER
I think I should use someting like TODATE function or am I wrong?
Something like this:
$query = "INSERT INTO DIARY (DIARY_TYPE,DIARY_DATE) VALUES (1,todate('09.06.2003', 'dd.mm.yyyy'))";
But that won't work because I don't know how to use ToDate function right....
help?
Something like this:
$query = "INSERT INTO DIARY (DIARY_TYPE,DIARY_DATE) VALUES (1,todate('09.06.2003', 'dd.mm.yyyy'))";
But that won't work because I don't know how to use ToDate function right....
help?
hmm 06/09..
it seems i lost this thread :-) sometimes a "still there?" helps
do you still need help with it?
ASKER