I have the followig script
declare
v_tmp CLOB;
begin
v_tmp := dbms_metadata.get_ddl('TABLE', 'FOO', 'BAR');
end;
Where FOO
is the table's name and BAR
is the name of the current user.
When I run the script I get:
06502. 00000 - "PL/SQL: numeric or value error%s"
*Cause: An arithmetic, numeric, string, conversion, or constraint error
occurred. For example, this error occurs if an attempt is made to
assign the value NULL to a variable declared NOT NULL, or if an
attempt is made to assign an integer larger than 99 to a variable
declared NUMBER(2).
*Action: Change the data, how it is manipulated, or how it is declared so
that values do not violate constraints
.
The value returned by dbms_metadata.get_ddl
appears to be of type CLOB
so why isn't the assignement statement working?
Best Answer
CLOB
is not the problem. You may have a special character somewhere in the table definition.Above code works in general. But below is an exception, to reproduce your error:
Which gives:
The whole error message may reveal more, and I would check the specific table in the dictionary views (
ALL_TABLES
,ALL_TAB_COLS
), and look for such "anomalies".