java.sql.sqlexception “无效字符” 之select to_char(..........),to_date(......)等库函数的使用;
2011-08-23 21:10
525 查看
在java中如果用oracle的库函数时要注意,例如,查询时间后要格式化输出,,那么这时候j就会出现异常,因为这时候执行sql时直接把to_date(time,‘yyyy-mm-dd h24’)当做了数据库中的字段。所要不能单单这样写,要用别名。准确语句应该是:select to_date(time,‘yyyy-mm-dd h24’) time from someTable,也就是随便取一个别名。
相关文章推荐
- MyBatis java.sql.SQLSyntaxErrorException: ORA-00911: 无效字符
- 40.Oracle数据库SQL开发之 日期和时间的存储与处理——使用TO_CHAR和TO_DATE
- java.sql.SQLSyntaxErrorException: ORA-00911: 无效字符
- 令人无语的分号引发的“java.sql.SQLSyntaxErrorException: ORA-00911: 无效字符”错误
- ODI-1228: Caused By: java.sql.SQLSyntaxErrorException: ORA-00911: 无效字符
- java.sql.SQLSyntaxErrorException: ORA-00911: 无效字符 ``` *### SQL: SELECT COUNT(ID) AS VALU
- Spring 整合 Flex (BlazeDS)无法从as对象 到 Java对象转换的异常:org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'java.util.Date' to required type 'java.sql.Timestamp' for property 'wfsj'; nested exception is java.lang.Ill
- 异常 -- Cause: java.sql.SQLSyntaxErrorException: ORA-00911: 无效字符
- java.sql.SQLException: ORA-00911: 无效字符
- 解决bad SQL grammar []; nested exception is java.sql.SQLSyntaxErrorException: ORA-00911: 无效字符
- Cause: java.sql.SQLSyntaxErrorException: ORA-00911: 无效字符
- mybatis报了一个java.sql.SQLSyntaxErrorException: ORA-00911: 无效字符
- sql: 去除数据库表中tab、空格、回车符等特殊字符的解决方法 去除tab、空格、回车符等使用replace语句 按照ASCII码, SELECT char(64) 例如64 对应 @,则se
- java.sql.SQLSyntaxErrorException: ORA-00911: 无效字符 分号问题
- weblogic11_64下的java.lang.ClassCastException: java.sql.Timestamp cannot be cast to java.sql.Date
- 异常 -- Cause: java.sql.SQLSyntaxErrorException: ORA-00911: 无效字符
- java.sql.SQLSyntaxErrorException: ORA-00911: 无效字符 分号问题
- JAVA 抛出java.sql.SQLSyntaxErrorException: ORA-00911: 无效字符 异常
- java.sql.SQLException: ORA-00911: 无效字符
- java.sql.SQLSyntaxErrorException: ORA-00911: 无效字符