Numeric or value error Line 410??? appending to lob
line 410 is marked with line of '%%%%%%%%%%%%%%%%%%%%%'
This script is designed to profile data in a set of table by generating sql and running it with an execute immediate. It works by generating a set of code for each datatype and then executing the code twice for each table. Once for the summary profile and once for the detail profile. I've been starting at it awhile and can't figure out what the error means??? Thanks in advance!
set serveroutput on size 1000000
set feedback off
SET ECHO OFF
declare
c clob;
t varchar2(2000);
e varchar2(2000);
cursor c1 is select distinct owner,table_name from all_tab_columns
where table_name in ('PS_F_AP_AGING'
,'PS_F_AP_TRAN'
,'PS_F_VCHR_MTCH_EXP'
,'PS_F_APAR_NETTING'
,'PS_F_AR_AGING'
,'PS_F_AR_ACCOUNT_LN'
,'PS_F_AR_DSO'
,'PS_F_AR_TRAN'
,'PS_F_ASGN'
,'PS_F_CA_AMD'
,'PS_F_CA_DTL_DIST'
,'PS_F_CA_DTL_TRANS'
,'PS_F_CA_REV_RECOGN'
,'PS_F_EXP_DTL_DIST'
,'PS_F_GM_AWARD'
,'PS_F_GM_PRJ_TRAN'
,'PS_F_GM_PRP_AWD'
,'PS_F_PRJ_AC_CUR'
,'PS_F_PRJ_AC_PRDC'
,'PS_F_PRJ_CHNG'
,'PS_F_PRJ_CUR'
,'PS_F_PRJ_PRDC'
,'PS_F_PRJ_TRAN'
,'PS_F_PRP_VER_TRANS'
,'PS_F_RSRC_RT'
,'PS_F_INV_CYCLE_CNT'
,'PS_F_INV_LDGR'
,'PS_F_INV_TRANS'
,'PS_F_PHYSICAL_INV'
,'PS_F_BEGIN_BAL'
,'PS_F_JOURNAL'
,'PS_F_KK_ACTIVITY'
,'PS_F_KK_BALANCES'
,'PS_F_KK_BUD_ASSOC'
,'PS_F_KK_ENCUMBRAN'
,'PS_F_KK_EXCEPTION'
,'PS_F_KK_JOURNAL'
,'PS_F_KK_LEDGER'
,'PS_F_KK_OVERRIDES'
,'PS_F_KK_TRANS_LOG'
,'PS_F_LEDGER'
,'PS_F_MTCH_ANLYS'
,'PS_F_PO_DIST'
,'PS_F_PO_LINE'
,'PS_F_PO_SHIP_RCPT'
,'PS_F_PROC_CTLT'
,'PS_F_REQN'
,'PS_F_REQN_ANLYSIS'
,'PS_F_RTV'
,'PS_F_RTV_DIST'
,'PS_F_SCP_CAPACITY'
,'PS_F_SCP_INVENTORY'
,'PS_F_SCP_PRODN'
,'PS_F_SCP_PURCHASNG'
,'PS_F_SCP_SLS_FCST'
,'PS_F_SCP_TRANSFERS'
,'PS_F_SCPSLS_ACTUAL'
,'PS_F_VCHR'
,'PS_F_VCHR_DIST_LN'
,'PS_F_VCHR_LN'
/*,'PS_D_ACCOUNT'
,'PS_D_ACTGRY_AR_VW'
,'PS_D_AGING_CTGRY'
,'PS_D_ALTACCT'
,'PS_D_ANLYS_TYPE'
,'PS_D_AP_DOC_TYPE'
,'PS_D_AP_PTR_STAT'
,'PS_D_AP_PTR_TYPE'
,'PS_D_AP_PYMNT_TRMS'
,'PS_D_AP_VTR_STAT'
,'PS_D_AP_VTR_TYPE'
,'PS_D_APPOST_STATUS'
,'PS_D_AR_DOC_TYPE'
,'PS_D_AR_ITR_STAT'
,'PS_D_AR_ITR_TYPE'
,'PS_D_AR_PTR_STAT'
,'PS_D_AR_PTR_TYPE'
,'PS_D_ASGN'
,'PS_D_ASGN_STAT'
,'PS_D_BANK_ACCT'
,'PS_D_BOOK_CODE'
,'PS_D_BU_LED_GRP'
,'PS_D_BUCKET'
,'PS_D_BUDGET_REF'
,'PS_D_BUSINESS_UNIT'
,'PS_D_BUYER'
,'PS_D_CA'
,'PS_D_CA_AMD_RSN'
,'PS_D_CA_AMD_TYPE'
,'PS_D_CA_DTL'
,'PS_D_CA_JNK'
,'PS_D_CARRIER'
,'PS_D_CHANNEL'
,'PS_D_CHARTFIELD1'
,'PS_D_CHARTFIELD2'
,'PS_D_CHARTFIELD3'
,'PS_D_CLASS_FIELD'
,'PS_D_CNCL_STATUS'
,'PS_D_COLLECT_STAT'
,'PS_D_COMP_STATUS'
,'PS_D_CUST_ORG'
,'PS_D_CUSTOMER'
,'PS_D_DAY'
,'PS_D_DEDUCT_STAT'
,'PS_D_DEPT'
,'PS_D_DET_BUDGET'
,'PS_D_DET_PERIOD'
,'PS_D_DISPUTE_STAT'
,'PS_D_DIST_ACCT'
,'PS_D_DLVRY_STATUS'
,'PS_D_DT_PATTERN'
,'PS_D_ENTRY_RSTYP'
,'PS_D_EX_LOCATION'
,'PS_D_EXP_LN'
,'PS_D_EXP_RPT'
,'PS_D_FUND'
,'PS_D_GL_ADJ_TYPE'
,'PS_D_GM_AWARD'
,'PS_D_GM_INST'
,'PS_D_GM_PI'
,'PS_D_GM_PROP_PROJ'
,'PS_D_GM_PRP'
,'PS_D_GM_SPONSOR'
,'PS_D_INV_ITEM'
,'PS_D_INV_LOCATION'
,'PS_D_INVST_REASON'
,'PS_D_JOBCODE'
,'PS_D_JRNL_SOURCE'
,'PS_D_KK_BUDG_JNK'
,'PS_D_KK_BUDG_TYPE'
,'PS_D_KK_SOURCE_TRAN'
,'PS_D_LEDGER'
,'PS_D_LOT'
,'PS_D_MATCH_RULE'
,'PS_D_MRCHNT'
,'PS_D_MTCH_STATUS'
,'PS_D_OPER_UNIT'
,'PS_D_ORD_CAPTURE'
,'PS_D_ORIGIN'
,'PS_D_PATTERN_DAY'
,'PS_D_PERSON'
,'PS_D_PERSON_APOPID'
,'PS_D_PERSON_ARSPL'
,'PS_D_PERSON_COLTR'
,'PS_D_PERSON_CRNYST'
,'PS_D_PO_STATUS'
,'PS_D_PRJ'
,'PS_D_PRJ_AC'
,'PS_D_PRJ_AC_STAT'
,'PS_D_PRJ_CHNG'
,'PS_D_PRJ_HLTH'
,'PS_D_PRJ_ROLE'
,'PS_D_PRJ_RSRC'
,'PS_D_PRJ_RSRC_TYPE'
,'PS_D_PRJ_STAT'
,'PS_D_PRJ_TRAN_STAT'
,'PS_D_PRODUCT'
,'PS_D_PROGRAM_FDM'
,'PS_D_PRP'
,'PS_D_PRP_DTL'
,'PS_D_PY_TRMS_AR_VW'
,'PS_D_PYMNT_MTHD'
,'PS_D_RECLN_STATUS'
,'PS_D_RECV_STATUS'
,'PS_D_REQ_STATUS'
,'PS_D_REQLN_STATUS'
,'PS_D_RTRN_REASON'
,'PS_D_RTV_STATUS'
,'PS_D_RTVLN_STATUS'
,'PS_D_SALES_ORG'
,'PS_D_SCENARIO'
,'PS_D_SHIPTO'
,'PS_D_SO'
,'PS_D_SOURCE_TBL'
,'PS_D_STAT_CODE'
,'PS_D_SUPPLIER'
,'PS_D_TASK_TYPE'
,'PS_D_TIME'
,'PS_D_UOM'
,'PS_D_USER'
,'PS_D_WORK_CENTER'
,'PS_DEMAND_INF_INV'
,'PS_DEMAND_INV'
,'PS_DEPL_PLAN'
,'PS_DEPOSIT_CONTROL'
,'PS_DISTRIB_LIN'*/);
begin
for i in c1 loop
dbms_lob.createtemporary(c, true);
t := 'INSERT INTO DATA_PROFILE_COL_SUM ';
dbms_lob.writeappend(c,length(t), t);
--DBMS_OUTPUT.PUT_LINE(T);
----date
FOR MYSQLTEXT IN (SELECT
'select '
|| '''' || C.table_name || '''' || ' as tname, '
|| '''' || C.column_name || '''' || ' as cname, '
|| '''' || C.data_type || '''' || ' as data_type, '
|| '''' || nvl(c.data_length, 0) || '''' || ' as data_length, '
|| '''' || nvl(c.data_precision, 0) || '''' || ' as data_precision, '
|| '''' || nvl(c.data_scale, 0) || '''' || ' as data_scale, '
|| '''' || c.nullable || '''' || ' as nullable, '
|| '''' || nvl(c.num_distinct,0) || '''' || ' as num_distinct, '
|| '''' || nvl(c.density,0.0) || '''' || ' as density, '
|| '''' || nvl(c.num_nulls,0) || '''' || ' as num_nulls, '
|| '''' || nvl(c.char_col_decl_length,0) || '''' || ' as col_length, '
|| '''' || nvl(c.avg_col_len,0) || '''' || ' as avg_col_length, '
|| '''' || nvl(c.char_length,0) || '''' || ' as char_length, '
|| '''' || nvl(tblc.comments, 'NONE') || '''' || ' as table_comments, '
|| '''' || nvl(colc.comments, 'NONE') || '''' || ' as column_comments, '
|| ' count(*) as rcount, min('
|| c.column_name || ') as min_date, max('
|| c.column_name || ') as max_date, '
|| ' null as min_integer, null as max_integer, '
|| ' null as min_number, null as max_number, '
|| ' null as min_varchar2, null as max_varchar2, min(length('
|| c.column_name || ')) as min_len, max(length('
|| c.column_name || ')) as max_len, sysdate'
|| ' from '
|| C.owner || '.' || C.table_name
|| ' ' || CHR(13) || chr(10) || ' UNION ALL ' AS MYSQL
from sys.all_tab_columns c
inner join sys.all_tables t
on c.table_name = t.table_name
and c.owner = t.owner
left outer join sys.all_tab_comments tblc
on t.owner = tblc.owner
and t.table_name = tblc.table_name
left outer join sys.all_col_comments colc
on c.owner = colc.owner
and c.table_name = colc.table_name
and c.column_name = colc.column_name
where c.owner = I.OWNER
and c.data_type = 'DATE'
and c.table_name = I.TABLE_NAME
LOOP
-- DBMS_OUTPUT.PUT_LINE(MYSQLTEXT.MYSQL);
dbms_lob.writeappend(c, length(MYSQLTEXT.MYSQL),MYSQLTEXT.MYSQL);
END LOOP;
----number
FOR MYSQLTEXT IN (select
'select '
|| '''' || c.table_name || '''' || ' as tname, '
|| '''' || c.column_name || '''' || ' as cname, '
|| '''' || c.data_type || '''' || ' as data_type, '
|| '''' || nvl(c.data_length, 0) || '''' || ' as data_length, '
|| '''' || nvl(c.data_precision, 0) || '''' || ' as data_precision, '
|| '''' || nvl(c.data_scale, 0) || '''' || ' as data_scale, '
|| '''' || c.nullable || '''' || ' as nullable, '
|| '''' || nvl(c.num_distinct,0) || '''' || ' as num_distinct, '
|| '''' || nvl(c.density,0.0) || '''' || ' as density, '
|| '''' || nvl(c.num_nulls,0) || '''' || ' as num_nulls, '
|| '''' || nvl(c.char_col_decl_length,0) || '''' || ' as col_length, '
|| '''' || nvl(c.avg_col_len,0) || '''' || ' as avg_col_length, '
|| '''' || nvl(c.char_length,0) || '''' || ' as char_length, '
|| '''' || nvl(tblc.comments, 'NONE') || '''' || ' as table_comments, '
|| '''' || nvl(colc.comments, 'NONE') || '''' || ' as column_comments, '
|| ' count(*) as rcount, null as min_date, null as max_date, '
|| ' null as min_integer, null as max_integer, min('
|| c.column_name || ') as min_number, max('
|| c.column_name || ') as max_number, null as min_varchar2, null as max_varchar2, min(length('
|| c.column_name || ')) as min_len, max(length('
|| c.column_name || ')) as max_len, sysdate '
|| ' from '
|| t.owner || '.' || c.table_name
|| ' ' || CHR(13) || chr(10) || ' UNION ALL ' AS MYSQL
from sys.all_tab_columns c
inner join sys.all_tables t
on c.table_name = t.table_name
and c.owner = t.owner
left outer join sys.all_tab_comments tblc
on t.owner = tblc.owner
and t.table_name = tblc.table_name
left outer join sys.all_col_comments colc
on c.owner = colc.owner
and c.table_name = colc.table_name
and c.column_name = colc.column_name
where c.owner = I.OWNER
and c.data_type = 'NUMBER'
and c.table_name = I.TABLE_NAME
LOOP
dbms_lob.writeappend(c, length(MYSQLTEXT.MYSQL),MYSQLTEXT.MYSQL);
END LOOP;
--integer
FOR MYSQLTEXT IN (select
'select '
|| '''' || c.table_name || '''' || ' as tname, '
|| '''' || c.column_name || '''' || ' as cname, '
|| '''' || c.data_type || '''' || ' as data_type, '
|| '''' || nvl(c.data_length, 0) || '''' || ' as data_length, '
|| '''' || nvl(c.data_precision, 0) || '''' || ' as data_precision, '
|| '''' || nvl(c.data_scale, 0) || '''' || ' as data_scale, '
|| '''' || c.nullable || '''' || ' as nullable, '
|| '''' || nvl(c.num_distinct,0) || '''' || ' as num_distinct, '
|| '''' || nvl(c.density,0.0) || '''' || ' as density, '
|| '''' || nvl(c.num_nulls,0) || '''' || ' as num_nulls, '
|| '''' || nvl(c.char_col_decl_length,0) || '''' || ' as col_length, '
|| '''' || nvl(c.avg_col_len,0) || '''' || ' as avg_col_length, '
|| '''' || nvl(c.char_length,0) || '''' || ' as char_length, '
|| '''' || nvl(tblc.comments, 'NONE') || '''' || ' as table_comments, '
|| '''' || nvl(colc.comments, 'NONE') || '''' || ' as column_comments, '
|| ' count(*) as rcount, null as min_date, null as max_date, '
|| ' null as min_integer, null as max_integer, min('
|| c.column_name || ') as min_number, max('
|| c.column_name || ') as max_number, null as min_varchar2, null as max_varchar2, min(length('
|| c.column_name || ')) as min_len, max(length('
|| c.column_name || ')) as max_len, sysdate '
|| ' from '
|| t.owner || '.' || c.table_name
|| ' ' || CHR(13) || chr(10) || ' UNION ALL ' AS MYSQL
from sys.all_tab_columns c
inner join sys.all_tables t
on c.table_name = t.table_name
and c.owner = t.owner
left outer join sys.all_tab_comments tblc
on t.owner = tblc.owner
and t.table_name = tblc.table_name
left outer join sys.all_col_comments colc
on c.owner = colc.owner
and c.table_name = colc.table_name
and c.column_name = colc.column_name
where c.owner = I.OWNER
and c.data_type = 'INTEGER'
and c.table_name = I.TABLE_NAME
LOOP
dbms_lob.writeappend(c, length(MYSQLTEXT.MYSQL),MYSQLTEXT.MYSQL);
END LOOP;
--char and varchar
FOR MYSQLTEXT IN (select
'select '
|| '''' || c.table_name || '''' || ' as tname, '
|| '''' || c.column_name || '''' || ' as cname, '
|| '''' || c.data_type || '''' || ' as data_type, '
|| '''' || nvl(c.data_length, 0) || '''' || ' as data_length, '
|| '''' || nvl(c.data_precision, 0) || '''' || ' as data_precision, '
|| '''' || nvl(c.data_scale, 0) || '''' || ' as data_scale, '
|| '''' || c.nullable || '''' || ' as nullable, '
|| '''' || nvl(c.num_distinct,0) || '''' || ' as num_distinct, '
|| '''' || nvl(c.density,0.0) || '''' || ' as density, '
|| '''' || nvl(c.num_nulls,0) || '''' || ' as num_nulls, '
|| '''' || nvl(c.char_col_decl_length,0) || '''' || ' as col_length, '
|| '''' || nvl(c.avg_col_len,0) || '''' || ' as avg_col_length, '
|| '''' || nvl(c.char_length,0) || '''' || ' as char_length, '
|| '''' || nvl(tblc.comments, 'NONE') || '''' || ' as table_comments, '
|| '''' || nvl(colc.comments, 'NONE') || '''' || ' as column_comments, '
|| ' count(*) as rcount, null as min_date, null as max_date, '
|| ' null as min_integer, null as max_integer, '
|| ' null as min_number, null as max_number, min('
|| c.column_name || ') as min_varchar2, max('
|| c.column_name || ') as max_varchar2, min(length('
|| c.column_name || ')) as min_len, max(length('
|| c.column_name || ')) as max_len, sysdate'
|| ' from '
|| t.owner || '.' || c.table_name
|| ' ' || CHR(13) || chr(10) || ' UNION ALL ' AS MYSQL
from sys.all_tab_columns c
inner join sys.all_tables t
on c.table_name = t.table_name
and c.owner = t.owner
left outer join sys.all_tab_comments tblc
on t.owner = tblc.owner
and t.table_name = tblc.table_name
left outer join sys.all_col_comments colc
on c.owner = colc.owner
and c.table_name = colc.table_name
and c.column_name = colc.column_name
where c.owner = I.OWNER
and c.data_type in ('VARCHAR2', 'CHAR')
and c.table_name = I.TABLE_NAME
LOOP
dbms_lob.writeappend(c, length(MYSQLTEXT.MYSQL),MYSQLTEXT.MYSQL);
END LOOP;
e:='select null , null , null, null,null,null, null, null, null,null, null, null, null, null, null , null, null, null, null, null, null, null, null , null , null , null , null from dual where rownum < 0 ';
dbms_lob.writeappend(c, length(e),e);
execute immediate to_char(c);
dbms_lob.createtemporary(c, true);
t := 'insert INTO DATA_PROFILE_COL_DTL ';
dbms_lob.writeappend(c,length(t), t);
----date
FOR MYSQLTEXT IN (select
' select a.tname as table_name, a.cname as column_name, rownum as freq_rank, '
|| 'a.column_value as date_column_value, '
|| 'null as integer_column_value, null as number_column_value, null as varchar2_column_value, '
|| ' a.occurs, t.total_rows, round((((a.occurs * 1.0) / (t.total_rows * 1.0)) * 100), 5) as occurs_percent, '
|| ' a.capture_date'
|| ' from ( select '
|| '''' || c.table_name || '''' || ' as tname, '
|| '''' || c.column_name || '''' || ' as cname, '
|| c.column_name || ' as column_value, '
|| ' count(*) as occurs, sysdate as capture_date'
|| ' from '
|| t.owner || '.' || c.table_name
|| ' group by ' || c.column_name
|| ' order by count(*) desc )a inner join '
|| ' ( select ''' || c.table_name || ''' as tname, count(*) as total_rows from ' || t.owner || '.' || c.table_name || ') t '
|| ' on a.tname = t.tname where rownum <= 100'
|| CHR(13) || chr(10) || ' UNION ALL ' AS MYSQL
from sys.all_tab_columns c
inner join sys.all_tables t
on c.table_name = t.table_name
and c.owner = t.owner
where c.owner = i.owner
and c.data_type IN ('DATE')
and c.table_name = i.table_name
LOOP
dbms_lob.writeappend(c, length(MYSQLTEXT.MYSQL),MYSQLTEXT.MYSQL);
END LOOP;
----number
FOR MYSQLTEXT IN (select
' select a.tname as table_name, a.cname as column_name, rownum as freq_rank, '
|| 'null as date_column_value, '
|| 'a.column_value as integer_column_value, null as number_column_value, null as varchar2_column_value, '
|| ' a.occurs, t.total_rows, round((((a.occurs * 1.0) / (t.total_rows * 1.0)) * 100), 5) as occurs_percent, '
|| ' a.capture_date'
|| ' from ( select '
|| '''' || c.table_name || '''' || ' as tname, '
|| '''' || c.column_name || '''' || ' as cname, '
|| c.column_name || ' as column_value, '
|| ' count(*) as occurs, sysdate as capture_date'
|| ' from '
|| t.owner || '.' || c.table_name
|| ' group by ' || c.column_name
|| ' order by count(*) desc )a inner join '
|| ' ( select ''' || c.table_name || ''' as tname, count(*) as total_rows from ' || c.table_name || ') t '
|| ' on a.tname = t.tname where rownum <= 100'
|| CHR(13) || chr(10) || ' UNION ALL ' AS MYSQL
from sys.all_tab_columns c
inner join sys.all_tables t
on c.table_name = t.table_name
and c.owner = t.owner
where c.owner = I.OWNER
and c.data_type = 'INTEGER'
and c.table_name = I.TABLE_NAME
LOOP
dbms_lob.writeappend(c, length(MYSQLTEXT.MYSQL),MYSQLTEXT.MYSQL);
END LOOP;
--integer
FOR MYSQLTEXT IN (select
' select a.tname as table_name, a.cname as column_name, rownum as freq_rank, '
|| 'null as date_column_value, '
|| 'null as integer_column_value, a.column_value as number_column_value, null as varchar2_column_value, '
|| ' a.occurs, t.total_rows, round((((a.occurs * 1.0) / (t.total_rows * 1.0)) * 100), 5) as occurs_percent, '
|| ' a.capture_date'
|| ' from ( select '
|| '''' || c.table_name || '''' || ' as tname, '
|| '''' || c.column_name || '''' || ' as cname, '
|| c.column_name || ' as column_value, '
|| ' count(*) as occurs, sysdate as capture_date'
|| ' from '
|| t.owner || '.' || c.table_name
|| ' group by ' || c.column_name
|| ' order by count(*) desc )a inner join '
|| ' ( select ''' || c.table_name || ''' as tname, count(*) as total_rows from ' || t.owner || '.' || c.table_name || ') t '
|| ' on a.tname = t.tname where rownum <= 100'
|| CHR(13) || chr(10) || ' UNION ALL ' AS MYSQL
from sys.all_tab_columns c
inner join sys.all_tables t
on c.table_name = t.table_name
and c.owner = t.owner
where c.owner = I.OWNER
and c.data_type in ('NUMBER', 'DECIMAL')
and c.table_name = I.TABLE_NAME
LOOP
dbms_lob.writeappend(c, length(MYSQLTEXT.MYSQL),MYSQLTEXT.MYSQL);
END LOOP;
--char and varchar
FOR MYSQLTEXT IN (select
' select a.tname as table_name, a.cname as column_name, rownum as freq_rank, '
|| 'null as date_column_value, '
|| 'null as integer_column_value, null as number_column_value, a.column_value as varchar2_column_value, '
|| ' a.occurs, t.total_rows, round((((a.occurs * 1.0) / (t.total_rows * 1.0)) * 100), 5) as occurs_percent, '
|| ' a.capture_date'
|| ' from ( select '
|| '''' || c.table_name || '''' || ' as tname, '
|| '''' || c.column_name || '''' || ' as cname, '
|| c.column_name || ' as column_value, '
|| ' count(*) as occurs, sysdate as capture_date'
|| ' from '
|| t.owner || '.' || c.table_name
|| ' group by ' || c.column_name
|| ' order by count(*) desc )a inner join '
|| ' ( select ''' || c.table_name || ''' as tname, count(*) as total_rows from ' || t.owner || '.' || c.table_name || ') t '
|| ' on a.tname = t.tname where rownum <= 100'
|| CHR(13) || chr(10) || ' UNION ALL ' AS MYSQL
from sys.all_tab_columns c
inner join sys.all_tables t
on c.table_name = t.table_name
and c.owner = t.owner
where c.owner = I.OWNER
and c.data_type in ('VARCHAR2', 'CHAR')
and c.table_name = I.TABLE_NAME
LOOP
dbms_lob.writeappend(c, length(MYSQLTEXT.MYSQL),MYSQLTEXT.MYSQL);
END LOOP;
e:='select null, null, null, null, null, null, null, null, null, null, null from dual where rownum < 0 ';
dbms_lob.writeappend(c, length(e),e);
execute immediate to_char(c);
end loop;
end;
Most likely issue is:
execute immediate to_char(c); TO_CHAR will raise numeric or value error if c exeeds 4000 bytes. What Oracle version you are on? In newer versions execute immediate supports CLOB, so you can chnege the above to:
execute immediate c;Keep in mind, execute immediate has 32K limit on SQL string.
SY.
Similar Messages
-
Can anyone explain this: Numeric or Value Error Line 1
I have a stored procedure that starts out like so:
PROCEDURE test_proc(param1 IN VARCHAR2, param2 IN VARCHAR2, param3 OUT
SYS_REFCURSOR) IS
v_var varchar2(5);
BEGIN
SELECT * FROM. . .
The procedure tested fine in PL/SQL Developer. When calling from
ODP.NET like so. . .
OracleCommand cmd = new OracleCommand("test_proc", <connection>);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("param1", "somevalue");
cmd.Parameters.Add("param2", "XX");
cmd.Parameters.Add("param3", OracleDbType.RefCursor,
ParameterDirection.Output);
DataSet ds = new DataSet();
OracleDataAdapter da = new OracleDataAdapter(cmd);
con.Open();
da.fill(ds);
con.Close();
. . .the procedure executed as expected. If I changed the value of
param2 to "XXX" or any value three chars long I got the "ORA-06502:
Numeric or Value Error at Line 1" error.
After beating my head against the wall for hours, I tried changing the
size of v_var to 50, and the error disappeared. Mind you, the error
was being thrown long before v_var was being set further down in the
proc. Even more interesting is that the possible values of v_var were
all less than 5 chars wide. Most interesting: the value of p_param2 had nothing whatever to do with v_var.
Can anyone explain this?Hi,
Is your database 9206 by chance? Re: Error ORA-06502 PL/SQL
Cheers,
Greg -
Issue in appending the LOBs -ORA-06502: PL/SQL: numeric or value error
Hi
I am using Oracle 11g.
I have a requirement in which I have to append LOBs and I have to insert the LOB into a table column. I am facing problem when the data exceeds certain limit. My program works like the below:
(please note that my program logic is given below, not the exact program)
DECLARE
final_html CLOB;
int_html CLOB;
v_str VARCHAR2(32767);
i number:=0;
BEGIN
dbms_lob.createtemporary(lob_loc => int_html, CACHE => TRUE, dur => dbms_lob.CALL);
dbms_lob.createtemporary(lob_loc => final_html, CACHE => TRUE, dur => dbms_lob.CALL);
DBMS_LOB.OPEN(int_html, DBMS_LOB.LOB_READWRITE);
DBMS_LOB.OPEN(final_html, DBMS_LOB.LOB_READWRITE);
dbms_output.ENABLE(1000000);
FOR i IN 1..100 loop
v_str := '<tr>' ||
'<td style="WORD-WRAP: break-word" width="50"><font size="2">' ||
i || '</font></td>' ||
'</tr>';
dbms_lob.writeappend(lob_loc => int_html, amount => LENGTH(v_str), BUFFER => v_str);
END LOOP;
dbms_output.put_line( 'The length of int_html is:'||dbms_lob.getlength(int_html));
dbms_output.put_line( 'The int_html is:'||int_html);
final_html:= '<html>'||int_html||'</html>';
dbms_output.put_line('The final_html is:'||final_html);
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line(SQLCODE||'-'||SQLERRM);
DBMS_LOB.CLOSE (int_html);
DBMS_LOB.CLOSE (final_html);
DBMS_LOB.FREETEMPORARY(int_html);
DBMS_LOB.FREETEMPORARY(final_html);
END;
when the looping is done for lesser value say for e.g FOR i IN 1..10 loop, the program works fine, but when the looping is done for more values I am getting "-6502-ORA-06502: PL/SQL: numeric or value error" error message.
Please help me to resolve this issue.
Thanking you in advance.
Regards,
SriCan you please specify in which environment you are executing this ?
I modified your code as follows
The code executed successfully until the length was <= 32767 i.e ( until FOR i IN 1..1092)
Also, you need to use the APPEND function to concatenate clob variables.
Please verify the default max size for varchar2 or dbms_output in your server since you get the error for just the loop within the range (FOR i IN 1..100) .
And yes, the comments from Siva are valid.
DECLARE
final_html CLOB;
int_html CLOB;
v_str VARCHAR2(32767);
i number:=0;
BEGIN
dbms_lob.createtemporary(lob_loc => int_html, CACHE => TRUE, dur => dbms_lob.CALL);
dbms_lob.createtemporary(lob_loc => final_html, CACHE => TRUE, dur => dbms_lob.CALL);
DBMS_LOB.OPEN(int_html, DBMS_LOB.LOB_READWRITE);
DBMS_LOB.OPEN(final_html, DBMS_LOB.LOB_READWRITE);
dbms_output.ENABLE(1000000);
FOR i IN 1..1092 loop
v_str := '<tr>' ||
'<td style="">' ||
i || '</td>' ||
'</tr>';
dbms_lob.writeappend(lob_loc => int_html, amount => LENGTH(v_str), BUFFER => v_str);
END LOOP;
dbms_output.put_line( 'The length of int_html is:'||dbms_lob.getlength(int_html));
begin
dbms_output.put_line( 'The int_html is:'||int_html);
dbms_output.put_line( 'The length of int_html is:'||dbms_lob.getlength(int_html));
exception when others then
dbms_output.put_line(SQLCODE||'-'||SQLERRM);
end;
begin
final_html:= '<html>'||int_html||'</html>';
dbms_output.put_line('The final_html is:'||final_html);
exception when others then
dbms_output.put_line(SQLCODE||'-'||SQLERRM);
end; */
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line(SQLCODE||'-'||SQLERRM);
DBMS_LOB.CLOSE (int_html);
DBMS_LOB.CLOSE (final_html);
DBMS_LOB.FREETEMPORARY(int_html);
DBMS_LOB.FREETEMPORARY(final_html);
END;
Edited by: Jitesh Gurnani on Jul 29, 2011 3:11 AM
Edited by: Jitesh Gurnani on Jul 29, 2011 3:14 AM -
UTL_SMTP , ORA-06502: PL/SQL: numeric or value error
Hi there,
I have a procedure that sends emails using UTL_SMTP. It is showing the "ORA-06502: PL/SQL: numeric or value error" whenever the message spans over the limit of the varchar2 type (32'767). I want to send in one email more than that limit, is there a way? any help?
Thanks in advancetry this procedure... it works to me!!
create or replace procedure po8.mail_files ( from_name varchar2,
to_name varchar2,
subject varchar2,
message varchar2,
max_size number default 9999999999,
filename1 varchar2 default null,
filename2 varchar2 default null,
filename3 varchar2 default null,
debug number default 0 ) is
This procedure uses the UTL_SMTP package to send an email message.
Up to three file names may be specified as attachments.
Parameters are:
1) from_name (varchar2)
2) to_name (varchar2)
3) subject (varchar2)
4) message (varchar2)
5) max_size (number)
5) filename1 (varchar2)
6) filename2 (varchar2)
7) filename3 (varchar2)
eg.
mail_files( from_name => 'oracle' ,
to_name => '[email protected]' ,
subject => 'A test',
message => 'A test message',
filename1 => '/data/oracle/dave_test1.txt',
filename2 => '/data/oracle/dave_test2.txt');
Most of the parameters are self-explanatory. "message" is a varchar2
parameter, up to 32767 bytes long which contains the text of the message
to be placed in the main body of the email.
filename{1,2,3} are the names of the files to be attached to the email.
The full pathname of each file must be specified. The files must exist
in one of the directories specified in the init.ora parameter
UTL_FILE_DIR. All filename parameters are optional: It is not necessary
to specify unused file parameters (eg. filename3 is missing in the above
example).
The max_size parameter enables you to place a constraint on the maximum
size of message, including all attachments, that the procedure will send.
If this limit is exceeded, the procedure will truncate the message at
that point with a '*** truncated ***' message. The default is effectively
unlimited. However, the text of message body is still limited to 32Kb, as
it is passed in as a varchar2.
Obviously, as with any Oracle procedure, the parameter values can (and
usually will be) PL/SQL variables, rather than hard-coded literals, as
shown here.
Written: Dave Wotton, 14/6/01 (Cambridge UK)
This script comes with no warranty or support. You are free to
modify it as you wish, but please retain an acknowledgement of
my original authorship.
Amended: Dave Wotton, 10/7/01
Now uses the utl_smtp.write_data() method to send the message,
eliminating the 32Kb message size constraint imposed by the
utl_smtp.data() procedure.
Amended: Dave Wotton, 20/7/01
Increased the v_line variable, which holds the file attachment
lines from 400 to 1000 bytes. This is the maximum supported
by RFC2821, The Simple Mail Transfer Protocol specification.
Amended: Dave Wotton, 24/7/01
Now inserts a blank line before each MIME boundary line. Some
mail-clients require this.
Amended: Dave Wotton, 4/10/01
Introduced a 'debug' parameter. Defaults to 0. If set to
non-zero then errors in opening files for attaching are
reported using dbms_output.put_line.
Include code to hand MS Windows style pathnames.
You may need to modify the following variable if you don't have a local
SMTP service running (particularly relevant to Windows 2000 servers).
Refer to http://home.clara.net/dwotton/dba/oracle_smtp.htm for more
details.
v_smtp_server varchar2(20) := 'doc148.xtec.es';
v_smtp_server_port number := 25;
v_directory_name varchar2(100);
v_file_name varchar2(100);
v_line varchar2(1000);
crlf varchar2(2):= chr(13) || chr(10);
mesg varchar2(32767);
conn UTL_SMTP.CONNECTION;
type varchar2_table is table of varchar2(200) index by binary_integer;
file_array varchar2_table;
i binary_integer;
v_file_handle utl_file.file_type;
v_slash_pos number;
mesg_len number;
mesg_too_long exception;
invalid_path exception;
mesg_length_exceeded boolean := false;
begin
-- first load the three filenames into an array for easier handling later ...
file_array(1) := filename1;
file_array(2) := filename2;
file_array(3) := filename3;
-- Open the SMTP connection ...
conn:= utl_smtp.open_connection( v_smtp_server, v_smtp_server_port );
-- Initial handshaking ...
utl_smtp.helo( conn, v_smtp_server );
utl_smtp.mail( conn, from_name );
utl_smtp.rcpt( conn, to_name );
utl_smtp.open_data ( conn );
-- build the start of the mail message ...
mesg:= 'Date: ' || TO_CHAR( SYSDATE, 'dd Mon yy hh24:mi:ss' ) || crlf ||
'From: ' || from_name || crlf ||
'Subject: ' || subject || crlf ||
'To: ' || to_name || crlf ||
'Mime-Version: 1.0' || crlf ||
'Content-Type: multipart/mixed; boundary="DMW.Boundary.605592468"' || crlf ||
'' || crlf ||
'This is a Mime message, which your current mail reader may not' || crlf ||
'understand. Parts of the message will appear as text. If the remainder' || crlf ||
'appears as random characters in the message body, instead of as' || crlf ||
'attachments, then you''ll have to extract these parts and decode them' || crlf ||
'manually.' || crlf ||
'' || crlf ||
'--DMW.Boundary.605592468' || crlf ||
'Content-Type: text/plain; name="message.txt"; charset=US-ASCII' || crlf ||
'Content-Disposition: inline; filename="message.txt"' || crlf ||
'Content-Transfer-Encoding: 7bit' || crlf ||
'' || crlf ||
message || crlf ;
mesg_len := length(mesg);
if mesg_len > max_size then
mesg_length_exceeded := true;
end if;
utl_smtp.write_data ( conn, mesg );
-- Append the files ...
for i in 1..3 loop
-- Exit if message length already exceeded ...
exit when mesg_length_exceeded;
-- If the filename has been supplied ...
if file_array(i) is not null then
begin
-- locate the final '/' or '\' in the pathname ...
v_slash_pos := instr(file_array(i), '/', -1 );
if v_slash_pos = 0 then
v_slash_pos := instr(file_array(i), '\', -1 );
end if;
-- separate the filename from the directory name ...
v_directory_name := substr(file_array(i), 1, v_slash_pos - 1 );
v_file_name := substr(file_array(i), v_slash_pos + 1 );
-- open the file ...
v_file_handle := utl_file.fopen(v_directory_name, v_file_name, 'r' );
-- generate the MIME boundary line ...
mesg := crlf || '--DMW.Boundary.605592468' || crlf ||
'Content-Type: application/octet-stream; name="' || v_file_name || '"' || crlf ||
'Content-Disposition: attachment; filename="' || v_file_name || '"' || crlf ||
'Content-Transfer-Encoding: 7bit' || crlf || crlf ;
mesg_len := mesg_len + length(mesg);
utl_smtp.write_data ( conn, mesg );
-- and append the file contents to the end of the message ...
loop
utl_file.get_line(v_file_handle, v_line);
if mesg_len + length(v_line) > max_size then
mesg := '*** truncated ***' || crlf;
utl_smtp.write_data ( conn, mesg );
mesg_length_exceeded := true;
raise mesg_too_long;
end if;
mesg := v_line || crlf;
utl_smtp.write_data ( conn, mesg );
mesg_len := mesg_len + length(mesg);
end loop;
exception
when utl_file.invalid_path then
if debug > 0 then
dbms_output.put_line('Error in opening attachment '||
file_array(i) );
end if;
-- All other exceptions are ignored ....
when others then
null;
end;
mesg := crlf;
utl_smtp.write_data ( conn, mesg );
-- close the file ...
utl_file.fclose(v_file_handle);
end if;
end loop;
-- append the final boundary line ...
mesg := crlf || '--DMW.Boundary.605592468--' || crlf;
utl_smtp.write_data ( conn, mesg );
-- and close the SMTP connection ...
utl_smtp.close_data( conn );
utl_smtp.quit( conn );
end;
NOT MINE BUT COPY PASTE TO HELP YOU... -
ORA-06502: PL/SQL: numeric or value error: character string buffer too smal
Hi Guys I am getting error ORA-06502: PL/SQL: numeric or value error: character string buffer too small as it said i thought it would be issue with length of feild but i tried to change is nothihg work i am posing code here if any one can please help me on this
PROCEDURE REPORT
p_rpt_from_dt in varchar2,
p_rpt_to_dt in varchar2,
p_apvr_id in tc_wkr.tc_row_id%type default NULL,
p_rpt_type in varchar2 default NULL,
p_backto_pg in varchar2 default NULL
IS
v_rpt_from_dt date := var_to_date(p_rpt_from_dt);
v_rpt_to_dt date := var_to_date(p_rpt_to_dt);
v_time_str varchar2(15);
cursor period_cur
cp_from_dt date,
cp_to_dt date
is
select beg_dt, end_dt
from jmcs_wk_tprd
where beg_dt <= cp_to_dt -- report end date
and end_dt >= cp_from_dt -- report start date
BEGIN
if sys_security('tcsys', 'tc_reports') != 'GRANTED' then
apps_main.access_denied;
return;
end if;
if lg_debug_fl then
v_time_str := to_char(lg_sysdate, 'hh:mi:ss a.m.');
else
v_time_str := tc_time(lg_sysdate);
end if;
/* get the time card time periods applicable to the report */
lga_tc_strt_dt := lga_null_date;
for recs in period_cur(v_rpt_from_dt, v_rpt_to_dt) loop
lga_tc_strt_dt(lga_tc_strt_dt.count+1) := recs.beg_dt;
lga_tc_end_dt(lga_tc_end_dt.count+1) := recs.end_dt;
end loop;
--if p_apvr_id is NULL then
if p_rpt_type != 'D' then
tc_reporting.reports_header
1,
'Time Card Status Report',
'for '||dd_mon_yyyy(v_rpt_from_dt)||' through '||dd_mon_yyyy(v_rpt_to_dt)||'<BR>'||
'Report Date: '||dd_mon_yyyy(lg_sysdate)||' Time: '||v_time_str,
NULL,
NULL,
NULL,
'javascript:window.close()', /* Backto */
'alert(''Reminder! Click on logo when you are ready to return to previous page'')'
end if;
if p_apvr_id is NULL then
sub_STATUS_BD_ALPHA (v_rpt_from_dt, v_rpt_to_dt, TRUE, p_rpt_type, p_apvr_id);
else
htp.p('<!-- Selected Approver ('||p_apvr_id||') -->');
sub_STATUS_BD_APVR (v_rpt_from_dt, v_rpt_to_dt, p_rpt_type, p_apvr_id);
end if;
htp.p('</body></html>');
EXCEPTION
WHEN OTHERS THEN
error_proc(SQLERRM, SQLCODE, owa_util.get_cgi_env('PATH_INFO'));
htp.p('Error Code is :'||SQLERRM);
END REPORT;
This package in trun call other procedure like below
PROCEDURE sub_STATUS_BD_ALPHA
p_rpt_from_dt in date,
p_rpt_to_dt in date,
p_display_hdr in boolean,
p_rpt_type in varchar2 default 'B',
p_apvr_id in tc_wkr.tc_row_id%type default NULL,
p_tcs_user_id in tc_wkr.tc_row_id%type default NULL
IS
v_time_str varchar2(15);
v_apvr_id tc_wkr.tc_row_id%type := 0;
v_a_user_id tc_wkr.tc_row_id%type; -- approver tcs_user_id
v_cnt integer := 0;
v_people_cnt integer := 0;
v_stat_cd varchar2(2000);
v_display_fl boolean := FALSE;
/*===========================================================================*/
cursor people_cur
cp_from_dt in date,
cp_to_dt in date
is
select
d_full_nm_lfm as name,
tc_row_id as tcs_user_id,
tcw_typ as pay_typ,
tcw_id as pay_id,
sys_strt_date as sys_strt_dt,
sys_end_dt
from tc_wkr
where sys_strt_date <= cp_to_dt
and nvl(sys_end_dt, cp_to_dt) >= cp_from_dt
order by upper(d_full_nm_lfm);
/* find the current or the most recent (if no current) approver */
cursor apvr_cur
cp_tcs_user_id in tc_wkr.tc_row_id%type
is
select
a.f_tc_apvr_id as fk_tcs_apvr_id,
w.d_full_nm_lfm as apvr_name,
w.tcw_typ as apvr_pay_typ,
w.tcw_id as apvr_pay_id,
a.strt_dt,
a.end_dt
from tc_wkr w, tc_ap_asmt a
where a.f_tc_wkr_id = cp_tcs_user_id
and w.tc_row_id = a.f_tc_apvr_id
order by a.strt_dt desc;
/* list of existing time cards UNION required time cards */
cursor tc_cur
cp_tcs_user_id in tc_wkr.tc_row_id%type, /* who's time cards */
cp_from_dt in date, /* report period from date */
cp_to_dt in date /* report period to date */
is
select
stat_cd,
strt_dt,
end_dt
from tc
where strt_dt <= cp_to_dt
and end_dt >= cp_from_dt
and fk_tc_wkrtcw_id = cp_tcs_user_id
UNION
select
'Required' as stat_cd,
beg_dt as strt_dt,
end_dt
from jmcs_wk_tprd
where beg_dt <= cp_to_dt
and end_dt >= cp_from_dt
and beg_dt not in (
select strt_dt
from tc
where strt_dt <= cp_to_dt
and end_dt >= cp_from_dt
and fk_tc_wkrtcw_id = cp_tcs_user_id
order by strt_dt;
BEGIN
if lg_debug_fl then
v_time_str := to_char(lg_sysdate, 'hh:mi:ss a.m.');
else
v_time_str := tc_time(lg_sysdate);
end if;
if p_apvr_id > 0 then
lga_report_out := lga_report_out_null;
v_apvr_id := p_apvr_id;
lga_apvr := lga_apvr_null;
select
d_full_nm_lfm,
tc_row_id,
tcw_id,
tcw_typ
into
lga_apvr(1).apvr_name,
lga_apvr(1).apvr_tcs_id,
lga_apvr(1).apvr_pay_id,
lga_apvr(1).apvr_pay_typ
from tc_wkr
where tc_row_id = v_apvr_id;
if lga_apvr(1).apvr_pay_typ != 'S' then
select decode(bend_empl_fl, 'Y', 'E', 'W')
into lga_apvr(1).apvr_pay_typ
from empl
where empl_id = lga_apvr(1).apvr_pay_id;
end if;
end if;
if p_display_hdr then
if lga_tc_strt_dt.count > 6 then /* more than 6 time periods (1 month) */
lga_width(1) := to_char(.15 * lg_page_width_standard);
lga_width(2) := to_char(.08 * lg_page_width_standard);
for i in 1..lga_tc_strt_dt.count loop
lga_width(lga_width.count+1) := to_char(.09 * lg_page_width_standard);
end loop;
lg_page_width_standard := to_number(lga_width(1)) + to_number(lga_width(2));
if nvl(p_apvr_id, 0) = 0 then
lg_page_width_standard := lg_page_width_standard * 2;
end if;
htp.p('<!-- page width = '||lg_page_width_standard||'-->');
for i in 3..lga_width.count loop
lg_page_width_standard := lg_page_width_standard + to_number(lga_width(i));
htp.p('<!-- page width = '||lg_page_width_standard||'-->');
end loop;
lg_page_width := to_char(lg_page_width_standard);
else
lga_width(1) := '15%';
lga_width(2) := '8%';
lga_width(3) := '9%';
lga_width(4) := '9%';
lga_width(5) := '9%';
lga_width(6) := '9%';
lga_width(7) := '9%';
lga_width(8) := '9%';
end if;
sub_DETAIL_PAGE_HD(p_apvr_id);
end if;
/* cursor loop */
for p in people_cur(p_rpt_from_dt, p_rpt_to_dt) loop
/* is/was this person assigned to the selected approver for the report period */
v_display_fl := FALSE;
if nvl(p_tcs_user_id, 0) > 0 then
if p_tcs_user_id = p.tcs_user_id then
htp.p('<br>Selected User');
v_display_fl := TRUE;
end if;
elsif nvl(p_apvr_id, 0) = 0 then
if nvl(p_apvr_id, 0) = 0 then
v_display_fl := TRUE;
elsif p_apvr_id > 0 or p_apvr_id = -1 then
v_display_fl := fct_ASSIGNED_APVR(p.tcs_user_id, p_apvr_id, p_rpt_from_dt, p_rpt_to_dt);
end if;
if v_display_fl then
v_people_cnt := v_people_cnt + 1;
lg_tcs_owner_info.USER_ID := p.tcs_user_id;
lg_tcs_owner_info.PAY_ID := p.pay_id;
lg_tcs_owner_info.PAY_TYPE := p.pay_typ;
lg_tcs_owner_info.SYS_STRT_DT := p.sys_strt_dt;
lg_tcs_owner_info.TERM_DT := p.sys_end_dt;
if p.pay_typ = 'S' then
begin
select wrk_hire_dt
into lg_tcs_owner_info.hire_dt
from subcntr
where sub_id = p.pay_id;
exception
when no_data_found then
tc_debug.html_message('subcntr.pay_id('||p.pay_id||')');
end;
else
select
wrk_hire_dt,
decode(bend_empl_fl, 'Y', 'E', 'W')
into
lg_tcs_owner_info.hire_dt,
lg_tcs_owner_info.pay_type
from empl
where empl_id = lg_tcs_owner_info.PAY_ID;
end if;
if lga_report_out.count = 0 then
lga_report_out(lga_report_out.count+1) := '<table border="1" cellpadding="3" width="'||lg_page_width||'">';
end if;
if mod(v_people_cnt,2) = 1 then
lga_report_out(lga_report_out.count+1) := ('<tr bgcolor="'||lg_odd_bgcolor||'">');
else
lga_report_out(lga_report_out.count+1) := ('<tr bgcolor="'||lg_even_bgcolor||'">');
end if;
lga_report_out(lga_report_out.count+1) := ('<td valign="top"><font size=-2>'||p.name||'</font></td >');
lga_report_out(lga_report_out.count+1) := ('<td valign="top"><font size=-2>'||p.pay_typ||'-'||lpad(p.pay_id,4,'0')||'</font></td >');
if nvl(p_apvr_id, 0) > 0 then /* Single Approver */
/* need approver ID for time card "status" */
lga_apvr := lga_apvr_null; /* clear the approver id array */
lga_apvr(1).apvr_tcs_id := p_apvr_id;
elsif nvl(p_apvr_id, 0) = 0 then /* ALL Approvers */
lga_apvr := lga_apvr_null; /* clear the approver id array */
v_cnt := 0;
for ap in apvr_cur (p.tcs_user_id) loop
if v_cnt = 0 then
/* most recent approver may not be the applicable approver */
v_cnt := 1;
lga_apvr(v_cnt).apvr_name := ap.apvr_name; -- identify multiple approvers for the "status"
lga_apvr(v_cnt).apvr_tcs_id := ap.fk_tcs_apvr_id; -- identify multiple approvers for the "status"
lga_apvr(v_cnt).apvr_pay_id := ap.apvr_pay_id; -- identify multiple approvers for the "status"
v_apvr_id := ap.fk_tcs_apvr_id;
if ap.apvr_pay_typ = 'S' then
lga_apvr(v_cnt).apvr_pay_typ := ap.apvr_pay_typ; -- identify multiple approvers for the "status"
else
select decode(bend_empl_fl, 'Y', 'E', 'W')
into lga_apvr(1).apvr_pay_typ
from empl
where empl_id = lga_apvr(1).apvr_pay_id;
end if;
end if;
if ap.strt_dt <= p_rpt_to_dt and nvl(ap.end_dt, p_rpt_to_dt) >= p_rpt_from_dt then
/* approver record */
lg_tcs_owner_info.APVR_ID := ap.fk_tcs_apvr_id;
lg_tcs_owner_info.APVR_STRT_DT := ap.strt_dt;
lg_tcs_owner_info.APVR_END_DT := ap.end_dt;
don't enter same approver name multiple times
when same approver has been assigned more than once
Example: approver1, approver_2, approver_1 (change back to approver 1)
for i in 1..lga_apvr.count loop
v_apvr_id := ap.fk_tcs_apvr_id;
if lga_apvr(i).apvr_tcs_id = ap.fk_tcs_apvr_id then
/* don't add again */
v_apvr_id := NULL;
exit;
end if;
end loop;
if v_apvr_id is not NULL then
v_cnt := v_cnt + 1;
lga_apvr(v_cnt).apvr_name := ap.apvr_name; -- identify multiple approvers for the "status"
lga_apvr(v_cnt).apvr_tcs_id := ap.fk_tcs_apvr_id; -- identify multiple approvers for the "status"
lga_apvr(v_cnt).apvr_pay_id := ap.apvr_pay_id; -- identify multiple approvers for the "status"
lga_apvr(v_cnt).apvr_pay_typ := ap.apvr_pay_typ; -- identify multiple approvers for the "status"
end if;
end if;
end loop;
/* list approver pay IDs */
lga_report_out(lga_report_out.count+1) := ('<td valign="top"><font size=-2>');
if lga_apvr.count = 0 then
lga_report_out(lga_report_out.count+1) := 'Approver Unassigned';
else
for i in 1..lga_apvr.count loop
if i > 1 then
lga_report_out(lga_report_out.count+1) := '<br>';
end if;
lga_report_out(lga_report_out.count+1) := (lga_apvr(i).apvr_name);
end loop;
end if;
lga_report_out(lga_report_out.count+1) := ('<td valign="top"><font size=-2>');
if lga_apvr.count = 0 then
lga_report_out(lga_report_out.count+1) := 'N/A';
else
for i in 1..lga_apvr.count loop
if i > 1 then
lga_report_out(lga_report_out.count+1) := '<br>';
end if;
lga_report_out(lga_report_out.count+1) := (lga_apvr(i).apvr_pay_typ)||'-'||lpad(lga_apvr(i).apvr_pay_id,4,'0');
end loop;
end if;
lga_report_out(lga_report_out.count+1) := ('</font></td >');
end if;
for t in tc_cur(p.tcs_user_id, p_rpt_from_dt, p_rpt_to_dt) loop
htp.p('<! '||t.strt_dt||', '||t.end_dt||', '||t.stat_cd||' -->');
--lga_report_out(lga_report_out.count+1) := ('<td valign="top"><font size=-2>');
--lga_report_out(lga_report_out.count+1) := (t.stat_cd);
--lga_report_out(lga_report_out.count+1) := ('</font></td >');
/* has the selected approver has completed processing */
if p_apvr_id > 0
and v_apvr_id = p_apvr_id
and v_a_user_id != p_apvr_id
then
exit;
end if;
for ap in apvr_cur (p.tcs_user_id) loop
if apvr_cur%rowcount = 1 then
/* most recent approver assigned */
lg_tcs_owner_info.apvr_id := ap.fk_tcs_apvr_id;
end if;
if ap.strt_dt <= t.end_dt and nvl(ap.end_dt, t.end_dt) >= t.strt_dt then
/* approver assigned during time card period */
lg_tcs_owner_info.apvr_id := ap.fk_tcs_apvr_id;
exit;
end if;
end loop;
lg_tc_status.strt_dt := t.strt_dt;
lg_tc_status.end_dt := t.end_dt;
lg_tc_status.stat_cd := t.stat_cd;
v_stat_cd := fct_TC_STATUS(nvl(p_apvr_id, 0));
lga_report_out(lga_report_out.count+1) := ('<td align="center" valign="top" bgcolor="'||lg_tc_status.bg_color||'">');
lga_report_out(lga_report_out.count+1) := ('<font size=-2 color='||lg_tc_status.font_color||'>');
lga_report_out(lga_report_out.count+1) := v_stat_cd;
lga_report_out(lga_report_out.count+1) := ('</font></td >');
end loop;
lga_report_out(lga_report_out.count+1) := '</tr>';
end if; /* v_display_fl */
end loop;
if p_rpt_type in ('B', 'S') then
lg_page_cnt := lg_page_cnt + 1;
sub_DISPLAY_STATUS_SUMMARY;
end if;
if lga_report_out.count > 0 then
lga_report_out(lga_report_out.count+1) := '</table>';
end if;
if lga_report_out.count > 0 then
if p_rpt_type = 'B' or p_apvr_id > 0 then
if p_display_hdr then
if lg_page_cnt > 0 then
if p_apvr_id > 0 then /* selected individual approver */
htp.p('</table>');
end if;
htp.p('<br style="page-break-after:always">');
htp.p('<!-- &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& -->');
htp.p('<!-- &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& -->');
end if;
lg_page_cnt := lg_page_cnt + 1;
tc_reporting.reports_header
1,
'Time Card Status Report',
'for '||dd_mon_yyyy(p_rpt_from_dt)||' through '||dd_mon_yyyy(p_rpt_to_dt)||'<BR>'||
'Report Date: '||dd_mon_yyyy(lg_sysdate)||' Time: '||v_time_str,
NULL,
NULL,
NULL,
NULL, -- p_backto_pg, /* Backto */
'focus()',
lg_page_cnt
end if;
end if;
if p_rpt_type in ('B', 'D') then
for i in 1..lga_report_out.count loop
htp.p(lga_report_out(i));
end loop;
end if;
end if;
END sub_STATUS_BD_ALPHA;
Some veriable
type report_tc_rec is record
tc_owner_name tc_wkr.d_full_nm_lfm%type,
o_user_id tc_wkr.tc_row_id%type,
o_pay_id varchar2(10),
o_sys_strt_dt date,
o_sys_end_dt date,
tc_apvr_name tc_wkr.d_full_nm_lfm%type,
a_pay_id varchar2(10),
a_user_id tc_wkr.tc_row_id%type,
tc_strt_dt date,
tc_end_dt date,
tc_stat_cd varchar2(50),
ap_strt_dt date,
ap_end_dt date
/* time card owner information */
TYPE tcs_owner_info_rec IS RECORD
USER_ID tc_wkr.tc_row_id%type,
PAY_ID tc_wkr.tcw_id%type,
PAY_TYPE tc_wkr.tcw_typ%type,
HIRE_DT date,
SYS_STRT_DT date,
TERM_DT date,
APVR_ID tc_wkr.tc_row_id%type,
APVR_STRT_DT date,
APVR_END_DT date
/* status code determines report cell font and background colors */
TYPE tc_status_rec IS RECORD
STRT_DT date,
END_DT date,
STAT_CD tc.stat_cd%type,
FONT_COLOR varchar2(16),
BG_COLOR varchar2(16)
/* count of all time card status for report summary */
TYPE tc_status_summary_rec IS RECORD
APPROVED_CNT integer := 0,
REJECTED_CNT integer := 0,
SUBMITTED_CNT integer := 0,
POSTED_CNT integer := 0,
VERIFIED_CNT integer := 0,
OPEN_CNT integer := 0,
NEW_CNT integer := 0,
REQUIRED_CNT integer := 0,
TOTAL_CNT integer := 0
/* determine multiple approvers for individual for selected report period */
TYPE apvr_rec IS RECORD
apvr_name tc_wkr.d_full_nm_lfm%type,
apvr_tcs_id tc_wkr.tc_row_id%type,
apvr_pay_id tc_wkr.tcw_id%type,
apvr_pay_typ tc_wkr.tcw_typ%type
TYPE apvr_id_array_table IS TABLE OF apvr_rec
index by binary_integer;
type output_array is table of varchar2(1000)
index by binary_integer;
type date_array is table of date
index by binary_integer;
type status_array is table of varchar2(1000)
index by binary_integer;
type apvr_array is table of number(8)
index by binary_integer;
lga_report_out output_array; /* array of HTML code to be output to browser */
lga_report_out_null output_array; /* null array of HTML code */
lga_tc_status status_array;
lga_null_status status_array;
lga_tc_strt_dt date_array;
lga_tc_end_dt date_array;
lga_tc_disp date_array; /* start dates of displayed TC for selected user */
lga_null_date date_array; /* null array used to clear other date arrays */
/* LOCAL GLOBAL VARIABLES */
lg_tcs_owner_info tcs_owner_info_rec; /* time card owner information */
lg_tc_status tc_status_rec; /* time card status information */
lg_tc_status_summary tc_status_summary_rec; /* time card count by status */
lg_tc_rec report_tc_rec; /* time card */
lga_apvr apvr_id_array_table; /* array of approver Names and Payroll IDs */
lga_apvr_null apvr_id_array_table; /* clear the lga_apvr array for each user */
lg_sysdate date := sysdate;
lg_debug_fl boolean := FALSE;
lg_debug_owner_id tc_wkr.tc_row_id%type := 9905;
lg_debug_apvr_id tc_wkr.tc_row_id%type := 1000;
The chnages i have done its in bold
Please Advice
Thanks
Edited by: Purvik on Aug 25, 2009 11:59 AMThere is not a chance in the world, especially not knowing column definitions that I, and I suspect most anyone else, is going to wade through this much unformated code looking for an error you couldn't bother to copy in full.
Either tell us, specifically, the line on which the error is occurring or, better yet, start whacking stuff out of your code until you find the offending definition. That is certainly what I would do. Commenting out sections is a marvelous way to quickly find an issue.
Before you post again please read the FAQ. It will explain to you how to properly post and use the tags. -
ORA-06502: PL/SQL: numeric or value error While Exporting in Oracle 10g
Connected to: Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Production
With the Partitioning, OLAP and Data Mining options
Export done in AR8MSWIN1256 character set and AL16UTF16 NCHAR character set
server uses AR8ISO8859P6 character set (possible charset conversion)
About to export the entire database ...
. exporting tablespace definitions
. exporting profiles
. exporting user definitions
. exporting roles
. exporting resource costs
. exporting rollback segment definitions
. exporting database links
. exporting sequence numbers
. exporting directory aliases
. exporting context namespaces
. exporting foreign function library names
. exporting PUBLIC type synonyms
. exporting private type synonyms
. exporting object type definitions
. exporting system procedural objects and actions
. exporting pre-schema procedural objects and actions
. exporting cluster definitions
. about to export SYSTEM's tables via Conventional Path ...
. . exporting table DEF$_AQCALL 0 rows exported
. . exporting table SRC_RQST_SEQ 1 rows exported
EXP-00091: Exporting questionable statistics.
. . exporting table SRC_USERS 6 rows exported
EXP-00091: Exporting questionable statistics.
. . exporting table SRC_YEAR_LOOKUP 40 rows exported
EXP-00091: Exporting questionable statistics.
. . exporting table TENDER_DETAIL_TABLE 36 rows exported
EXP-00091: Exporting questionable statistics.
. . exporting table TENDER_MASTER_TABLE 34 rows exported
EXP-00091: Exporting questionable statistics.
. . exporting table TENDER_NEW_DETAIL_TABLE 4 rows exported
EXP-00091: Exporting questionable statistics.
. exporting synonyms
. exporting views
EXP-00056: ORACLE error 6502 encountered
ORA-06502: PL/SQL: numeric or value error
LPX-00210: expected '<' instead of 'n'
ORA-06512: at "SYS.UTL_XML", line 152
ORA-06512: at "SYS.DBMS_METADATA_INT", line 7195
ORA-06512: at "SYS.DBMS_METADATA_INT", line 9135
ORA-06512: at "SYS.DBMS_METADATA", line 1882
ORA-06512: at "SYS.DBMS_METADATA", line 3707
ORA-06512: at "SYS.DBMS_METADATA", line 3689
ORA-06512: at line 1
EXP-00056: ORACLE error 6502 encountered
ORA-06502: PL/SQL: numeric or value error
LPX-00210: expected '<' instead of 'n'
ORA-06512: at "SYS.UTL_XML", line 152
ORA-06512: at "SYS.DBMS_METADATA_INT", line 7195
ORA-06512: at "SYS.DBMS_METADATA_INT", line 9135
ORA-06512: at "SYS.DBMS_METADATA", line 1882
ORA-06512: at "SYS.DBMS_METADATA", line 3707
ORA-06512: at "SYS.DBMS_METADATA", line 3689
ORA-06512: at line 1
EXP-00000: Export terminated unsuccessfully
Plz reply me the appropriate Solution
Edited by: user8920919 on May 3, 2010 12:27 AMhi,
EXP-00091: Exporting questionable statistics The client character set(NLS_LANG) does not match the server character;
select parameter,value from nls_database_parameters where parameter like '%CHARACTERSET%';
and check the client system character set
- Pavan Kumar N
- ORACLE OCP - 9i/10g
https://www.oracleinternals.blogspot.com -
I have a stored procedure that starts out like so:
PROCEDURE test_proc(param1 IN VARCHAR2, param2 IN VARCHAR2, param3 OUT
SYS_REFCURSOR) IS
v_var varchar2(5);
BEGIN
SELECT * FROM. . .
The procedure tests fine in SQL Plus and PL/SQL Developer. When calling from
ODP.NET like so. . .
OracleCommand cmd = new OracleCommand("test_proc", <connection>);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("param1", "somevalue");
cmd.Parameters.Add("param2", "XX");
cmd.Parameters.Add("param3", OracleDbType.RefCursor,
ParameterDirection.Output);
DataSet ds = new DataSet();
OracleDataAdapter da = new OracleDataAdapter(cmd);
con.Open();
da.fill(ds);
con.Close();
. . .the procedure executes as expected. If I change the value of
param2 to "XXX" or any value three chars long I get the "ORA-06502:
Numeric or Value Error at Line 1" error.
Here's the kicker: I never constrain the size of that parameter or try to assign it to a variable! Why then should there be a numeric/value error?
Anyone have any ideas?
Thanks.Hi,
Are you pointing to a 9206 database by chance? There was a known database bug that could cause that, and would be resolved by patching your database to 9208.
Cheers,
Greg -
-6502 ORA-06502: PL/SQL: numeric or value error when using 'Create CAPI Definition'
I get an error when I try to create a CAPI definition with Headstart untilities (6i). I use HSU_CAPI revision 6.5.2.0
The detailed information says the following:
Message
BLAPI.OPEN_ACTIVITY
Start HSU_CAPI.run
Number of Tables to create CAPI for 1
Initial checks for table KCS_TENDERS with id 692754610572409851363604771392473242
HSU_CAPT.initial_checks for table KCS_TENDERS
HSU_CAPF.initial_checks for table KCS_TENDERS
HSU_CAPC.initial_checks Custom Services for table KCS_TENDERS
HSU_CAPB.initial_checks BRDD for table KCS_TENDERS
bltext.get_lines_from_repository, p_text_type=CDINOT
bltext.get_line_containing
bltext.get_line_containing
bltext.get_lines_from_repository, p_text_type=CDIPLS
bltext.get_line_containing
bltext.get_line_containing
bltext.get_line_containing
bltext.get_line_containing
bltext.get_line_containing
bltext.get_line_containing
KCS_TENDERS Business Rule Design Definition BR_TNR001_CEV does not have any Trigger Columns. Rule will fire when any column is updated.
bltext.get_lines_from_repository, p_text_type=CDINOT
bltext.get_line_containing
bltext.get_line_containing
bltext.get_lines_from_repository, p_text_type=CDIPLS
bltext.get_line_containing
bltext.get_line_containing
bltext.get_line_containing
bltext.get_line_containing
bltext.get_line_containing
bltext.get_line_containing
Creating CAPI for table KCS_TENDERS with id 692754610572409851363604771392473242
Recreating KCS_TENDERS Table API/Trigger Logic - Event: Pre-Before-Insert-stmt, Open transaction.
Write Text for element type APPLOG with id 753236628580304413262318236391196826 - Text type: ALCODE number of text lines = 6 - REPLACE
Deleted old text
Write Text for element type APPLOG with id 753236628580304413262318236391196826 - Text type: ALCMNT number of text lines = 1 - REPLACE
Deleted old text
Recreating KCS_TENDERS Table API/Trigger Logic - Event: Pre-Before-Update-stmt, Open transaction.
Write Text for element type APPLOG with id 753236628580332747461215454262479002 - Text type: ALCODE number of text lines = 6 - REPLACE
Deleted old text
Write Text for element type APPLOG with id 753236628580332747461215454262479002 - Text type: ALCMNT number of text lines = 1 - REPLACE
Deleted old text
Recreating KCS_TENDERS Table API/Trigger Logic - Event: Pre-Before-Delete-stmt, Open transaction.
Write Text for element type APPLOG with id 753236628580361081660112672133761178 - Text type: ALCODE number of text lines = 6 - REPLACE
Deleted old text
Write Text for element type APPLOG with id 753236628580361081660112672133761178 - Text type: ALCMNT number of text lines = 1 - REPLACE
Deleted old text
Recreating KCS_TENDERS Table API/Trigger Logic - Event: Post-After-Insert-stmt, Close transaction.
Write Text for element type APPLOG with id 753236628580389415859009890005043354 - Text type: ALCODE number of text lines = 6 - REPLACE
Deleted old text
Write Text for element type APPLOG with id 753236628580389415859009890005043354 - Text type: ALCMNT number of text lines = 1 - REPLACE
Deleted old text
Recreating KCS_TENDERS Table API/Trigger Logic - Event: Post-After-Update-stmt, Close transaction.
Write Text for element type APPLOG with id 753236628580417750057907107876325530 - Text type: ALCODE number of text lines = 6 - REPLACE
Deleted old text
Write Text for element type APPLOG with id 753236628580417750057907107876325530 - Text type: ALCMNT number of text lines = 1 - REPLACE
Deleted old text
Recreating KCS_TENDERS Table API/Trigger Logic - Event: Post-After-Delete-stmt, Close transaction.
Write Text for element type APPLOG with id 753236628580446084256804325747607706 - Text type: ALCODE number of text lines = 6 - REPLACE
Deleted old text
Write Text for element type APPLOG with id 753236628580446084256804325747607706 - Text type: ALCMNT number of text lines = 1 - REPLACE
Deleted old text
Recreating KCS_TENDERS Table API/Trigger Logic - Event: Pre-Before-Delete-row, Save old data.
Write Text for element type APPLOG with id 753236628580474418455701543618889882 - Text type: ALCODE number of text lines = 404 - REPLACE
Deleted old text
Write Text for element type APPLOG with id 753236628580474418455701543618889882 - Text type: ALCMNT number of text lines = 1 - REPLACE
Deleted old text
Recreating KCS_TENDERS Table API/Trigger Logic - Event: Pre-Insert, Call CAPI.
Write Text for element type APPLOG with id 753236628580568865785358936523163802 - Text type: ALCODE number of text lines = 4 - REPLACE
Deleted old text
Write Text for element type APPLOG with id 753236628580568865785358936523163802 - Text type: ALCMNT number of text lines = 1 - REPLACE
Deleted old text
Recreating KCS_TENDERS Table API/Trigger Logic - Event: Pre-Update, Call CAPI.
Write Text for element type APPLOG with id 753236628580597199984256154394445978 - Text type: ALCODE number of text lines = 4 - REPLACE
Deleted old text
Write Text for element type APPLOG with id 753236628580597199984256154394445978 - Text type: ALCMNT number of text lines = 1 - REPLACE
Deleted old text
Recreating KCS_TENDERS Table API/Trigger Logic - Event: Pre-Delete, Call CAPI.
Write Text for element type APPLOG with id 753236628580625534183153372265728154 - Text type: ALCODE number of text lines = 17 - REPLACE
Deleted old text
Write Text for element type APPLOG with id 753236628580625534183153372265728154 - Text type: ALCMNT number of text lines = 1 - REPLACE
Deleted old text
Recreating KCS_TENDERS Table API/Trigger Logic - Event: Post-Insert, Call CAPI.
Write Text for element type APPLOG with id 753236628580653868382050590137010330 - Text type: ALCODE number of text lines = 7 - REPLACE
Deleted old text
Write Text for element type APPLOG with id 753236628580653868382050590137010330 - Text type: ALCMNT number of text lines = 1 - REPLACE
Deleted old text
Recreating KCS_TENDERS Table API/Trigger Logic - Event: Post-Update, Call CAPI.
Write Text for element type APPLOG with id 753236628580682202580947808008292506 - Text type: ALCODE number of text lines = 144 - REPLACE
Deleted old text
Write Text for element type APPLOG with id 753236628580682202580947808008292506 - Text type: ALCMNT number of text lines = 1 - REPLACE
Deleted old text
Recreating KCS_TENDERS Table API/Trigger Logic - Event: Post-Delete, Call CAPI.
Write Text for element type APPLOG with id 753236628580767205177639461622139034 - Text type: ALCODE number of text lines = 282 - REPLACE
Deleted old text
Write Text for element type APPLOG with id 753236628580767205177639461622139034 - Text type: ALCMNT number of text lines = 1 - REPLACE
Deleted old text
HSU_CAPF.create_or_find_capi_pack
hsu_capi.find_plm (kcs_tnr_capi, 692754610572409851363604771392473242, CAPI).
capi package found in the context folder
BLPLM.UPD
FREE_FORMAT_TEXT_FLAG......... = Y
IMPLEMENTATION_NAME........... = kcs_tnr_capi
PLSQL_MODULE_TYPE............. = PACKAGE
SCOPE......................... = PUBLIC
COMPLETION_STATUS............. = COMPLETED
NAME.......................... = kcs_tnr_capi
PURPOSE....................... = Custom API package for implementing Business Rules and supporting TAPI
Recreated Package KCS/ KCS_TNR_CAPI, preserving only the Revision History.
HSU_CAPF.add_tags_er_av
bltext.get_lines_from_repository, p_text_type=CDINOT
bltext.get_line_containing
bltext.get_line_containing
bltext.get_lines_from_repository, p_text_type=CDINOT
bltext.get_line_containing
bltext.get_line_containing
bltext.get_lines_from_repository, p_text_type=CDINOT
bltext.get_line_containing
bltext.get_line_containing
bltext.get_lines_from_repository, p_text_type=CDINOT
bltext.get_line_containing
bltext.get_line_containing
HSU_CAPF.create_specification
HSU_CAPF.create_c_tabalias
HSU_CAPF.create_c_tabalias_all
HSU_CAPF.create_aggregate_value
HSU_CAPF.create_aggregate_value
HSU_CAPF.create_aggregate_value
Activity aborted with ORACLE internal errors.
-6502 ORA-06502: PL/SQL: numeric or value error: character string buffer too small
What can I do about it???
Thanks in advance.
Menno HoogsteenWorking on the same project as Menno, I had the time to look into the problem.
The problem is caused by the creation of the capi-function agregate_char_value in the packages hsu_capf. While creating this function the following code is executed:
add(' -- allowable values:');
add(' -- '||l_col_name_list);
This last statement causes the problem because this table is very big. L_col_name_list contains 2391 characters wich is 393 characters to long. So i changed this code into:
add(' -- allowable values:');
add(' -- '||substr(l_col_name_list,1,1990));
add(' -- '||substr(l_col_name_list,1990));
and everything works fine. Perhaps something for a patch?
Kind regards,
Ruben Spekle -
Error ORA-06502, numeric or value error character to number conversion
I have been trying to create an email including data from a table as part of the body. Whenever I try to send it, I get an error ORA-06502, numeric or value error, character to number conversion. If I take out the part referencing the table, the email will go without error, but if I put it back in I get the error.
There is the code:
DECLARE
v_email_body CLOB;
v_from_email_address VARCHAR2(100) := v('APP_USER');
v_id NUMBER;
BEGIN
v_email_body := 'Please pay the attached invoice from FY '||:P14_FY||' funds
Date: '||:P14_PURCHASE_DATE||'
Vendor: '||:P14_VENDOR||'
Invoice Number: '||:P14_INVOICE||'
Invoice Date: '||:P14_INVOICE_DT||'
Due Date: '||:P14_INVOICE_DUE_DT||'
KSR Number: '||:P14_KSR||'
DTS PO: '||:P14_DTS_PO||'
FINANCE DO: '||:P14_FINANCE_PO||'
FOR detail IN(SELECT OB_CODE
FROM BUDGET_USED
WHERE P_ID = :P14_ID)
v_email_body := v_email_body||detail.OB_CODE||utl_tcp.crlf;
LOOP
FOR detail2 IN (SELECT ob_code, amount
FROM budget_used
WHERE p_id = :P14_ID)
LOOP
v_email_body := v_email_body||detail2.ELCID||' - '||detail2.AMOUNT||utl_tcp.crlf;
END LOOP;
END LOOP;
v_email_body := v_email_body
'||:P14_EMAIL_NOTES||'
Thanks.
v_id := APEX_MAIL.SEND
(p_to => :P14_SUBMIT_TO
,p_cc => v('APP_USER')
,p_bcc => '[email protected]'
,p_from => v_from_email_address
,p_body => v_email_body
,p_subj => 'Invoice, '||:P14_VENDOR||', '||:P14_INVOICE||'');
--Having set up your email, now add one (or more) attachments...
FOR c1 in (SELECT FILENAME
,BLOB_CONTENT
,MIME_TYPE
FROM file_subjects f, apex_application_files a
where a.name = f.name
and f.P_ID = :P14_ID) LOOP
IF c1.blob_content IS NOT NULL THEN
APEX_MAIL.ADD_ATTACHMENT( p_mail_id => v_id,
p_attachment => c1.blob_content,
p_filename => c1.filename,
p_mime_type => c1.mime_type);
END IF;
END LOOP;
END;
Apex_mail.push_queue();
This is important to my company to be able to put this data into an email. If anyone can help me, I would greatly appreciate it. Thank you in advance.Lets isolate the erroring line by running the code in debug mode and adding some debug lines at various stages in the code
Apex has a builtin function named wwv_flow.debug which can print messages to the debug stack and would be visible when the page is run in debug mode.
DECLARE
v_email_body CLOB;
v_from_email_address VARCHAR2(100) := v('APP_USER');
v_id NUMBER;
BEGIN
wwv_flow.debug('BEGIN');
v_email_body := 'Please pay the attached invoice from FY '||:P14_FY||' funds
Date: '||:P14_PURCHASE_DATE||'
Vendor: '||:P14_VENDOR||'
Invoice Number: '||:P14_INVOICE||'
Invoice Date: '||:P14_INVOICE_DT||'
Due Date: '||:P14_INVOICE_DUE_DT||'
KSR Number: '||:P14_KSR||'
DTS PO: '||:P14_DTS_PO||'
FINANCE DO: '||:P14_FINANCE_PO||'
'||:P14_EMAIL_NOTES||'
Thanks.
wwv_flow.debug('Before sending mail');
v_id := APEX_MAIL.SEND
(p_to => :P14_SUBMIT_TO
,p_cc => v('APP_USER')
,p_bcc => '[email protected]'
,p_from => v_from_email_address
,p_body => v_email_body
,p_subj => 'Invoice, '||:P14_VENDOR||', '||:P14_INVOICE||'');
wwv_flow.debug('Before attachements');
--Having set up your email, now add one (or more) attachments...
FOR c1 in
(SELECT FILENAME
,BLOB_CONTENT
,MIME_TYPE
FROM file_subjects f, apex_application_files a
where a.name = f.name
and f.P_ID = :P14_ID)
LOOP
IF c1.blob_content IS NOT NULL THEN
APEX_MAIL.ADD_ATTACHMENT( p_mail_id => v_id,
p_attachment => c1.blob_content,
p_filename => c1.filename,
p_mime_type => c1.mime_type);
END IF;
END LOOP;
wwv_flow.debug('Finished attachements');
Apex_mail.push_queue();
END;What is the last message you see in the debug after running the page in debug mode and submitting it ? -
Numeric or value error: hex to raw conversion error , pls help
I am having problem with a sproc which accepts a Raw parameter.
I have a table called Profile:
CREATE TABLE PROFILES
PROFILEID INTEGER NOT NULL,
USERID INTEGER NOT NULL,
PROFILE RAW(255)
and a sproc named addprofile
CREATE OR REPLACE PROCEDURE addprofile
profile IN RAW,
userName IN VARCHAR2
AS
userId INT;
BEGIN
GetUserIdByName( userName, userId);
INSERT INTO Profiles
( ProfileID,userId , profile )
VALUES ( Profiles_ProfileID_SEQ.NEXTVAL,AddProfile.userId ,
AddProfile.profile );
END;
I am calling the Ent Library's Insert profile method which is part of DbProfileProvider.cs (Security App block). It is trying to persist a serialized profile object into the database.
private void InsertProfile(string userName, byte[] serializedProfile,
Data.Database securityDb, IDbTransaction transaction)
DBCommandWrapper cmd = securityDb.GetStoredProcCommandWrapper
(SPAddProfile);
cmd.AddInParameter("userName", DbType.String, userName);
cmd.AddInParameter("profile", DbType.Binary, serializedProfile);
securityDb.ExecuteNonQuery(cmd, transaction);
I get the following error:
Any suggestion on what needs to be changed to get this working? thanks!
Exception Details: Oracle.DataAccess.Client.OracleException: ORA-06502: PL/SQL: numeric or value error: hex to raw conversion error ORA-06512: at line 1
Stack trace:
[OracleException: ORA-06502: PL/SQL: numeric or value error: hex to raw conversion error
ORA-06512: at line 1]
Oracle.DataAccess.Client.OracleException.HandleErrorHelper(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src, String procedure)
Oracle.DataAccess.Client.OracleException.HandleError(Int32 errCode, OracleConnection conn, String procedure, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src)
Oracle.DataAccess.Client.OracleCommand.ExecuteNonQuery()
Microsoft.Practices.EnterpriseLibrary.Data.Database.DoExecuteNonQuery(DBCommandWrapper command)
Microsoft.Practices.EnterpriseLibrary.Data.Database.ExecuteNonQuery(DBCommandWrapper command, IDbTransaction transaction)
Microsoft.Practices.EnterpriseLibrary.Security.Database.DbProfileProvider.InsertProfile(String userName, Byte[] serializedProfile, Database securityDb, IDbTransaction transaction)
Microsoft.Practices.EnterpriseLibrary.Security.Database.DbProfileProvider.SetProfile(IIdentity identity, Object profile)
[InvalidOperationException: Error saving the profile for the following user 'test'.]
Microsoft.Practices.EnterpriseLibrary.Security.Database.DbProfileProvider.SetProfile(IIdentity identity, Object profile)
EntLibSecuritySample.DFO.Security.SecurityHelper.SetUserProfile(IIdentity identity, Object Profile) in C:\DFO\Sample\Security\EntLibSecuritySample\SecurityHelper.vb:285
[ApplicationException: An error has occurred saving profile object to Datastore. See stack trace for further information]
EntLibSecuritySample.DFO.Security.SecurityHelper.SetUserProfile(IIdentity identity, Object Profile) in C:\DFO\Sample\Security\EntLibSecuritySample\SecurityHelper.vb:287
EntLibSecuritySample.ProfilePage.cmdSaveProfile_Click(Object sender, EventArgs e) in C:\DFO\Sample\Security\EntLibSecuritySample\profile.aspx.vb:59
System.Web.UI.WebControls.Button.OnClick(EventArgs e)
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
System.Web.UI.Page.ProcessRequestMain() +1292Harsh,
I am not a user of the Enterprise Library so I can not speak to the specifics of that. However, here is a short sample that is based on the information you've provided. Perhaps it will be useful.
Database:
create table profiles
profileid integer not null,
userid integer not null,
profile raw(255)
create or replace procedure addprofile
p_profileid in integer,
p_userid in integer,
p_profile in raw
as
begin
insert into
profiles (profileid, userid, profile)
values (p_profileid, p_userid, p_profile);
end;
/C# code:
using System;
using System.Data;
using System.Text;
using Oracle.DataAccess.Client;
using Oracle.DataAccess.Types;
namespace HarshTest
/// <summary>
/// Summary description for Class1.
/// </summary>
class Class1
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
// connect to local db using o/s authentication
OracleConnection con = new OracleConnection("User ID=/; Pooling=False");
con.Open();
// create command object and set properties
OracleCommand cmd = new OracleCommand();
cmd.Connection = con;
cmd.CommandText = "ADDPROFILE";
cmd.CommandType = CommandType.StoredProcedure;
// parameter object for profileid
OracleParameter p_profileid = new OracleParameter();
p_profileid.OracleDbType = OracleDbType.Int32;
p_profileid.Value = 1;
p_profileid.Direction = ParameterDirection.Input;
// parameter object for userid
OracleParameter p_userid = new OracleParameter();
p_userid.OracleDbType = OracleDbType.Int32;
p_userid.Value = 1;
p_userid.Direction = ParameterDirection.Input;
// create a byte array for the raw value
ASCIIEncoding encoder = new ASCIIEncoding();
byte[] byteArray = encoder.GetBytes("TestProfile");
// parameter object for profile
OracleParameter p_profile = new OracleParameter();
p_profile.OracleDbType = OracleDbType.Raw;
p_profile.Value = byteArray;
p_profile.Direction = ParameterDirection.Input;
// add parameters to collection
cmd.Parameters.Add(p_profileid);
cmd.Parameters.Add(p_userid);
cmd.Parameters.Add(p_profile);
// execute the stored procedure
try
cmd.ExecuteNonQuery();
catch (OracleException ex)
Console.WriteLine(ex.Message);
// clean up objects
p_profile.Dispose();
p_userid.Dispose();
p_profileid.Dispose();
cmd.Dispose();
con.Dispose();
}Maybe the part about creating the byte array is what you are missing...
- Mark -
Numeric or value error: character to number conversion error
I'm having problems inserting a value from a date picker field (DD-MON-YYYY HH MI )
i'm submitting this value to a packaged procedure that accepts this field as VARCHAR2 .
on the insert, i do a to_date( P_DATE, 'DD-MON-YYYY HH:MI PM' )
and i get the numeric conversion error.
If I change the to_date on the procedure side, I get the :could not read the end of the format mask - which I've found threads about on this site.
I've tried using HH24 and different formats, but I get one of the two above errors on the insert.
If I don't fill in the datepicker field at all, it works fine.
help is appreciated !
BillHere is the trace anyway:
*** ACTION NAME:(application 4000, page 1) 2004-09-24 12:58:44.052
*** MODULE NAME:(HTML DB) 2004-09-24 12:58:44.052
*** SERVICE NAME:(TOPS) 2004-09-24 12:58:44.052
*** SESSION ID:(151.1) 2004-09-24 12:58:44.052
*** 2004-09-24 12:58:44.052
ksedmp: internal or fatal error
ORA-06502: PL/SQL: numeric or value error: character to number conversion error
Current SQL statement for this session:
declare
rc__ number;
begin
owa.init_cgi_env(:n__,:nm__,:v__);
htp.HTBUF_LEN := 255;
null;
null;
null;
null;
f(p=>:p);
if (wpg_docload.is_file_download) then
rc__ := 1;
wpg_docload.get_download_file(:doc_info);
null;
null;
null;
commit;
else
rc__ := 0;
null;
null;
null;
commit;
owa.get_page(:data__,:ndata__);
end if;
:rc__ := rc__;
end;
----- PL/SQL Call Stack -----
object line object
handle number name
6A3C4A00 532 package body FLOWS_010500.WWV_FLOW_UTILITIES
6A3C4A00 2502 package body FLOWS_010500.WWV_FLOW_UTILITIES
6A3C4A00 2748 package body FLOWS_010500.WWV_FLOW_UTILITIES
6A0E63C8 991 package body FLOWS_010500.WWV_FLOW_FORMS
6A11675C 932 package body FLOWS_010500.WWV_FLOW_DISP_PAGE_PLUGS
6A11675C 247 package body FLOWS_010500.WWV_FLOW_DISP_PAGE_PLUGS
6A4B54E0 8341 package body FLOWS_010500.WWV_FLOW
6A2A99F0 102 procedure FLOWS_010500.F
6A2B9E54 10 anonymous block
----- Call Stack Trace -----
calling call entry argument values in hex
location type point (? means dubious value)
ksedmp+524 CALLrel ksedst+0 1
ksedmptracecb+15 CALLrel _ksedmp+0 C
_ksddoa+118 CALLreg 00000000 C
ksdpcg+143 CALLrel ksddoa+0
ksdpec+180 CALLrel ksdpcg+0 1966 6D7D208 1
__PGOSF3__ksfpec+11 CALLrel _ksdpec+0 0
8
_kgerev+77 CALLreg 00000000 7474210 1966
kgerec1+18 CALLrel kgerev+0 7474210 6DCE5EC 1966 1
6D7D260
peirve+465 CALLrel kgerec1+0
pevmCVTCN+346 CALLrel _peirve+0
pfrinstrCVTCN+36 CALLrel pevmCVTCN+0 6E6E604 71CE370 7160F0C
pfrrunno_tool+51 CALL??? 00000000
pfrrun+1834 CALLrel pfrrun_no_tool+0 6E6E604 6A3C010A 6E6E640
plsqlrun+1051 CALLrel _pfrrun+0 6E6E604
peicnt+179 CALLrel plsql_run+0 6E6E604 1 0
kkxexe+477 CALLrel peicnt+0
opiexe+4896 CALLrel kkxexe+0 6A2B9E54
kpoal8+1705 CALLrel opiexe+0 49 3 6D7E06C
_opiodr+977 CALLreg 00000000 5E 14 6D7E7CC
_ttcpip+1827 CALLreg 00000000 5E 14 6D7E7CC 0
_opitsk+1098 CALL??? 00000000
opiino+938 CALLrel opitsk+0 0 0 747ABC0 6DEFB14 D8 0
_opiodr+977 CALLreg 00000000 3C 4 6D7FBBC
opidrv+479 CALLrel opiodr+0 3C 4 6D7FBBC 0
sou2o+45 CALLrel opidrv+0 3C 4 6D7FBBC
opimai+237 CALLrel sou2o+0
OracleThreadStart@ CALLrel opimai+0
4+899
77E7D338 CALLreg 00000000 -
Numeric or value error problem
Hi,
I created the following function on Oracle 8i:
create or replace function get_pub_info(p_inbox in varchar2)
return varchar2 deterministic is
cursor c_pub(p_inb varchar2) is
select a.pub_name,
a.pub_code,
b.fprocess_id
from pub a, fprocess b
where b.inbox_id = p_inb
and a.pub_code = b.pub_code;
v_inbox varchar2(25) default p_inbox;
v_pubn pub.pub_name%type;
v_pubc pub.pub_code%type;
v_fprocid fprocess.fprocess_id%type;
v_info varchar2(4000);
begin
open c_pub(trim(v_inbox));
v_info := '[';
loop
fetch c_pub into v_pubn, v_pubc, v_fprocid;
exit when c_pub%notfound;
if (v_pubn is not null) and (v_pubc is not null) and (v_fprocid is not null) then
v_info := v_info || '{PUB_PROCESS_ID=>"' || trim(v_fprocid) || '", PUB_CODE=>"' || trim(v_pubc) || '", PUB_NAME=>"'|| trim(v_pubn) ||'"},';
end if;
end loop;
close c_pub;
if v_info is not null then
if length(v_info) <= 1 then
v_info := '';
else
v_info := substr(v_info,1,length(v_info)-1)||']';
end if;
else
v_info := '';
end if;
return v_info;
end;
This function is used to generate a view column, and when I type "select * from view_name" on SQL*Plus, I get the error:
ORA-06502: PL/SQL: numeric or value error
ORA-06512: at "ISI_PUBS.GET_PUB_INFO", line 25
ORA-06512: at line 1
Can anybody give me a hand with this? Why this error happens?
I would really appreciate your help.
Thanks in advance.
-eric-Wednesday, May 15, 2002 1:29pm ADT
Hi Eric,
Can't recreate your error.... I did the following (see SQL*PLUS output at end of this post):
(1) created the PUB table using info you provided
(2) inserted a row into PUB table and commited
(3) created the FPROCESS table using info you provided
(4) inserted a row into FPROCESS table and commited
(5) selected from PUB table
(6) selected from FPROCESS table
(7) executed the get_pub_info() function
What happens when you just try the following?:
select get_pub_info('whatever') from dual;
Regards,
Phany
Moncton, NB, Canada
OUTPUT FROM SQL*PLUS
======================
SQL> CREATE TABLE PUB (P_INB VARCHAR2(1), PUB_NAME VARCHAR2(1), PUB_CODE VARCHAR2(1));
Table created.
SQL> INSERT INTO PUB VALUES('A','B','C');
1 row created.
SQL> COMMIT;
Commit complete.
SQL> CREATE TABLE FPROCESS (INBOX_ID VARCHAR2(1), FPROCESS_ID VARCHAR2(1), PUB_CODE VARCHAR2(1));
Table created.
SQL> INSERT INTO FPROCESS VALUES ('A','B','C');
1 row created.
SQL> COMMIT;
Commit complete.
SQL> CREATE OR REPLACE function get_pub_info(p_inbox in varchar2)
2 RETURN varchar2 deterministic
3 IS
4 cursor c_pub(p_inb varchar2)
5 is
6 select a.pub_name, a.pub_code, b.fprocess_id
7 from pub a, fprocess b
8 where b.inbox_id = p_inb
9 and a.pub_code = b.pub_code;
10
11 v_inbox varchar2(25) default p_inbox;
12 v_pubn pub.pub_name%type;
13 v_pubc pub.pub_code%type;
14 v_fprocid fprocess.fprocess_id%type;
15 v_info varchar2(4000);
16 BEGIN
17 open c_pub(trim(v_inbox));
18
19 v_info := '[';
20
21 loop
22 fetch c_pub into v_pubn, v_pubc, v_fprocid;
23 exit when c_pub%notfound;
24
25 if (v_pubn is not null) and (v_pubc is not null) and (v_fprocid is not null) then
26 v_info := v_info || '{PUB_PROCESS_ID=>"' || trim(v_fprocid) || '", PUB_CODE=>"' || trim(v_pubc) || '", PUB_NAME=>"'|| trim(v_pubn) ||'"},';
27 end if;
28 end loop;
29
30 close c_pub;
31
32 if v_info is not null
33 then
34 if length(v_info) <= 1 then
35 v_info := '';
36 else
37 v_info := substr(v_info,1,length(v_info)-1) || ']';
38 end if;
39 else
40 v_info := '';
41 end if;
42
43 return v_info;
44 END;
45 /
Function created.
SQL> select * from pub;
P P P
A B C
SQL> select * from fprocess;
I F P
A B C
SQL> SELECT get_pub_info('A') FROM dual;
GET_PUB_INFO('A')
[{PUB_PROCESS_ID=>"B", PUB_CODE=>"C", PUB_NAME=>"B"}]
SQL>
====================== -
Error PL/SQL: numeric or value error: character string buffer too small
HI oracle gurus,
I am new to PL/SQL,
my oracle version is oracle 11g.
i have create a procedure to insert data from flat file to a table using UTL_FILE.
Table is
CREATE TABLE EXT_PERSON_INFO
ID_PERSON NUMBER(38),
ID_BATCH NUMBER(38),
ID_PERSON_NBR VARCHAR2(3 BYTE),
ID_AREA VARCHAR2(5 BYTE),
NM_FINAL VARCHAR2(20 BYTE),
NM_START VARCHAR2(20 BYTE),
DT_DOB DATE,
ID_SERIAL VARCHAR2(9 BYTE),
DT_RESPONSE DATE,
TRANS_TYPE VARCHAR2(2 BYTE),
REG_RESPONSE VARCHAR2(1 BYTE),
TM_RX TIMESTAMP(6)
my procedure is
CREATE OR REPLACE PROCEDURE PROC_PERSON
IS
f_line VARCHAR2(2000);
f utl_file.file_type;
f_dir VARCHAR2(250);
fname VARCHAR2(50);
F_ID_PERSON EXT_PERSON_INFO.ID_PERSON%type :=1;
F_ID_BATCH EXT_PERSON_INFO.ID_BATCH%type :=1;
F_ID_PERSON_NBR EXT_PERSON_INFO.ID_PERSON_NBR%type;
F_ID_AREA EXT_PERSON_INFO.ID_AREA%type;
F_NM_FINAL EXT_PERSON_INFO.NM_FINAL%type;
F_NM_START EXT_PERSON_INFO.NM_START%type;
F_DT_DOB EXT_PERSON_INFO.DT_DOB%type;
F_ID_SERIAL EXT_PERSON_INFO.ID_SERIAL%type;
F_DT_RESPONSE EXT_PERSON_INFO.DT_RESPONSE%type;
F_TRANS_TYPE EXT_PERSON_INFO.TRANS_TYPE%type;
F_REG_RESPONSE EXT_PERSON_INFO.REG_RESPONSE%type;
BEGIN
fname := 'D:\raj\raj.txt';
f:= utl_file.fopen('RAJ',fname,'r');
loop
begin
utl_file.get_line(f,f_line);
exception
when no_data_found then
exit;
end;
F_ID_PERSON := 1;
F_ID_BATCH := 1;
F_ID_PERSON_NBR :=substr(f_line,1,3);
F_NM_FINAL := substr(f_line,4,22);
F_NM_START := substr(f_line,23,34);
F_DT_DOB := substr(f_line,35,44);
F_ID_SERIAL := substr(f_line,45,48);
F_DT_RESPONSE := substr(f_line,49,58);
F_TRANS_TYPE := substr(f_line,59,60);
F_REG_RESPONSE := substr(f_line,61,61);
F_ID_AREA := substr(f_line,62,64);
insert into EXT_PERSON_INFO VALUES (F_ID_PERSON,F_ID_BATCH,F_ID_PERSON_NBR,F_ID_AREA,F_NM_FINAL,F_NM_START,F_DT_DOB,F_ID_SERIAL,F_DT_RESPONSE,F_TRANS_TYPE,F_REG_RESPONSE);
end loop;
utl_file.fclose(f);
commit;
end;
am getting error
ORA-06502: PL/SQL: numeric or value error: character string buffer too small
please help me in this regard. unable to trace the issue.
Thanks in advance
Regards,
rajThe error message should have included a line number for you to reference back to your code to know what line the error was occurring on.
That said, look at the documentation for SUBSTR as you are using the third parm incorrectly. It is length, not end position. That's your issue. -
ORA-06502: PL/SQL: numeric or value error
HI All,
I am facing the following issue and looking forward for help to find the cause.
We are converting PDF documents in our repository to HTML using Oracle API
ctx_doc.ifilter (v_datablob, v_dataclob);
a highly simplified version of our code will be something like this..
1) Create table to store the BLOB(Binary PDF documents)
create table tbl_pdf_store(pdf_doc blob);
2) Insert a row and store a PDF.
3) Convert the PDF into HTML and store it in a CLOB object..
DECLARE
v_datablob BLOB;
v_dataclob CLOB;
BEGIN
--Create temporary clob objects
DBMS_LOB.createtemporary (v_dataclob, TRUE, DBMS_LOB.SESSION);
DBMS_LOB.createtemporary (v_datablob, TRUE, DBMS_LOB.SESSION);
--get the pdf to be converted from store table
SELECT pdf_doc
INTO v_datablob
FROM tbl_pdf_store
WHERE rownum < 1;
--convert the BLOB to HTML and store it in CLOB
ctx_doc.ifilter (v_datablob, v_dataclob);
exception
when others then
dbms_output.put_line(sqlerrm||' - '||sqlcode);
end;
Now the issue I am facing is, the above code works fine for few documents and for few others I get this cryptic error message
ORA-06502: PL/SQL: numeric or value error
ORA-06512: at "CTXSYS.DRUE", line 180
ORA-06512: at "CTXSYS.CTX_DOC", line 1142
ORA-06502: PL/SQL: numeric or value error - -6502
I cant reproduce the exact code here, but if anyone had faced the similar issue, then it would be great if they help me out.
thanks,
Prashant> Billy, its not just plain wrong its a sin :). "When
others" should itself be avoided if possible(it just
shows you don't know what error can occur). In the
actual code, we are using separate package to handle
and log errors. Here it was just for simplification I
added that putline code.
Phew.. You had me worried there... :-)
> I ran my procedure in debug mode and it throws this
exception when its executing the Oracle API
ctx_doc.ifilter
And there is very little you can do debugging that, as that source code is encoded (wrapped).
Which means that unfortunately you have to treat that code as a black box and investigate the bug with respects to:
a) the "environment" from which the call is made (ito of session settings, the sequence of calls made, etc)
b) the data and parameters passed
> this is not the case with all the PDFs..I was able to
convert more than 11 thousand documents without any
issues. I have this for only few hundred documents.
This would seem to point to a bug in Oracle's CTX conversion/filter code. Maybe those PDFs are a newer version and is not correctly supported. Maybe they're an older version that is not supported.
Which is why I said you need to isolate the error. Determine which PDFs are failing. Create a test harness (simplified code as you've posted) to perform a conversion (and nothing else).
Determine which PDFs fail and which works. Look at the differences between PDFs. E.g. can those problem PDFs be opened with different Acrobat Reader version - or do some of them fail?
> Another issue is I cannot view the content of the
these documents to check if anything is different :(.
You can with Acrobat Reader.. right?
> so no sure how to go from here...is there a
printstack method in Oracle 9i(similar to 10g I
guess) which can give me more information as I am
currently lost and not sure where to look.
Dumping the stack will not be of much help. In fact, the error message sequence you pasted already show the call sequence. And as these are in Oracle PL/SQL code, there is nothing really you can do about it.
My suggestion is to
a) isolate the error
b) consult the manual(s) to ensure that the Oracle PL/SQL s/w is used correctly
c) determine if this is data related (e.g. different PDF versions for example)
d) log a SR (Service Request) with Oracle Support
The more you can do ito of (a) - (c), the better the chance for finding the root cause, and the quicker resolution when you have no choice but to do (d). -
Procedure varchar2 parameter size limit? ORA-6502 Numeric or value error
Hi ALL,
I am trying to create out parameters in a Procedure. This procedure will be called by 4 other Procedures.
PROCEDURE create_serv_conf_attn_cc_email
( v_pdf_or_text varchar2,
v_trip_number number ,
v_display_attn_for_allmodes out varchar2,
v_display_cc_for_allmodes out varchar2,
v_multi_email_addresses out varchar2,
v_multi_copy_email_addresses out varchar2
When I call that procedure in another Procedure I am getting following error, which is caused by one of the out parameter being more than 255 characters.
I found that out via dbms_output.put_line(ing) one of the out parameter as I increased its size.
ORA-06502: PL/SQL: numeric or value error
I thought there was no size limit on any parameters passed to a Procedure.
Any one know of this limit of 255 characters on varchar2 Procedure parameters? Is there a work around keeping the same logic?
If not I will have to take those parameters out and resort to some global varchar2s which I do not like.
Thanks,
Suresh BhatI assume one of the variables you have declared is not large enough for it's assignment.
Here's an example.
ME_XE?create or replace procedure test_size(plarge in out varchar2 )
2 is
3 begin
4 plarge := rpad('a', 32000, 'a');
5 end;
6 /
SP2-0804: Procedure created with compilation warnings
Elapsed: 00:00:00.03
ME_XE?
ME_XE?declare
2 my_var varchar2(32767);
3 begin
4 test_size(my_var);
5 dbms_output.put_line(length(my_var));
6 end;
7 /
32000
PL/SQL procedure successfully completed.
--NOTE here how the declared variable is 500 characters, but the procedure will try to assign it over 32,000 characters...no dice
Elapsed: 00:00:00.00
ME_XE?
ME_XE?declare
2 my_var varchar2(500);
3 begin
4 test_size(my_var);
5 dbms_output.put_line(length(my_var));
6 end;
7 /
declare
ERROR at line 1:
ORA-06502: PL/SQL: numeric or value error: character string buffer too small
ORA-06512: at "TUBBY.TEST_SIZE", line 4
ORA-06512: at line 4
Elapsed: 00:00:00.04Edited by: Tubby on Oct 22, 2008 12:47 PM
Maybe you are looking for
-
How to get several users on one computer their own iTunes account???
We have 3 of us on one computer. ipod, ipod nano, and a shuffle. I don't want my 8 year old to access my 16 year olds music files. How can we all have our own, I guess you call it, "account" or "library" so when my 8 year old plugs in her shuffle, it
-
Windows 8.1 BSOD RDR_FILE_SYSTEM 0x27
A customer of ours is experiencing random BSODs, it seems to have something to do with avp.exe or rdbss.sys. I analyzed the MEMORY.DMP file with the Windows Debugging Tools, see below, can anyone tell me what is causing the BSODs? I already ran sfc /
-
Configuring to receive a iDoc in R/3 sent by XI
XI send a idoc( inbound - ORDERS05 ) to R/3, but occurs an ALE error, what's the basic settings that must to be done in R/3 to send iDoc(inbound) from XI to R/3 ? Is it necessary to configure a port to XI in IDX1 in R/3 ?
-
I have downloaded some ibooks but when I click on the icon nothing happens - it won't open
I have downloaded some ibooks from iTunes but icons will not open when I click on them. This issue applies to my Windows 7 computers and iPad (3rd Gen) and iPhone 4s. I can't find any help/support with this issue.
-
How do I load a copy of CC programs on second Mac?
I have logged out on ain computer, but when logging in to CC on the other get a system error!