在JAVA程序中调用一个存储过程报错!
packagecom.sp;importjava.sql.CallableStatement;importjava.sql.Connection;importjava.s...
package com.sp;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.DriverManager;
public class Test1 {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@127.0.0.1:1521:ORCL","system","zhanghua");
CallableStatement cs = conn.prepareCall("{call pro_sp7(?,?,?}");
cs.setInt(1, 10);
cs.setString(2, "笑傲江湖");
cs.setString(3, "人民出版社");
cs.execute();
}catch(Exception e) {
e.printStackTrace();
}finally {
//关闭各种资源就不写了!
}
}
}
报错:
java.sql.SQLException: ORA-06550: 第 1 行, 第 26 列:
PLS-00103: 出现符号 ";"在需要下列之一时:
. ( ) , * @ % & = - + < / >
at in is mod remainder not rem => <an exponent (**)>
<> or != or ~= >= <= <> and or like like2 like4 likec between
|| indicator multiset member submultiset
符号 ")" 被替换为 ";" 后继续。
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:445)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:396)
at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:879)
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:450)
at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:192)
at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:531)
at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:204)
at oracle.jdbc.driver.T4CCallableStatement.executeForRows(T4CCallableStatement.java:1041)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1329)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3584)
at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3685)
at oracle.jdbc.driver.OracleCallableStatement.execute(OracleCallableStatement.java:4714)
at oracle.jdbc.driver.OraclePreparedStatementWrapper.execute(OraclePreparedStatementWrapper.java:1376)
at com.sp.Test1.main(Test1.java:21) 展开
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.DriverManager;
public class Test1 {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@127.0.0.1:1521:ORCL","system","zhanghua");
CallableStatement cs = conn.prepareCall("{call pro_sp7(?,?,?}");
cs.setInt(1, 10);
cs.setString(2, "笑傲江湖");
cs.setString(3, "人民出版社");
cs.execute();
}catch(Exception e) {
e.printStackTrace();
}finally {
//关闭各种资源就不写了!
}
}
}
报错:
java.sql.SQLException: ORA-06550: 第 1 行, 第 26 列:
PLS-00103: 出现符号 ";"在需要下列之一时:
. ( ) , * @ % & = - + < / >
at in is mod remainder not rem => <an exponent (**)>
<> or != or ~= >= <= <> and or like like2 like4 likec between
|| indicator multiset member submultiset
符号 ")" 被替换为 ";" 后继续。
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:445)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:396)
at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:879)
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:450)
at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:192)
at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:531)
at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:204)
at oracle.jdbc.driver.T4CCallableStatement.executeForRows(T4CCallableStatement.java:1041)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1329)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3584)
at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3685)
at oracle.jdbc.driver.OracleCallableStatement.execute(OracleCallableStatement.java:4714)
at oracle.jdbc.driver.OraclePreparedStatementWrapper.execute(OraclePreparedStatementWrapper.java:1376)
at com.sp.Test1.main(Test1.java:21) 展开
3个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询