我试图通过数据库链接调用存储过程.代码看起来像这样:
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:语句句柄未执行.
declare symbol_cursor package_name.record_cursor@db_link_name; symbol_record package_name.record_name@db_link_name; begin symbol_cursor := package_name.function_name@db_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;