2
我正在循環訪問數據庫中的表定義並提取DDL以便能夠爲軟件測試目的創建表「重複數據」的表副本集。我已經得到了下面的代碼,它提取DDL只是罰款一個表拋出一個ORA-06502錯誤。事情是,我已經定義了DDL作爲CLOB返回的變量,該變量應該足夠大。這裏的代碼:奇怪的ORA-06502:PL/SQL:數值或數值錯誤
create or replace
procedure gettabledescription as
current_date_time varchar2(32);
sql_statement varchar2(200);
ddl_return clob;
new_ddl clob;
BEGIN
DBMS_OUTPUT.ENABLE;
current_date_time:= to_char(sysdate,'MM/DD/YYYY - HH24:MI:SS');
dbms_output.put_line(current_date_time);
for cursor_rec in (select * from user_objects where object_type='TABLE' and object_name not like 'TM%' and object_name not like 'TZ_%' and object_name not like 'EXT_%' and object_name not like 'RPT_%' and object_name not like 'ETL_%') loop
sql_statement := 'select dbms_metadata.get_ddl(''TABLE'',' || '''' || cursor_rec.object_name || '''' || ') from dual';
execute immediate sql_statement into ddl_return;
**error thrown here** new_ddl := replace(ddl_return,TO_CHAR(cursor_rec.object_name),'QA_' || TO_CHAR(cursor_rec.object_name));
dbms_output.put_line(new_ddl);
end loop;
END GETTABLEDESCRIPTION;
我不明白爲什麼我得到那個錯誤。
1)錯誤發生在哪條線上? – 2011-12-15 20:04:24
在「new_ddl」行。 – 2011-12-15 20:44:32