select salution||' '||firstname||' '||lastname as custName , city as custCity ,state as custState,zip as custZip, dob as custDob ,idhardtoken as custAdarNo from mstuser ;
对于上述查询,我在从 java 类文件执行查询时收到 Oracle 错误 ORA-00911: 无效字符错误。对此有何修正?
最佳答案
SQL 语句不包含尾随分号。它在 SQL*Plus 和其他客户端中用作语句分隔符(尽管即使在那里您也可以将其更改为不同的字符),并且它不是语句本身的一部分。 (PL/SQL 需要分号作为分隔符,但这不是主题)。
当您通过 JDBC 运行该语句时,不应包含分号。你应该只是运行
"select salution||' '||firstname||' '||lastname as custName, "
+ "city as custCity, state as custState, zip as custZip, "
+ "dob as custDob, idhardtoken as custAdarNo from mstuser"
(分割只是为了显示它而不需要横向滚动...)
关于java - ORA-00911 : invalid character error while executing a query,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36198696/