4
我想通過數據庫鏈接調用存儲過程。該代碼看起來是這樣的:通過dblink調用存儲過程
declare
symbol_cursor package_name.record_cursor;
symbol_record package_name.record_name;
begin
symbol_cursor := package_name.function_name('argument');
loop
fetch symbol_cursor into symbol_record;
exit when symbol_cursor%notfound;
-- Do something with each record here, e.g.:
dbms_output.put_line(symbol_record.field_a);
end loop;
CLOSE symbol_cursor;
當我運行這個來自同一個數據庫實例和模式其中package_name屬於我能夠運行正常的。但是,當我通過數據庫鏈接運行(對所存儲的proc名稱進行必要的修改等)時,我得到一個oracle錯誤:ORA-24338:語句句柄未執行。
這個代碼在DBLINK的修改後的版本是這樣的:
declare
symbol_cursor [email protected]_link_name;
symbol_record [email protected]_link_name;
begin
symbol_cursor := [email protected]_link_name('argument');
loop
fetch symbol_cursor into symbol_record;
exit when symbol_cursor%notfound;
-- Do something with each record here, e.g.:
dbms_output.put_line(symbol_record.field_a);
end loop;
CLOSE symbol_cursor;
Duplicate http://stackoverflow.com/questions/1119306/execute-immediate-over-databse-link – skaffman 2009-07-13 21:29:54
我不同意這是一個重複的問題,這是關於執行*動態*代碼一個dblink。 – 2009-07-13 22:04:38