からOracle関数を呼び出す:エラー私は、Javaを使用してOracle関数を呼び出すしようとしています、と私は次のエラーを取得するJavaの
java.sql.SQLException: ORA-06550: line 1, column 13:
PLS-00306: wrong number or types of arguments in call to 'FUNCION'
ORA-06550: line 1, column 13:
PLS-00306: wrong number or types of arguments in call to 'FUNCION'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
これは私がその機能を呼び出すために使用しています方法です:
String ejecucion = "{ ?=call function(?,?,?,?,?,?,?,?,?) }";
CallableStatement cons = c.ejecutarProcedimiento(ejecucion, 0); // Here I invoke "prepareCall" method
double monto = 0;
cons.registerOutParameter(1, java.sql.Types.FLOAT);
// Parametro del procedimiento almacenado
cons.setFloat(2, 2);
cons.setDouble(3, importe);
cons.setDate(4,TareasGenerales.convertirFecha(Parametros.cabezal.getFechaVencimientoPresentacion()));
cons.setDate(5,TareasGenerales.convertirFecha(Parametros.cabezal.getFechaVencmientoPago()));
cons.setDate(6, TareasGenerales.convertirFecha(Parametros.fechaActual));
cons.setDate(7, TareasGenerales.convertirFecha(Parametros.fechaActual));
cons.setBoolean(8, false);
cons.setInt(9, Integer.valueOf(Parametros.cabezal.getAnioMesDesde()));
cons.setBoolean(10, false);
cons.executeQuery();
最後の行を実行すると、エラーが発生します。
何か間違っていますか?
ありがとうございます。
更新:
declare
-- Boolean parameters are translated from/to integers:
-- 0/1/null <--> false/true/null
pa_a boolean := sys.diutil.int_to_bool(:a);
pa_b boolean := sys.diutil.int_to_bool(:b);
begin
-- Call the function
:result := function(c=> :c,
d => :d,
e => :e,
f => :f,
g => :g,
h => :g,
i => i,
j => :j,
k => k);
end;
私は、Oracleの関数定義を追加しました。
アップロード2.0:
FUNCTION Prueba(tipo_calc IN NUMBER,
impte IN NUMBER,
f_venc IN DATE,
f_venc_p DATE,
f_pre IN DATE,
f_pa IN DATE,
pa_tiene IN BOOLEAN,
pa_anio IN NUMBER,
pa_buen IN BOOLEAN) RETURN NUMBER;
'function'の定義も提供する必要があります。 –
引数#5はどうなりましたか? Iは有効1、2、3、4、6、7、8、9、10、ない5 – duffymo
有効\t結果\tフロート\t \tフロート\t 有効\t Bフロート\t が\t C日\t を可能に参照します 有効\t fは\t 有効\t H整数\t iはフロート\tを有効日\t 有効\tグラム日\t \t D日付を有効 有効\t j整数 –