1
私はeclipseでコードを実行しましたが、私の目的はpostgresデータベースのストアドプロシージャを呼び出すことです。サーブレットから渡された値を試してみたところ、このエラーが発生しました: "オフセット1で関数またはプロシージャのエスケープ構文が不正です。"不正な関数またはプロシージャのエスケープ構文(オフセット1)
これで値をハードコーディングしました。それでも同じ問題。オフセットとは何ですか?エラーを解決するのを手伝ってください。 Ivは既にフィールドの順序とデータ型をチェックしています。正しいです。
public int dispCustomer3(Cust cc){
con=dbCon.getConnection();
//PreparedStatement ps3=null;
System.out.println("inside update function ");
CallableStatement callableStatement =null;
try {
callableStatement=con.prepareCall("{SELECT fn_UpdateCustomer(37, 'Test_Customer56','Test_Customer56','Requirement','Customer_Location',NULL,2,2,NULL,'Customer_Contact_Info','Account_Contact_Info','01-02-2016','01-04-2016',5,'Comments',1,2);}");
/*callableStatement.setInt(1,cc.getCustId());
callableStatement.setString(2,cc.getShortName());
callableStatement.setString(3,cc.getStatus_name());
callableStatement.setString(4,cc.getRequirement());
callableStatement.setString(5,cc.getCustomer_location());
callableStatement.setInt(6,cc.getDemo_location_type_id());
callableStatement.setInt(7, cc.getDeployment_type_id());
callableStatement.setInt(8, cc.getRequested_by_id());
callableStatement.setInt(9, cc.getPilot_resource_id());
callableStatement.setString(10, cc.getCustomer_contact_info());
callableStatement.setString(11, cc.getAccount_contact_info());
callableStatement.setDate(12, cc.getDemo_planned_on());
callableStatement.setDate(13, cc.getDemo_actual_on());
callableStatement.setInt(14, cc.getStatus_id());
callableStatement.setString(15, cc.getComments());*/
callableStatement.registerOutParameter(1, java.sql.Types.INTEGER);
callableStatement.executeUpdate();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally{dbCon.closeConnection(con);}
return 1;
}
}
私はその変更を行いました。しかし、今、私は次のようになっています。 "不正な関数またはプロシージャのエスケープ構文がオフセット203にあります。 – aswathy
これは、現在の問題を解決したことを意味し、Connection.prepareCall()引数の文字#203で新しいことが発生しました。 ';'を削除してみてください。引数の最後に、それがあなたの問題を解決するかどうかを確認します。毎回、報告されたオフセットをチェックすることによってコードをデバッグすることができます。 – Sevle
#203文字であれば、Notepad ++やSublime Text 2などのセミスマートエディタにコードをコピー&ペーストすることができます。 – Sevle