简体   繁体   English

奇怪的ORA-06502:PL / SQL:数字或值错误

[英]Strange ORA-06502: PL/SQL: numeric or value error

I'm looping through the table definitions in a database and extracting the DDL in order to be able to create 'golden data' sets of table duplicates for software testing purposes. 我在数据库中遍历表定义并提取DDL,以便能够为软件测试目的创建表重复项的“黄金数据”集。 I've got the below code which extracts the DDL just fine up to one table where it throws a ORA-06502 error. 我有以下代码,它提取的DDL恰好达到一张表,并在其中引发ORA-06502错误。 The thing is, I've defined the variable that the DDL is being returned to as a CLOB, which should be big enough. 问题是,我已经定义了将DDL作为CLOB返回到的变量,该变量应该足够大。 Here's the code: 这是代码:

    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;

I don't understand why I'm getting that error. 我不明白为什么会收到该错误。

On Oracle 10gR2, When I call DBMS_OUTPUT.PUT_LINE with a varchar2 or clob longer than 8191 bytes, I receive an ORA-06502 error. 在Oracle 10gR2上,当我使用长度超过8191字节的varchar2或clob调用DBMS_OUTPUT.PUT_LINE时,会收到ORA-06502错误。 The solution would be to loop through the clob, pulling out lines and calling put_line once for each. 解决方案是遍历Clob,拔出行并为每个调用一次put_line。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 SQL错误:ORA-06502:PL / SQL:数字或值错误 - SQL Error: ORA-06502: PL/SQL: numeric or value error ORA-06502: PL/SQL: 连接时出现数字或值错误 - ORA-06502: PL/SQL: numeric or value error when concatenating ORA-06502: PL/SQL: ora_sql_txt 出现数字或值错误 - ORA-06502: PL/SQL: numeric or value error by ora_sql_txt 获取ORA-06502:PL / SQL:数字或值错误:SQL触发器中的字符到数字转换错误 - Getting ORA-06502: PL/SQL: numeric or value error: character to number conversion error in SQL trigger ORA-06502:PL / SQL:数字或值错误:Oracle SQL查询中的字符串缓冲区太小 - ORA-06502: PL/SQL: numeric or value error: character string buffer too small in Oracle sql query ORA-06502 PL / SQL:数字或值错误:字符到数字的转换错误; - ORA-06502 PL/SQL: numeric or value error: character to number conversion error; Oracle数据库错误:ORA-06502:PL / SQL:数字或值错误:字符串缓冲区太小 - Oracle Database Error: ORA-06502: PL/SQL: numeric or value error: character string buffer too small ORA-06502:PL/SQL:数字或值错误:字符串缓冲区太小 - ORA-06502: PL/SQL: numeric or value error: character string buffer too small ORA-06502:PL / SQL:数字或值错误:数字精度太大 - ORA-06502: PL/SQL: numeric or value error: number precision too large 包含4000个以上字符的Substr获得ORA-06502:PL / SQL:数字或值错误 - Substr with more than 4000 characters gets ORA-06502: PL/SQL: numeric or value error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM