import java.sql.*;public class TestProc { public static void main(String[] args) {
Connection conn = null;
CallableStatement cstmt = null;

try{
Class.forName("oracle.jdbc.driver.OracleDriver");
conn = DriverManager.getConnection("jdbc:oracle:thin:@192.168.1.102:1521:orcl","scott","tiger");
cstmt = conn.prepareCall("call p {?,?,?,?};");
cstmt.registerOutParameter(3, Types.INTEGER);
cstmt.registerOutParameter(4, Types.INTEGER);
cstmt.setInt(1, 3);
cstmt.setInt(2, 4);
cstmt.setInt(4, 5);
cstmt.execute();

System.out.println(cstmt.getInt(3));
System.out.println(cstmt.getInt(4));
}catch (ClassNotFoundException e){
e.printStackTrace();
System.out.println("Class Not Found!");
}catch(SQLException e){
e.printStackTrace();
}finally{
try{
if(cstmt!= null){
cstmt.close();
cstmt = null;
}
if(conn!= null){
conn.close();
cstmt = null;
}
}catch(SQLException e){
e.printStackTrace();
}
}
}}myeclipse 报错     java.sql.SQLException: 出现格式不正确的 SQL92 串: 9. Expecting "=" got ","
 at TestProc.main(TestProc.java:18)

解决方案 »

  1.   

    cstmt = conn.prepareCall("call p {?,?,?,?};"); 
    cstmt.registerOutParameter(3, Types.INTEGER); 
    cstmt.registerOutParameter(4, Types.INTEGER); 
    cstmt.setInt(1, 3); 
    cstmt.setInt(2, 4); 
    cstmt.setInt(4, 5); 
    cstmt.execute(); 
    是不是多了这一句
    cstmt.setInt(4, 5); 
    楼主可不可以把你的存储过程贴上来
      

  2.   

    java.sql.SQLException: 出现格式不正确的 SQL92 串: 9. Expecting "=" got "," 
    at TestProc.main(TestProc.java:18)楼主就按照这个错误提示去改阿,呵呵
      

  3.   

    即使把cstmt.setInt(4, 5);注释掉仍然报同样的错
      

  4.   

    cstmt = conn.prepareCall("{ call p (?,?,?,?) }"); 好像是这么写吧
      

  5.   

    cstmt = conn.prepareCall("call p {?,?,?,?};"); 
    换成
    cstmt = conn.prepareCall("{ call p(?,?,?,?) }"); 
    试试看
      

  6.   

    java.sql.SQLException: ORA-06550: 第 1 行, 第 7 列: 
    PLS-00306: 调用 'P' 时参数个数或类型错误
    ORA-06550: 第 1 行, 第 7 列: 
    PL/SQL: Statement ignored改了以后出现的问题     还是因为这句话出错  cstmt.execute();