Oracle / Update查询管道表函数



我有一个可以正常工作的管道表函数。

我现在需要的是在此功能中执行更新查询:

create or replace FUNCTION test(A varchar2 )
 RETURN type_As PIPELINED  as row_type type_A;
Begin
....
update X set A=0 where B=1;
select type_A(...) 
  into   row_type 
  from   dual;
PIPE ROW(row_type);
  return ;
end;

当我运行此查询时:

从中选择 * 表(test('123'((

我得到此错误:

ORA-14551:无法在查询中执行DML操作

因此,很明显,A无法在此处添加更新查询,那么如何执行更新?

任何帮助都将不胜感激。

尝试添加

pragma autonomous_transaction;

到您的功能并使用动态SQL进行更新。

最新更新