将数据类型varchar转换为数字

时间:2013-12-04 05:41:56

标签: java mysql sql

Statement stmt1 = null; 
ResultSet srs1 = null; 
List3 = new ArrayList<String>(); 
stmt1 = conn.createStatement(); 
srs1 = stmt1 .executeQuery("SELECT [FILE_ACL].[FILE_SYSTEM_ID],
                      [USER_LITE].[USERS].[SYS_ID] FROM [FILE_ACL],
                      [USER_LITE].[USERS] WHERE [FILE_ACL].[PEOPLE_SYSTEM_ID]
                     = 'u' AND [USER_LITE].[USERS].[SYS_ID] 
                     = [FILE_ACL].[PEOPLE_SYSTEM_ID]"); 

while (srs1.next()) { 
    List3.add(srs1.getString("FILE_SYSTEM_ID"));
} 
System.out.println(List3);

我从

获得了你
for (int u = 2; u < List1.size(); u++) {
  System.out.println(List1.get(u)); 
 } 

它给我一个int

=============================================== =========================

但我遇到此错误错误将数据类型varchar转换为数字。

有什么解决方法吗?

谢谢!

1 个答案:

答案 0 :(得分:0)

 Implicit conversion from datatype 
'VARCHAR' to 'NUMERIC' is not allowed. Use the CONVERT function to run
 this query.