Oracle weirdness redux
Okay, this is basically just a difference between SQL Server and Oracle. It isn't really weird but you should be aware of it:
Cast ('xxx' AS datetime) doesn't work because datatime is not an Oracle type. The correct way to do this in Oracle is by using the TO_DATE function like this:
TODATE('xxx')
In my app, I use a data access layer to compensate for Oracle's differences. The first string can easily be converted to the second by using the Regex.Replace method:
sql = Regex.Replace(sql,@"cast\((.+) as datetime\)",
"TO_DATE($1)",
RegexOptions.IgnoreCase);
Cast ('xxx' AS datetime) doesn't work because datatime is not an Oracle type. The correct way to do this in Oracle is by using the TO_DATE function like this:
TODATE('xxx')
In my app, I use a data access layer to compensate for Oracle's differences. The first string can easily be converted to the second by using the Regex.Replace method:
sql = Regex.Replace(sql,@"cast\((.+) as datetime\)",
"TO_DATE($1)",
RegexOptions.IgnoreCase);
0 Comments:
Post a Comment
<< Home