|
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。如果您注册时有任何问题请联系客服QQ: 83569622 。
您需要 登录 才可以下载或查看,没有帐号?注册
x
小弟今天碰到了件怪事,望高手們幫忙看看,感謝!
以下兩段SQL,SQL1可以正常執行,不會有任何問題,但運行SQL2這個Procedure時就會報ORA-34603這個錯誤,太奇怪了,因為實際上他們是一樣的。
SQL1:
DECLARE
CURSOR compare_index1
IS
SELECT *
FROM dba_indexes di1
WHERE NOT EXISTS (
SELECT *
FROM dba_indexes@TEST1 di2
WHERE di1.owner = di2.owner
AND di1.index_name = di2.index_name
AND di1.table_type = di2.table_type
AND di1.table_owner = di2.table_owner
AND di1.table_name = di2.table_name);
BEGIN
FOR ci1 IN compare_index1
LOOP
BEGIN
INSERT INTO test1_index_script
SELECT DBMS_METADATA.get_ddl ('INDEX',
UPPER (ci1.index_name),
UPPER (ci1.owner)
),
''
FROM DUAL;
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line (SQLERRM);
INSERT INTO test1_compare_index_exception
VALUES (ci1.owner, ci1.index_name, 'NFI', '', SYSDATE);
END;
COMMIT;
END LOOP;
END;
------------------------
SQL2:
BEGIN
GET_INDEX_SCRIPT;
END;
PROCEDURE get_index_script SOURCE:
CREATE OR REPLACE PROCEDURE apps.get_index_script
IS
CURSOR compare_index1
IS
SELECT *
FROM dba_indexes di1
WHERE NOT EXISTS (
SELECT *
FROM dba_indexes@TEST1 di2
WHERE di1.owner = di2.owner
AND di1.index_name = di2.index_name
AND di1.table_type = di2.table_type
AND di1.table_owner = di2.table_owner
AND di1.table_name = di2.table_name);
BEGIN
FOR ci1 IN compare_index1
LOOP
BEGIN
INSERT INTO test1_index_script
SELECT DBMS_METADATA.get_ddl ('INDEX',
UPPER (ci1.index_name),
UPPER (ci1.owner)
),
''
FROM DUAL;
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line (SQLERRM);
INSERT INTO test1_compare_index_exception
VALUES (ci1.owner, ci1.index_name, 'NFI', '', SYSDATE);
END;
COMMIT;
END LOOP;
END;
/
|
|