create or replace function report(IN rows_count numeric DEFAULT 1000,
OUT out_rc_type rc_type)
RETURNS rc_type
AS
DECLARE
BEGIN
PERFORM ddl_exec_pkg.ddl_execute ( 'ALTER TABLE REPORT_UI DROP CONSTRAINT REPORT_ID');
PERFORM ddl_exec_pkg.ddl_execute ( 'ALTER TABLE REPORT_ALL_UI DROP CONSTRAINT REPORT_ID');
INSERT INTO
REPORT_UI (SELECT * FROM GE_REPORT);
PERFORM ddl_exec_pkg.ddl_execute ('ALTER TABLE REPORT_UI ADD CONSTRAINT REPORT_ID CHECK (1 = 1)');
PERFORM ddl_exec_pkg.ddl_execute ('ALTER TABLE REPORT_ALL_UI ADD CONSTRAINT REPORT_ID CHECK (1 = 1)');
END;
在运行上面的代码时,我得到以下错误:
错误:无法更改表“ REPORT_UI”
因为此会话中的活动查询正在使用它,所以上下文:
SQL statement "ALTER TABLE REPORT_UI ADD
CONSTRAINT REPORT_ID CHECK (1 = 1)"