我在Oracle中建立了一个函数,如下:
create or replace package spk_Query is
type query_cursor is ref cursor;
function sfn_Manage
(
v_A INT,
v_B INT
)
return query_cursor;
end spk_Query;
函数返回一个游标数据集,请问在Delphi中如何调用它啊?
我在PLSQL Developer中用SELECT spk_Query.sfn_Manage(124265,0) as result FROM DUAL;调用是可以的
放在Delphi里,用TADOQuery直接在TADOQuery.SQL.Text中写上面的句子,Open的时候返回如下错误:
---------------------------
Debugger Exception Notification
---------------------------
Project Project1.exe raised exception class EAccessViolation with message 'Access violation
at address 61070C35 in module 'MSDATL3.dll'. Read of address 00000000'. Process stopped.
Use Step or Run to continue.
---------------------------
OK Help
---------------------------
改用TADOStoredProc:
ADOPorc.Close;
ADOPorc.ProcedureName := 'spk_Query.sfn_Manage';
ADOPorc.Parameters.Refresh;
ADOPorc.Parameters.ParamByName('v_A').Value := 124265;
ADOPorc.Parameters.ParamByName('v_B').Value := 0;
ADOPorc.ExecProc;
又说参数不对:
---------------------------
Debugger Exception Notification
---------------------------
Project Project1.exe raised exception class EOleException with message 'ORA-06550: 第 1 行, 第 7 列:
PLS-00306: 调用 'SFN_QUERY_NETMANAGE' 时参数个数或类型错误
ORA-06550: 第 1 行, 第 7 列:
PL/SQL: Statement ignored'. Process stopped. Use Step or Run to continue.
---------------------------
OK Help
---------------------------
请问到底该怎么调用?