Simulate to_date
Hi,
I have a "little" problem when testing and creating a function (V 5.00a)
I have this code in the file TO_DATE.sql
-- code begin --
create function to_date(s varchar(23),dummy varchar(32)) returns datetime
begin
declare v varchar(19);
if (length(s)>19) then
set v = substr(s,1,19);
end if;
return str_to_date(v,'%Y-%m-%d %H:%i:%s');
end;
//
-- code end --
What I did in mysql.exe :
mysql>delimiter //
mysql> source to_date.sql//
Query OK, 0 rows affected (0.00 sec)
mysql> select to_date('2003-10-12 12:12:12')//
ERROR 1064 (42000): You have an error in your SQL syntax. Check the manual that
corresponds to your MySQL server version for the right syntax to use near 'retu
rns
begin
declare v varchar(19);
if (length(s)>19) then
set v = substr(s' at line 1
mysql> show create function to_date//
ERROR 2013 (HY000): Lost connection to MySQL server during query
mysql> show create function to_date//
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id: 26
Current database: x101
ERROR 1064 (42000): You have an error in your SQL syntax. Check the manual that
corresponds to your MySQL server version for the right syntax to use near 'retu
rns
begin
declare v varchar(19);
if (length(s)>19) then
set v = substr(s' at line 1
mysql>
What is wrong ?
For me the function has been well compiled.
Can anyone help me ?
Thanks a lot.
Best regards.
Subject
Views
Written By
Posted
Simulate to_date
13812
November 05, 2004 10:31AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.