OAS 4.0.8 PL/SQL Catridge exception ORA-6502 (Numeric or value error)
Hello,
Out product is using OAS 4.0.8.2 on UNIX running SOlaris. We are using Oracles Web Toolkit for application development and
presentation. I am basically trying to fill up some HTML form fields and calling
an HTTP post procedure in response
to a user clicking a submit button.
For some reason the PL/SQL cartridge throws an ORA-6502 error(Numeric or value error). Is there any restrictions to the
string types that can be passed to an HTTP
post procedure ??
Any pointers would be greatly appreciated ?
Thanks,
Ricko
null
We have fixed the problem !!! :-DDD
Thanks to all Oracle analysts who replied this issue.
aLeX
[email protected]
Similar Messages
-
REP-1401 Fatal PL/SQL error occur ORA-06502 numeric or value error
Hi,
I am getting following error in reports 6i
REP-1401 Fatal PL/SQL error occur ORA-06502 numeric or value error.
I have added a formula column based on other formula column
function CF_1FORMULA0005 return varchar2 is
CF_CREDIT varchar2(38);
begin
:CF_CREDIT:= :D_CARRY_F_CR+:D_HD_SUM_REP_CR;
RETURN (:CF_CREDIT);
end;
Oracle Standard formula coulmn:
function D_CARRY_F_DRFormula return VARCHAR2 is
l_dr VARCHAR2(38);
l_dr_disp VARCHAR2(38);
begin
SRW.REFERENCE(:C_FUNC_CURRENCY);
SRW.REFERENCE(:C_CARRY_F_DR);
if (:C_CARRY_F_DR = 0) THEN
ax_globe_package.g_dr_cf := TRUE;
--l_dr:= '0.00';
l_dr_disp := '0.00';
l_dr := ax_currency_pkg.display_char(:C_FUNC_CURRENCY,l_dr_disp,38);
else
-- return(ax_currency_pkg.display_char(:C_FUNC_CURRENCY,:C_CARRY_F_DR,ax_page_pkg.f_maxlength));
-- Bug2239881. Setting the carried forward totals.
IF (:P_GLOBAL_ATTR_CAT = 'JE.GR.GLXSTBKS.BOOKS' AND ax_globe_package.g_dr_cf = FALSE) THEN
ax_globe_package.g_dr_cf := TRUE;
ax_globe_package.g_dr_total := :C_CARRY_F_DR;
END IF;
srw.message(999,'G_DR_TOTAL = ' || ax_globe_package.g_dr_total );
l_dr := ax_currency_pkg.display_char(:C_FUNC_CURRENCY,to_char(ax_globe_package.g_dr_total),38);
/*select to_number(l_dr, '999G999G999G999G990D00')
into l_dr_disp
from dual;
end if;
srw.message(999,'l_dr = ' || l_dr );
return l_dr;
--return ltrim(to_char(l_dr_disp,'999G999G999G999G990D00','nls_numeric_characters=,.'));
end;
both formula column return types are character.Please help me ASAP.
Thanks,
sriharsha.Hi,
First of all: when you should use concatenation operator (||) instead of plus sign when working with strings. So, instead of
:CF_CREDIT:= :D_CARRY_F_CR+:D_HD_SUM_REP_CR; you should use
:CF_CREDIT:= :D_CARRY_F_CR||:D_HD_SUM_REP_CR; If :D_CARRY_F_CR and :D_HD_SUM_REP_CR are both numbers then consider to use to_char function before you assign value to :CF_CREDIT.
I wonder, why your CF's returns varchar's if they operates on numbers?
regards
kikolus
Edited by: kikolus on 2012-11-30 08:03 -
Urgent - ORA-06502 numeric or value error in Complex SQL Join
I am having trouble with a tricky bit of code.
I have a complex join query which uses reference cursors.
type search_cursor is ref cursor;
c_result search_cursor;
cursor c_result1 is
select chemicals.*,buildings.building_name,msds.msds,chemical_ras.ra from chemicals,msds,chemical_ras,buildings;
cv_result c_result1%rowtype;
pv_query := 'select chemicals.*,buildings.building_name,msds.msds,chemical_ras.ra from
chem_location_join
right join room_permissions on chem_location_join.room_id = room_permissions.room_id
inner join chemicals on chemicals.chemical_id = chem_location_join.chem_id
inner join cupboards on cupboards.cupboard_id=chem_location_join.cupboard_id
inner join rooms on rooms.room_id=chem_location_join.room_id
inner join buildings on buildings.building_id=chem_location_join.building_id
inner join csr on chemicals.chemical_id=csr.chemical_id
left join msds on msds.csr_id = csr.csr_id
left join chemical_ras on csr.csr_id= chemical_ras.csr_id
where research_group_id = '||pv_research_group_id||' and upper(' || p_search_field || ') LIKE upper(''%' || p_search_entry || '%'') order by chemicals.chemical_name';
Basically,
When the italics are left out, the query runs perfectly. However, when it is put in, it returns the ORA-06502 numeric or value error.
I have run the query in SQL using values in the where clause and it works perfectly. When i replace buildings with other similar elements, i.e. cupboard, room the query returns a similar error.
Sorry if this seems hard to understand, if you need more clarification please reply.
Many Thanks,
Simon
Message was edited by:
SimonHollingsworthno but that shouldn't matter because all that cursor is doing is setting the variable cv_result equal to the same %rowtype, the where clause shouldn't be relevant. in any case I don't have a where clause when the italic bit is left out and it still works fine
-
SQL query concat - numeric or value error
I am getting numeric or value error when concatenating sql script..
Here is the sample, I have in the stored proc.. firstpart:_ works fine if I comment the secondpart:_. (I modified the query because I am posting in the public forums)
V_SAMPLEQUERY VARCHAR2(2000);
firstpart:_
V_SAMPLEQUERY := '
SELECT
AB.ABCDID AS ABCDID,
CD.MEMBERID AS MEMBERID,
CD.FNAME AS FNAME,
CD.LNAME AS LNAME,
CD.ACCOUNT AS ACCOUNT,
EF.ZIP AS ZIP,
AB.INSERTTIME AS INSERTTIME,
AB.INSERTBY AS INSERTBY,
ES.NAME AS STATUS,
MYFUNCTION(E.ABCDID) AS AMOUNT,
PA.NAME AS SOUSENAME,
R.CODE AS BUDGETCODE,
WX.ACCOUNTID as ACCOUNTID,
AB.SOMETYPE AS SOMETYPE,
AB.ACCTREP,
ED.TYPE AS TYPE,
AB.NOTES AS NOTES,
GH.AREACODE || '''' || GH.PHONE_NUMBER AS PHONENUMBER,
ED.REQUESTEDDATE,
ED.BOOKED,
ED.CALLERINFO
FROM PEOPLES AB,
LOCATIONS CD,
LOCATIONTYPES EF,
ACCOUNTS GH,
ACCOUNTdetails IJ,
ACCOUNTstatus KL,
ACCOUNTMEMBERDETAILS MN,
MEMBERS OP,
BUDGET QR,
BCODES ST,
ACCOUNTSYSTEM UV,
INFOCALL WX,
PHONE_NUMBERS YZ
WHERE AT.NAME = ''SAVINGS''
andCD.MEMBERID = PH.MEMBERID
andCD.MEMBERID =EF.MEMBERID
and AT.ADDRESSTYPEID =EF.ADDRESSTYPEID
andCD.MEMBERID =AB.MEMBERID
andAB.STATUS = ES.STATUS(+)
andAB.ABCDID = ED.ABCDID
andAB.ABCDID = EP.ABCDID(+)
and EP.MEBER_ID = PA.MEBER_ID(+)
andAB.BID = R.BID(+)
andAB.SAMPLEID = PR.SAMPLEID(+)
andAB.ABCDID = BSG.ABCDID(+)
andAB.INFOCALLID = C.INFOCALLID(+)
and YZ.SOMETYPEID = ''10000''
ANDAB.INSERTTIME > SYSDATE - 35
ANDAB.INSERTTIME < ''
AND WX.NAME IN (''ABCD'',
''EFGH'',
''IJKL'',
''MNOP'',
''QRST'',
''UVWX'')
AND MN.NAME = ''FINISHED'' '
secondpart:_ ***ERROR PART***
V_SAMPLEQUERY := V_SAMPLEQUERY || ' ORDER BY AB.USER'; -- Here I am getting error saving ORA-06502 - numeric or value errorHi,
Wheneve you have a problem, prlease post a complete test script that people can run to re-create the problem and test their ideas. Include CREATE TABLE and INSERT statements for any tables used, abnd the results you want it to produce.
SeshuGiri wrote:
I am getting numeric or value error when concatenating sql script.. Are you really getting the error when you concatenate, or when you try to execute the resulting string?
Here is the sample, I have in the stored proc.. firstpart:_ works fine if I comment the secondpart:_. (I modified the query because I am posting in the public forums)
V_SAMPLEQUERY VARCHAR2(2000);Is that big enough? It looks like the string is right around 1000 characters; depending on your character set, that could be more than 2000 bytes. VARCHAR2s in PL/SQL can hold up to 32767 bytes.
firstpart:_
V_SAMPLEQUERY := '
SELECT
AB.ABCDID AS ABCDID,
CD.MEMBERID AS MEMBERID,
CD.FNAME AS FNAME,
CD.LNAME AS LNAME,
CD.ACCOUNT AS ACCOUNT,
EF.ZIP AS ZIP,
AB.INSERTTIME AS INSERTTIME,
AB.INSERTBY AS INSERTBY,
ES.NAME AS STATUS,
MYFUNCTION(E.ABCDID) AS AMOUNT,
PA.NAME AS SOUSENAME,
R.CODE AS BUDGETCODE,
WX.ACCOUNTID as ACCOUNTID,
AB.SOMETYPE AS SOMETYPE,
AB.ACCTREP,
ED.TYPE AS TYPE,
AB.NOTES AS NOTES,
GH.AREACODE || '''' || GH.PHONE_NUMBER AS PHONENUMBER,
ED.REQUESTEDDATE,
ED.BOOKED,
ED.CALLERINFO
FROM PEOPLES AB,
LOCATIONS CD,
LOCATIONTYPES EF,
ACCOUNTS GH,
ACCOUNTdetails IJ,
ACCOUNTstatus KL,
ACCOUNTMEMBERDETAILS MN,
MEMBERS OP,
BUDGET QR,
BCODES ST,
ACCOUNTSYSTEM UV,
INFOCALL WX,
PHONE_NUMBERS YZ
WHERE AT.NAME = ''SAVINGS''
andCD.MEMBERID = PH.MEMBERID
andCD.MEMBERID =EF.MEMBERID
and AT.ADDRESSTYPEID =EF.ADDRESSTYPEID
andCD.MEMBERID =AB.MEMBERIDYou need some whitespace after the keyword "and", in the line above and also several places below.
andAB.STATUS = ES.STATUS(+)
andAB.ABCDID = ED.ABCDID
andAB.ABCDID = EP.ABCDID(+)
and EP.MEBER_ID = PA.MEBER_ID(+)
andAB.BID = R.BID(+)
andAB.SAMPLEID = PR.SAMPLEID(+)
andAB.ABCDID = BSG.ABCDID(+)
andAB.INFOCALLID = C.INFOCALLID(+)
and YZ.SOMETYPEID = ''10000''
ANDAB.INSERTTIME > SYSDATE - 35
ANDAB.INSERTTIME < '' Did something get cut off here?
AND WX.NAME IN (''ABCD'',
''EFGH'',
''IJKL'',
''MNOP'',
''QRST'',
''UVWX'')
AND MN.NAME = ''FINISHED'' 'It looks like you're constructing a string for EXECUTE IMMEDIATE, but why not just use a static query?
secondpart:_ ***ERROR PART***
V_SAMPLEQUERY := V_SAMPLEQUERY || ' ORDER BY AB.USER'; -- Here I am getting error saving ORA-06502 - numeric or value error
USER is the name of a built-in function, which means it's not a good name for your own column. Try user_name instead. -
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. -
Hi Team,
I am running one conc programme.
After running I am getting below error. I checked the issue on metalink and other, seems that it is an size related issue. I have increased the size of formula columns and placeholdder too.
But still getting issue.
My requirement is to get comma seperated values using SQL query itself. Neither i wanted to create layout of the report , since it is a XML publisher report and nor I am including it on RTF template.
I want the CF_10 formula column to be populated with comma seperated values.
MSG-00187: From Date 01-Sep-2014
REP-1401: 'cf_10formula': Fatal PL/SQL error occurred.
ORA-06502: PL/SQL: numeric or value error
And Here is my code for CF_10
function CF_10Formula return Number is
begin
SELECT NVL(TO_CHAR(sum(Amount),'99,99,99,999'),0) into :CP_5 --NVL(ROUND(sum(Amount)),0) into :CP_5
-- xxhw_Coll_cat(category) "Intercat Catg"
FROM hhxw_Region_col_v
WHERE Category IN ('Intercompany - CATV')
AND trunc(gl_date) BETWEEN TO_DATE(:P_FROM_DATE, 'DD/MM/RRRR') AND TO_DATE(:P_TO_DATE, 'DD/MM/RRRR');
RETURN ROUND(:CP_5);
end;
Anyone please suggest me.
Regards,
SachinHi,
1)Why are you selecting the value into a report item? Select into a local variable and return that
RETURN :CP_5 --> This one!!
2)And you should avoid applying functions to DB columns in where clauses wherever possible, so oracle can use indexes on them if applicable:
AND gl_date >= To_date(:P_FROM_DATE, 'DD/MM/RRRR')
AND gl_date < To_date( :P_TO_DATE, 'DD/MM/RRRR') + 1;
I think you are taking 2 column in the Layout CF_10 and CP_5 right? if so, then use below Query.
FUNCTION cf_10formula
RETURN NUMBER
IS
v_amount NUMBER:null;
IS
BEGIN
BEGIN
SELECT nvl(round(SUM(amount)), 0)
INTO v_amount --> Retruns the value for CF_10 column
FROM hhxw_region_col_v
WHERE category IN ( 'Intercompany - CATV' )
AND gl_date >= to_date(:P_FROM_DATE, 'DD/MM/RRRR')
AND gl_date < to_date( :P_TO_DATE, 'DD/MM/RRRR') + 1;
:CP_5 := nvl(trunc(v_amount),0); --> Retruns the value for CP_5 column
EXCEPTION
WHEN OTHERS THEN
v_amount := 0;
srw.message(1003,'Error in Getting :' ||p_from_date);
END;
END;
And
If you've got a number function returning into a number field then all you should need to do to make the comma appear is to change the number format mask in field.
From 40000 to 40,000 -
Package Returning Error ORA-06502: PL/SQL: numeric or value error
Hi,
I create a package to export to spread sheet .xls, The package work for simple query if i pass the query to package.
There is no error in package please create the package and do the following as mentioned below
create or replace
PACKAGE export_pkg_spread_sheet
AS
procedure download_excel(vsql in clob );
PROCEDURE excel_header(p_header in out nocopy clob);
procedure excel_content(p_content in out nocopy clob,
vsql in clob );
procedure excel_footer(p_footer in out nocopy clob);
procedure get_usable_sql (p_sql_in IN clob,
p_sql_out OUT clob);
END export_pkg_spread_sheet;
create or replace
PACKAGE body export_pkg_spread_sheet
AS
PROCEDURE excel_header (p_header IN OUT nocopy CLOB)
AS
BEGIN
p_header := '<html><body>';
END;
procedure download_excel( vsql in clob )
as
p_header clob;
p_footer clob;
p_content clob;
begin
owa_util.mime_header( 'application/octet', FALSE );
htp.p('Content-Disposition: attachment; filename="report.xls"');
owa_util.http_header_close;
excel_header( p_header);
excel_content(p_content,vsql);
excel_footer(p_footer);
dbms_output.put_line(p_header ||p_content|| p_footer);
HTP.PRN( p_header ||p_content|| p_footer);
htmldb_application.g_unrecoverable_error := true;
end;
procedure excel_content(p_content in out nocopy clob,
vsql in clob)
as
p_sql_stmt clob;
cur PLS_INTEGER := DBMS_SQL.OPEN_CURSOR;
cols DBMS_SQL.DESC_TAB;
ncols PLS_INTEGER;
TYPE varColumn IS TABLE OF varchar2(32000);
vtab varColumn;
v_column_count NUMBER DEFAULT 0;
v_status INTEGER;
BEGIN
htp.prn('am here');
/* SELECT region_source into p_sql_stmt
FROM apex_application_page_regions
WHERE region_id = p_region_id AND
page_id = p_page_id AND
application_id = p_app_id; */
get_usable_sql (vsql,p_sql_stmt);
p_content := p_sql_stmt;
-- Parse the query.
DBMS_SQL.PARSE(cur, p_sql_stmt , DBMS_SQL.NATIVE);
-- Retrieve column information
DBMS_SQL.DESCRIBE_COLUMNS (cur, ncols, cols);
-- Display each of the column names
p_content := '<table> <tr>';
FOR colind IN 1 .. ncols
LOOP
p_content := p_content || '<td>' || cols(colind).col_name || '</td>';
END LOOP;
p_content := p_content || '</tr>';
vtab := varColumn(null);
for i in 1..ncols
loop
vtab.extend;
DBMS_SQL.DEFINE_COLUMN (cur, i, vtab(i), 2000);
--dbms_output.put_line(vtab(i));
end loop;
v_status := DBMS_SQL.EXECUTE (cur);
LOOP
p_content := p_content || '<tr>';
EXIT WHEN (DBMS_SQL.FETCH_ROWS (cur) <= 0);
FOR i IN 1 ..ncols
loop
DBMS_SQL.COLUMN_VALUE (cur, i, vtab(i));
-- p_content := p_content || '<td>' || 'xyz' || '</td>';
p_content := p_content || '<td>' || vtab(i) || '</td>';
END LOOP;
p_content := p_content || '</tr>' ;
END LOOP;
p_content := p_content || '<table>' ;
DBMS_SQL.CLOSE_CURSOR (cur);
exception
when others then
p_content := '<td>Exception Error in printing data</td><table>' ;
DBMS_SQL.CLOSE_CURSOR (cur);
end;
procedure excel_footer( p_footer in out nocopy clob)
as
begin
p_footer := '</body></html>';
end;
PROCEDURE get_usable_sql (p_sql_in IN clob, p_sql_out OUT clob)
IS
v_sql clob;
v_names DBMS_SQL.varchar2_table;
v_pos NUMBER;
v_length NUMBER;
v_exit NUMBER;
BEGIN
v_sql := p_sql_in;
v_names := wwv_flow_utilities.get_binds (v_sql);
FOR i IN 1 .. v_names.COUNT
LOOP
<<do_it_again>>
v_pos := INSTR (LOWER (v_sql), LOWER (v_names (i)));
v_length := LENGTH (LOWER (v_names (i)));
v_sql :=
SUBSTR (v_sql, 1, v_pos - 1)
|| v_names (i)
|| SUBSTR (v_sql, v_pos + v_length);
v_sql :=
REPLACE (v_sql,
UPPER (v_names (i)),
'(SELECT v('''
|| LTRIM (v_names (i), ':')
|| ''') FROM DUAL)'
IF INSTR (LOWER (v_sql), LOWER (v_names (i))) > 0
THEN
GOTO do_it_again;
END IF;
END LOOP;
p_sql_out := v_sql;
END;
END export_pkg_spread_sheet;
After creating the package pass the parameter to package like this
begin
export_pkg_spread_sheet.download_excel('select * from emp');
end;
Package will allow to download the spread shreet. If i try to pass the a complex query to package it is returning error as mentioned below
ORA-06502: PL/SQL: numeric or value error
In the above package there is a procedure called procedure excel_content which actuall prints the data in the spread sheet this is where the error is coming from there is a variable called vsql have declared it as clob to hold large string but still i am getting the same error when trying to pass a big string.
Please check the error and let me know.
Thanks
SudhirHi Praveen,
This is the query i am using to pass
Declare
qry clob;
Begin
qry := ' 'SELECT
AR.REGION_CODE,
AR.DISTRICT_CODE,
AR.TERRITORY_CODE,
CASE
WHEN AR.REGION_NAME IS NOT NULL AND AR.DISTRICT_NAME IS NULL AND AR.TERRITORY_NAME IS NULL THEN
AR.REGION_NAME
WHEN AR.REGION_NAME IS NOT NULL AND AR.DISTRICT_NAME IS NOT NULL AND AR.TERRITORY_NAME IS NULL THEN
AR.DISTRICT_NAME
WHEN AR.REGION_NAME IS NOT NULL AND AR.DISTRICT_NAME IS NOT NULL AND AR.TERRITORY_NAME IS NOT NULL THEN
AR.TERRITORY_NAME
END TERR_NAME,
AR.EMPLOYEE_ID,
AR.LAST_NAME,
AR.FIRST_NAME,
AR.GENDER,
AR.DATE_OF_HIRE,
AR.PROJECT_EMPLOYEE_TITLE_ID,
AR.COMPANY_ID,
AR.CUSTOMER_EMAIL,
AR.BUSINESS_EMAIL,
AR.CUSTOMER_VOICEMAIL,
AR.CUSTOMER_VOICEMAIL_EXT,
AR.QUINTILES_VOICEMAIL,
AR.QUINTILES_VOICEMAIL_EXT , complete_roster_pkg_report.AR_F_ADDRESS_GET_LINE_1(AR.PROJECT_ID,AR.EMPLOYEE_ID,1 ,TO_DATE(AAH.EFFECTIVE_DATE)) "Shipping_ADDRESS_TYPE_1" , complete_roster_pkg_report.AR_F_ADDRESS_GET_LINE_2(AR.PROJECT_ID,AR.EMPLOYEE_ID,1 ,TO_DATE(AAH.EFFECTIVE_DATE)) "Shipping_ADDRESS_TYPE_2" , complete_roster_pkg_report.AR_F_ADDRESS_GET_PHONE(AR.PROJECT_ID,AR.EMPLOYEE_ID,1 ,TO_DATE(AAH.EFFECTIVE_DATE)) "Shipping_Phone" , complete_roster_pkg_report.AR_F_ADDRESS_GET_CITY_TOWN(AR.PROJECT_ID,AR.EMPLOYEE_ID,1 ,TO_DATE(AAH.EFFECTIVE_DATE)) "Shipping_City_Town" , complete_roster_pkg_report.AR_F_ADDRESS_GET_COUNTRY_NAME(AR.PROJECT_ID,AR.EMPLOYEE_ID,1 ,TO_DATE(AAH.EFFECTIVE_DATE)) "Shipping_Country_Name" , complete_roster_pkg_report.AR_F_ADDRESS_GET_STATE_NAME(AR.PROJECT_ID,AR.EMPLOYEE_ID,1 ,TO_DATE(AAH.EFFECTIVE_DATE)) "Shipping_State_Name" , complete_roster_pkg_report.AR_F_ADDRESS_GET_ZIP_POSTAL(AR.PROJECT_ID,AR.EMPLOYEE_ID,1 ,TO_DATE(AAH.EFFECTIVE_DATE)) "Shipping_ZipCode" , complete_roster_pkg_report.AR_F_ADDRESS_GET_LINE_1(AR.PROJECT_ID,AR.EMPLOYEE_ID,3 ,TO_DATE(AAH.EFFECTIVE_DATE)) "Storage_ADDRESS_TYPE_1" , complete_roster_pkg_report.AR_F_ADDRESS_GET_LINE_2(AR.PROJECT_ID,AR.EMPLOYEE_ID,3 ,TO_DATE(AAH.EFFECTIVE_DATE)) "Storage_ADDRESS_TYPE_2" , complete_roster_pkg_report.AR_F_ADDRESS_GET_PHONE(AR.PROJECT_ID,AR.EMPLOYEE_ID,3 ,TO_DATE(AAH.EFFECTIVE_DATE)) "Storage_Phone" , complete_roster_pkg_report.AR_F_ADDRESS_GET_CITY_TOWN(AR.PROJECT_ID,AR.EMPLOYEE_ID,3 ,TO_DATE(AAH.EFFECTIVE_DATE)) "Storage_City_Town" , complete_roster_pkg_report.AR_F_ADDRESS_GET_COUNTRY_NAME(AR.PROJECT_ID,AR.EMPLOYEE_ID,3 ,TO_DATE(AAH.EFFECTIVE_DATE)) "Storage_Country_Name" , complete_roster_pkg_report.AR_F_ADDRESS_GET_STATE_NAME(AR.PROJECT_ID,AR.EMPLOYEE_ID,3 ,TO_DATE(AAH.EFFECTIVE_DATE)) "Storage_State_Name" , complete_roster_pkg_report.AR_F_ADDRESS_GET_ZIP_POSTAL(AR.PROJECT_ID,AR.EMPLOYEE_ID,3 ,TO_DATE(AAH.EFFECTIVE_DATE)) "Storage_ZipCode" , complete_roster_pkg_report.AR_F_ADDRESS_GET_LINE_1(AR.PROJECT_ID,AR.EMPLOYEE_ID,4 ,TO_DATE(AAH.EFFECTIVE_DATE)) "Home_ADDRESS_TYPE_1" , complete_roster_pkg_report.AR_F_ADDRESS_GET_LINE_2(AR.PROJECT_ID,AR.EMPLOYEE_ID,4 ,TO_DATE(AAH.EFFECTIVE_DATE)) "Home_ADDRESS_TYPE_2" , complete_roster_pkg_report.AR_F_ADDRESS_GET_PHONE(AR.PROJECT_ID,AR.EMPLOYEE_ID,4 ,TO_DATE(AAH.EFFECTIVE_DATE)) "Home_Phone" , complete_roster_pkg_report.AR_F_ADDRESS_GET_CITY_TOWN(AR.PROJECT_ID,AR.EMPLOYEE_ID,4 ,TO_DATE(AAH.EFFECTIVE_DATE)) "Home_City_Town" , complete_roster_pkg_report.AR_F_ADDRESS_GET_COUNTRY_NAME(AR.PROJECT_ID,AR.EMPLOYEE_ID,4 ,TO_DATE(AAH.EFFECTIVE_DATE)) "Home_Country_Name" , complete_roster_pkg_report.AR_F_ADDRESS_GET_STATE_NAME(AR.PROJECT_ID,AR.EMPLOYEE_ID,4 ,TO_DATE(AAH.EFFECTIVE_DATE)) "Home_State_Name" , complete_roster_pkg_report.AR_F_ADDRESS_GET_ZIP_POSTAL(AR.PROJECT_ID,AR.EMPLOYEE_ID,4 ,TO_DATE(AAH.EFFECTIVE_DATE)) "Home_ZipCode" FROM AR_V_ROSTER AR
LEFT JOIN AR_V_ADDRESS_HISTORY AAH
ON
(AR.PROJECT_ID = AAH.PROJECT_ID AND
AR.EMPLOYEE_ID = AAH.EMPLOYEE_ID)
WHERE
UPPER(AR.USER_EMPLOYEE_ID) = ''Q766730'' AND
AR.PROJECT_ID = 81 ';
export_pkg_spread_sheet.download_excel(qry);
End;
Praveen you can pass your DB table query to check the error. I am trying to pass as mentioned above.
Please let me know if my question is not clear.
Thanks
Sudhir -
ORA-06502: PL/SQL: numeric or value error: Bulk Bind: Truncated Bind
Hi
I am getting this run time error ORA-06502: PL/SQL: numeric or value error: Bulk Bind: Truncated Bind in my pl/sql . I tried evrything , changing datatypes ,etc but still this error is coming .What can be the cause , please help.
declare
svid xxpor_utility.p_svid@sppmig1%type;
p_sv_id xxpor_utility.p_svid@sppmig1%type;
tab xxpor_utility.xxpor_indextab@sppmig1;
svid1 xxpor_utility.p_svid@sppmig1%type;
p_sv_id1 xxpor_utility.p_svid@sppmig1%type;
tab1 xxpor_utility.xxpor_indextab@sppmig1;
svid2 xxpor_utility.p_svid@sppmig1%type;
p_sv_id2 xxpor_utility.p_svid@sppmig1%type;
tab2 xxpor_utility.xxpor_indextab@sppmig1;
svid3 xxpor_utility.p_svid@sppmig1%type;
p_sv_id3 xxpor_utility.p_svid@sppmig1%type;
tab3 xxpor_utility.xxpor_indextab@sppmig1;
v_index t2_error_table.id_value%type;
v_code t2_error_table.error_code%type;
p_error varchar2(600);
k number(20):=0;
v_msg varchar2(2000);
v_commit_count number(10);
v_at_gpid varchar2(512);
v_at_oper varchar2(512);
v_sch varchar2(512);
v_vat varchar2(512);
exp exception;
exp1 exception;
exp2 exception;
exp3 exception;
exp4 exception;
v_pay varchar2(512);
v_res varchar2(512);
v_digit varchar2(512);
v_agree varchar2(512);
v_driver_licence PERSON_HISTORY.drivers_licence%TYPE;
v_cus_gen1 number(10);
v_cus_gen2 number(10);
v_cus_gen3 number(10);
svid_sr number(10);
v_social PERSON_HISTORY.social_security_number%TYPE;
CURSOR person_cur (p_person_id person_history.person_id%TYPE)
IS
SELECT drivers_licence ,social_security_number
FROM PERSON_HISTORY@SPPMIG1
WHERE PERSON_ID=p_person_id --p2(p).person_id
AND EFFECTIVE_START_DATE = (SELECT MAX(EFFECTIVE_START_DATE)
FROM PERSON_HISTORY@sppmig1
WHERE PERSON_ID=p_person_id);--p2(p).person_id) ;
--p number(20):=1;
--j number(20);
cursor c1 is
select * from cus_node_his ;
type temp_c1 is table of customer_node_history%rowtype
index by binary_integer;
t2 temp_c1;
type temp_c2 is table of customer_node_history@slpmig1%rowtype
index by binary_integer;
p2 temp_c2;
/*cursor c2(p_id customer_query.customer_node_id%type) is
select general_1,general_2,general_3
from customer_query@sppmig1 c where c.customer_query_type_id=10003 and
c.customer_node_id(+) =p_id
and c.open_date = (select
max(open_date) from customer_query@sppmig1 where customer_node_id=p_id
and customer_query_type_id=10003 and c.customer_query_id =(select max(customer_query_id) from customer_query@sppmig1
where customer_node_id=p_id and customer_query_type_id=10003));*/
procedure do_bulk_insert is
bulk_errors EXCEPTION;
PRAGMA EXCEPTION_INIT(bulk_errors, -24381);
begin
forall j in 1..t2.count SAVE EXCEPTIONS
insert into aaa values t2(j);
commit;
--t2.delete;
k:=0;
v_msg:=sqlerrm;
EXCEPTION WHEN bulk_errors THEN
FOR L IN 1..SQL%bulk_exceptions.count
LOOP
v_index := SQL%bulk_exceptions(L).ERROR_INDEX;
v_code := sqlerrm(-1 * SQL%bulk_exceptions(L).ERROR_CODE);
--v_index := SQL%bulk_exceptions(j).ERROR_INDEX;
--v_code := sqlerrm(-1 * SQL%bulk_exceptions(j).ERROR_CODE);
INSERT INTO t2_error_table
VALUES('CUSTOMER_NODE_HISTORY',
'CUSTOMER_NODE_ID',
v_msg,
t2(v_index).customer_node_id,
null,
'DO_BULK_INSERT',
v_code
commit;
END LOOP;
end do_bulk_insert;
begin
select value into v_at_gpid from t2_system_parameter@sppmig1 where name='atlanta_group_id';
select value into v_commit_count from t2_system_parameter@sppmig1 where name='batch_size';
select value into v_sch from t2_system_parameter@sppmig1 where name='schedule_id';
select value into v_pay from t2_system_parameter@sppmig1 where name='payment_location_code';
select value into v_at_oper from t2_system_parameter@sppmig1 where name='atlanta_operator_id';
select value into v_digit from t2_system_parameter@sppmig1 where name='digits_to_be_screened';
select value into v_res from t2_system_parameter@sppmig1 where name='responsible_agent';
select value into v_vat from t2_system_parameter@sppmig1 where name='vat_rate';
select value into v_agree from t2_system_parameter@sppmig1 where name='bank_agreement_status';
xxpor_utility.xxpor_loadmemory@sppmig1('CUSTOMER_NODE_HISTORY','CUSTOMER_NODE_TYPE_ID',tab);
xxpor_utility.xxpor_loadmemory@sppmig1('CUSTOMER_NODE_HISTORY','CREDIT_RATING_CODE',tab2);
xxpor_utility.xxpor_loadmemory@sppmig1('CUSTOMER_NODE_HISTORY','PAYMENT_METHOD_CODE',tab3);
xxpor_utility.xxpor_loadmemory@sppmig1('CUSTOMER_NODE_HISTORY','CUSTOMER_NODE_STATUS_CODE',tab1);
open c1;
loop
fetch c1 bulk collect into p2 limit v_commit_count;
for p in 1..p2.count loop
k:=K+1;
begin
xxpor_utility.xxpor_getsvid@sppmig1(p2(p).CUSTOMER_NODE_TYPE_ID,tab,svid);
p_sv_id:=svid;
xxpor_utility.xxpor_getsvid@sppmig1(p2(p).CUSTOMER_NODE_STATUS_CODE,tab1,svid1);
p_sv_id1 :=svid1;
xxpor_utility.xxpor_getsvid@sppmig1(p2(p).CREDIT_RATING_CODE,tab2,svid2);
p_sv_id2:=svid2;
xxpor_utility.xxpor_getsvid@sppmig1(p2(p).PAYMENT_METHOD_CODE,tab3,svid3);
p_sv_id3:=svid3;
OPEN person_cur (p2(p).person_id);
FETCH person_cur INTO v_driver_licence, v_social;
CLOSE person_cur;
--select social_security_number into v_social from person_history@sppmig1 where
--PERSON_ID=p2(p).person_id AND EFFECTIVE_START_DATE = (SELECT MAX(EFFECTIVE_START_DATE) FROM
--PERSON_HISTORY@sppmig1 WHERE PERSON_ID=p2(p).person_id) ;
/*open c2(p2(p).customer_node_id);
fetch c2 into v_cus_gen1, v_cus_gen2, v_cus_gen3;
close c2;
xxpor_utility.get_status_code@sppmig1(v_cus_gen1,v_cus_gen2,v_cus_gen3,svid_sr);*/
svid_sr:=2600000;
t2(k).CUSTOMER_NODE_ID := p2(p).CUSTOMER_NODE_ID;
t2(k).LAST_MODIFIED := p2(p).LAST_MODIFIED;
t2(k).EFFECTIVE_START_DATE := p2(p).EFFECTIVE_START_DATE;
t2(k).EFFECTIVE_END_DATE := p2(p).EFFECTIVE_END_DATE;
t2(k).CUSTOMER_NODE_TYPE_ID := p_sv_id;
if p_sv_id is null then
raise exp1;
end if;
t2(k).PRIMARY_IDENTIFIER := p2(p).PRIMARY_IDENTIFIER;
t2(k).PRIMARY_IDENTIFIER2 := p2(p).PRIMARY_IDENTIFIER2;
t2(k).NODE_NAME := p2(p).NODE_NAME ;
t2(k).NODE_NAME_UPPERCASE := p2(p).NODE_NAME_UPPERCASE ;
t2(k).NODE_NAME_SOUNDEX := p2(p).NODE_NAME_SOUNDEX;
t2(k).ATLANTA_GROUP_ID := v_at_gpid ;
t2(k).ATLANTA_OPERATOR_ID := p2(p).ATLANTA_OPERATOR_ID;
t2(k).GL_CODE_ID := p2(p).GL_CODE_ID;
t2(k).PARENT_CUSTOMER_NODE_ID := p2(p).PARENT_CUSTOMER_NODE_ID ;
t2(k).HIERARCHY_LEVEL := p2(p).HIERARCHY_LEVEL ;
t2(k).ROOT_CUSTOMER_NODE_ID := p2(p).ROOT_CUSTOMER_NODE_ID ;
t2(k).CUSTOMER_NODE_STATUS_CODE := p_sv_id1 ;
if p_sv_id1 is null then
raise exp2;
end if;
t2(k).CREATED_DATE := p2(p).CREATED_DATE;
t2(k).ACTIVE_DATE := p2(p).ACTIVE_DATE ;
t2(k).PERSON_ID := p2(p).PERSON_ID ;
t2(k).PRIME_ACCOUNT_ID := p2(p).PRIME_ACCOUNT_ID;
t2(k).REPORT_LEVEL_CODE := p2(p).REPORT_LEVEL_CODE;
t2(k).POSTAL_ADDRESS_ID := p2(p).POSTAL_ADDRESS_ID;
t2(k).SITE_ADDRESS_ID := p2(p).SITE_ADDRESS_ID ;
t2(k).CURRENCY_ID := p2(p).CURRENCY_ID;
t2(k).SCHEDULE_ID := v_sch;
t2(k).BILLING_PRIORITY := p2(p).BILLING_PRIORITY ;
t2(k).BILLING_COMPLEXITY:= p2(p).BILLING_COMPLEXITY ;
t2(k).BILLING_CONFIGURATION_CODE := p2(p).BILLING_CONFIGURATION_CODE;
t2(k).SUPPRESS_IND_CODE := p2(p).SUPPRESS_IND_CODE ;
t2(k).SUPPRESS_BILL_CYCLE_COUNT := p2(p).SUPPRESS_BILL_CYCLE_COUNT;
t2(k).SUPPRESS_UNTIL_ISSUE_DATE := p2(p).SUPPRESS_UNTIL_ISSUE_DATE;
t2(k).TURNOVER := p2(p).TURNOVER;
t2(k).TURNOVER_CURRENCY_ID := p2(p).TURNOVER_CURRENCY_ID ;
t2(k).CREDIT_LIMIT := p2(p).CREDIT_LIMIT ;
t2(k).CREDIT_LIMIT_CURRENCY_ID := p2(p).CREDIT_LIMIT_CURRENCY_ID;
t2(k).EXPECTED_REVENUE := p2(p).EXPECTED_REVENUE ;
t2(k).EXPECTED_REVENUE_CURRENCY_ID := p2(p).EXPECTED_REVENUE_CURRENCY_ID ;
t2(k).CREDIT_RATING_CODE := p_sv_id2 ;
-- if p_sv_id2 is null then
--raise exp3;
-- end if;
t2(k).CREDIT_COMMENTS := p2(p).CREDIT_COMMENTS ;
t2(k).TAX_CLASS_CODE := 1 ;
t2(k).PAYMENT_METHOD_CODE := p_sv_id3;
--if p_sv_id3 is null then
--raise exp4;
--end if;
t2(k).PAYMENT_LOCATION_CODE := v_pay ;
t2(k).BANK_CODE := NULL;
t2(k).BRANCH_CODE := NULL ;
t2(k).BANK_ACCOUNT_NAME := p2(p).NODE_NAME ;
t2(k).BANK_ACCOUNT_NUMBER := '1000000';
t2(k).BANK_ACCOUNT_REF := v_agree;
t2(k).CARD_TYPE_CODE := p2(p).CARD_TYPE_CODE ;
t2(k).CARD_NUMBER := p2(p).CARD_NUMBER ;
t2(k).CARD_EXPIRY_DATE := NULL ;
t2(k).ASSIGNED_OPERATOR_ID := NULL ;
t2(k).SALES_CHANNEL_CODE := 0;
t2(k).COMPANY_NUMBER := NULL;
t2(k).INDUSTRY_CODE := NULL;
t2(k).REGION_CODE := NULL;
t2(k).GENERAL_1 := v_vat ;
t2(k).GENERAL_2 := svid_sr ;
if svid_sr is null then
raise exp;
end if;
t2(k).GENERAL_3 := v_social ;
t2(k).GENERAL_4 := v_driver_licence ;
t2(k).GENERAL_5 := v_vat;
t2(k).GENERAL_6 := v_res;
t2(k).GENERAL_7 := null||':'||null||':'||'1000000'||':'||null||':'||null||':'||null||':';
t2(k).GENERAL_8 := '2' ;
t2(k).GENERAL_9 := v_digit;
t2(k).GENERAL_10 := p2(p).CUSTOMER_NODE_ID;
exception when exp then
p_error:= sqlerrm;
insert into t2_error_table values ( 'CUSTOMER_NODE_HISTORY','CUSTOMER_NODE_ID',p_error,p2(p).customer_node_id
,null,null,null);
commit;
when exp1 then
p_error:= sqlerrm;
insert into t2_error_table values ( 'CUSTOMER_NODE_HISTORY','CUSTOMER_NODE_ID',p_error,p2(p).customer_node_id
,null,null,'customer_node_type_id is null');
commit;
when exp2 then
p_error:= sqlerrm;
insert into t2_error_table values ( 'CUSTOMER_NODE_HISTORY','CUSTOMER_NODE_ID',p_error,p2(p).customer_node_id
,null,null,'customer_node_status_code is null');
commit;
/*when exp3 then
p_error:= sqlerrm;
insert into t2_error_table values ( 'CUSTOMER_NODE_HISTORY','CUSTOMER_NODE_ID',p_error,p2(p).customer_node_id
,null,null,'credit_rating_code is null');
commit;
when exp4 then
p_error:= sqlerrm;
insert into t2_error_table values ( 'CUSTOMER_NODE_HISTORY','CUSTOMER_NODE_ID',p_error,p2(p).customer_node_id
,null,null,null);
commit;*/
when others then
p_error:= sqlerrm;
insert into t2_error_table values ( 'CUSTOMER_NODE_HISTORY','CUSTOMER_NODE_ID',p_error,p2(p).customer_node_id
,null,null,null);
commit;
end;
if mod(k,v_commit_count)=0 then
do_bulk_insert;
t2.delete;
end if;
end loop;
do_bulk_insert;
exit when c1%notfound;
end loop;
t2.delete;
exception when others then
p_error:= sqlerrm;
insert into t2_error_table values ( 'CUSTOMER_NODE_HISTORY','CUSTOMER_NODE_ID',p_error,null
,null,null,null);
commit;
RAISE;
end;
/Hi there,
Following is the description of the error, you are getting.
ORA-06502:VALUE_ERROR
An arithmetic, conversion, truncation, or size-constraint error occurs. For example, when your program selects a column value into a character variable, if the value is longer than the declared length of the variable, PL/SQL aborts the assignment and raises VALUE_ERROR. In procedural statements, VALUE_ERROR is raised if the conversion of a character string into a number fails. (In SQL statements, INVALID_NUMBER is raised.)
Hopefully this will help. -
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). -
Difficulty in resolving ORA-06502: PL/SQL: numeric or value error:
Hi
I am having great difficulty to resolve the following error - ORA-06502: PL/SQL: numeric or value error: character string buffer too small . In my Oracle Package, I have a Function that returns a varchar(255).
My Function is basically as follows:
FUNCTION GetUserDept (DeptNum IN NUMBER) RETURN VARCHAR2
IS
deptname varchar(255);
BEGIN
SELECT name INTO deptname
FROM depts
where id = DeptNum;
RETURN deptname
END;
The SQL is running correctly and returns one result, which is what I want. However, when I call the function in my .NET C# code, this is when I am seeing the error message.
In my code, I said that the commandtype is a stored procedure, passed the parameters, and add it to to the parameters, with the return type and direction put first and executed as a scalar. The code executes, and then fails at the ExecuteScalar line, and it is at this point on my exception handler that I see the error message ORA-6502.
This really odd, because I have two other functions that return numbers, and I have executed them in the same way, and theses works!
I have checked my function and can't see what is wrong, and I have tried changing the return type from varchar2 to NVarchar on the return type, but this made no difference.
This problem has really dogged me for hours and I cannot see how to resolve it.
Can someone, please help me?user633278 wrote:
This really odd, because I have two other functions that return numbers, and I have executed them in the same way, and theses works!It is that very reason that your code fails. You need to declare the return variable as a string.
SQL?create or replace
FUNCTION GetUserDept (DeptNum IN NUMBER) RETURN VARCHAR2
IS
deptname varchar(255);
BEGIN
RETURN 'hello world';
END;
2 3 4 5 6 7 8 9 10
Function created.
SQL?
SQL?
declare
x number;
begin
x := GetUserDept(100);
end;
SQL? 2 3 4 5 6 declare
ERROR at line 1:
ORA-06502: PL/SQL: numeric or value error: character to number conversion error
ORA-06512: at line 4
SQL?
SQL?
declare
x varchar2(255);
begin
x := GetUserDept(100);
end;
SQL? 2 3 4 5 6
PL/SQL procedure successfully completed. -
ORA-06502: PL/SQL: numeric or value error(Run Time Error)
Hi,
Intially the table structure goes something like this.
CREATE TABLE CLARITY_RESPONSE_LOG
REQUEST_CODE NUMBER,
RESPONSE_FILE BLOB,
DATE_CRATED DATE NOT NULL,
CREATED_BY NUMBER NOT NULL,
UPDATED_BY NUMBER DEFAULT 1,
)The content of the RESPONSE_FILE column which is a BLOB data type has some XML content(XML file).
The compiled proc which uses the above table is as follows.
CREATE OR REPLACE PROCEDURE "MWF_ONLINE_RESPONSE_XML"
AS
v_file UTL_FILE.FILE_TYPE;
v_text VARCHAR2 (20);
v_filename VARCHAR2 (200);
v_delimitedchar CHAR (1);
----log
v_process_name VARCHAR2(100) := 'MWF_ONLINE_RESPONSE_XML';
v_sqlerrorcd VARCHAR2(10);
v_sqlerrormsg VARCHAR2(255);
v_seq_auto_email_job NUMBER;
v_cnt NUMBER := 0;
v_user_name VARCHAR2(30);
BEGIN
--- for log use
SELECT sys_context('USERENV','OS_USER') INTO v_user_name FROM dual;
INSERT INTO PROCESS_ERROR_LOG
(seq_num,
process_name,
status,
process_date,
user_name)
VALUES (seq_dataxprocesslog.NEXTVAL,
v_process_name,
'STA',
SYSDATE,
v_user_name);
v_delimitedchar := CHR (124);
v_filename := 'online_response_xml.txt';
v_file := UTL_FILE.FOPEN ('MWF_DATA_EXTRACTS', v_filename, 'W');
UTL_FILE.PUT_LINE
(v_file,
'online_response_xml'
FOR online_response IN
(SELECT XMLTYPE (response_file, NLS_CHARSET_ID ('char_cs')).getclobval () AS Online_Respone_xml
FROM CLARITY_RESPONSE_LOG
WHERE TRUNC(date_crated ) = TRUNC(SYSDATE-1)
LOOP
UTL_FILE.PUT_LINE (v_file, online_response.Online_Respone_xml);
v_cnt := v_cnt + 1;
END LOOP;
UTL_FILE.FCLOSE(v_file);
INSERT INTO PROCESS_ERROR_LOG
(seq_num,
process_name,
status,
process_date,
cnt,
user_name)
VALUES (seq_dataxprocesslog.NEXTVAL,
v_process_name,
'COM',
SYSDATE,
v_cnt,
v_user_name);
COMMIT;
EXCEPTION
WHEN OTHERS THEN
v_sqlerrorcd := SQLCODE;
v_sqlerrormsg := SUBSTR(SQLERRM,1,255);
INSERT INTO PROCESS_ERROR_LOG
(seq_num,
process_name,
status,
process_date,
error_msg,
error_id,
user_name)
VALUES (seq_dataxprocesslog.NEXTVAL,
v_process_name,
'ERR',
SYSDATE,
v_sqlerrormsg,
v_sqlerrorcd,
v_user_name);
COMMIT;
END;The above code has been compiled without any compilation errors but at run time I am getting the error:
ORA-06502: PL/SQL: numeric or value error.
Is it because of below statement in the above proc:
SELECT XMLTYPE (response_file, NLS_CHARSET_ID ('char_cs')).getclobval () AS Online_Respone_xml
FROM CLARITY_RESPONSE_LOG
WHERE TRUNC(date_crated ) = TRUNC(SYSDATE-1)Please advicevine wrote:
Is it because of below statement in the above proc:
SELECT XMLTYPE (response_file, NLS_CHARSET_ID ('char_cs')).getclobval () AS Online_Respone_xml
FROM CLARITY_RESPONSE_LOG
WHERE TRUNC(date_crated ) = TRUNC(SYSDATE-1)Please adviceto see where the line code that gets the error try using dbms_output.put_line() and before you run your procedure use the SQL*Plus command set serveroutput on. see this example below using the dbms_output.put_line().
CREATE OR REPLACE PROCEDURE "MWF_ONLINE_RESPONSE_XML" AS
v_file UTL_FILE.FILE_TYPE;
v_text VARCHAR2 (20);
v_filename VARCHAR2 (200);
v_delimitedchar CHAR (1);
----log
v_process_name VARCHAR2(100) := 'MWF_ONLINE_RESPONSE_XML';
v_sqlerrorcd VARCHAR2(10);
v_sqlerrormsg VARCHAR2(255);
v_seq_auto_email_job NUMBER;
v_cnt NUMBER := 0;
v_user_name VARCHAR2(30);
BEGIN
--- for log use
SELECT sys_context('USERENV','OS_USER') INTO v_user_name FROM dual;
dbms_output.put_line('1');
INSERT INTO PROCESS_ERROR_LOG
(seq_num,
process_name,
status,
process_date,
user_name)
VALUES (seq_dataxprocesslog.NEXTVAL,
v_process_name,
'STA',
SYSDATE,
v_user_name);
dbms_output.put_line('2');
v_delimitedchar := CHR (124);
v_filename := 'online_response_xml.txt';
v_file := UTL_FILE.FOPEN ('MWF_DATA_EXTRACTS', v_filename, 'W');
UTL_FILE.PUT_LINE(v_file,'online_response_xml');
dbms_output.put_line('3');
FOR online_response IN
(SELECT XMLTYPE (response_file, NLS_CHARSET_ID ('char_cs')).getclobval () AS Online_Respone_xml
FROM CLARITY_RESPONSE_LOG
WHERE TRUNC(date_crated ) = TRUNC(SYSDATE-1)) LOOP
UTL_FILE.PUT_LINE (v_file, online_response.Online_Respone_xml);
v_cnt := v_cnt + 1;
dbms_output.put_line('4');
END LOOP;
UTL_FILE.FCLOSE(v_file);
dbms_output.put_line('5');
INSERT INTO PROCESS_ERROR_LOG
(seq_num,
process_name,
status,
process_date,
cnt,
user_name)
VALUES (seq_dataxprocesslog.NEXTVAL,
v_process_name,
'COM',
SYSDATE,
v_cnt,
v_user_name);
COMMIT;
dbms_output.put_line('6');
EXCEPTION
WHEN OTHERS THEN
v_sqlerrorcd := SQLCODE;
v_sqlerrormsg := SUBSTR(SQLERRM,1,255);
INSERT INTO PROCESS_ERROR_LOG
(seq_num,
process_name,
status,
process_date,
error_msg,
error_id,
user_name)
VALUES (seq_dataxprocesslog.NEXTVAL,
v_process_name,
'ERR',
SYSDATE,
v_sqlerrormsg,
v_sqlerrorcd,
v_user_name);
COMMIT;
END; -
Error : ORA-06502: PL/SQL: numeric or value error while fetch LONG datatype
Hello All,
I have written a script to fetch the text for a view in PLSQL and it gives me the following error :
Error : ORA-06502: PL/SQL: numeric or value error
declare
l_text all_views.text%type;
begin
SELECT text INTO l_text FROM all_views WHERE view_name = 'XXVIEW';
exception
when others then
dbms_output.put_line('Error : '||sqlerrm);
end;
The above works for some views and not view other views. Can anyone let me know what could be the reason for ORA-06502 when fetching into a long variable in PLSQL.
Would appreciate any response.
Thanks,If view 'XXVIEW' contains "no record" for field "text" then it'll show this error.
I mean "SELECT text FROM all_views WHERE view_name = 'XXVIEW';" returns "No record found" then how can you assign "no record" to a variable "l_text ".
try to execute : SELECT text FROM all_views WHERE view_name = 'XXVIEW';
What does it give you? any "Blank records"?
Edited by: H. on Feb 20, 2009 8:17 AM -
"ORA-06502: PL/SQL: numeric or value error: invalid LOB locator specified: ORA-22275"
I use the procedure to convert the documents if it is not already converted before using procedure as follows
PROCEDURE "STARDOC"."HTMLOUTPUT" (
"DOCID" IN NUMBER) IS
mklob clob;
doccount number;
errorcode number;
errormessage varchar2(200);
BEGIN -- executable part starts here
SELECT COUNT(document_id) INTO doccount FROM docviewhtml where document_id=docid;
--dbms_output.put_line(doccount);
if doccount=0 then
dbms_output.put_line('Document Not Found: Converting '||docid);
--If document is not found run document coversion routine
ctx_doc.filter('idxdocuments',docid, mklob,FALSE);
INSERT INTO docviewhtml(document_id, html) VALUES (docid, mklob);
COMMIT;
elsif doccount=1 then
--return;
dbms_output.put_line('Document Found');
--if document id found then return the document content
null;
else
--dbms_output.put_line('Error occured');
--need to deal with duplicate documents
null;
end if;
dbms_lob.freetemporary(mklob);
EXCEPTION
--rollback when an exception occurs
WHEN OTHERS THEN
errorcode:=SQLCODE;
errormessage:=SQLERRM;
dbms_output.put_line(sqlcode || ':' ||sqlerrm);
ROLLBACK;
LOGERROR(errorcode,errormessage);
END "HTMLOUTPUT";
i get the error when i convert large documents
"ORA-06502: PL/SQL: numeric or value error: invalid LOB locator specified: ORA-22275"
what is wrong. please help!"ORA-06502: PL/SQL: numeric or value error: invalid
LOB locator specified: ORA-22275"
PROCEDURE "STARDOC"."HTMLOUTPUT" (
"DOCID" IN NUMBER) IS
mklob clob;
ctx_doc.filter('idxdocuments',docid, mklob,FALSE);
INSERT INTO docviewhtml(document_id, html) VALUES (docid, mklob);I think You forget to initialize variable mklob.
You can do it, assigning the empty_clob(). -
PL/SQL: numeric or value error: number precision too large
hi ,
i am running my script and getting this error. i created a object and and make table type on this with fraction of number(2,2). and in my script i am calling a standard API which have hour in number only .i am also using a custome table also which also having number(2,2). so plz help me to resoulve thsi error.
description below:
DECLARE
l_Return_Status VARCHAR2 (30):=NULL;
l_Msg_Count NUMBER :=0;
l_Msg_Data VARCHAR2 (2000) := NULL;
v_Sape_Sco_info_Tbl SAPE_SCO_INFO_TBL;
v_Sape_Sco_info_rec SAPE_SCO_INFO_REC;
p_assignment number:=165316; -----165688;
p_project_id number:=74538; -----81993;
sco_id number:=10371;
BEGIN
v_Sape_Sco_info_Tbl := SAPE_SCO_INFO_TBL();
v_Sape_Sco_info_rec := SAPE_SCO_INFO_REC(p_assignment,p_project_id,sco_id,'15-Oct-2009','31-Oct-2009',15.00,'17-Oct-2009','20-Oct-2009','ADD_EXISTING_RESOURCES',02.50,NULL,'Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
v_Sape_Sco_info_Tbl.EXTEND;
v_Sape_Sco_info_Tbl(1) := v_Sape_Sco_info_rec;
SAPE_UPDATE_SCO_DETAILS_PKG.SCO_ROLE_INCREASE(
x_project_id =>p_project_id,
x_Assignment_Id =>p_assignment,
l_Sape_Sco_info_Tbl => v_Sape_Sco_info_Tbl,
x_called_function =>'ADD_EXISTING_RESOURCES',
x_Return_Status =>l_Return_Status,
x_Msg_Count =>l_Msg_Count,
x_Msg_Data =>l_Msg_Data
dbms_output.put_line('second Procedure executed sucessesfuly');
dbms_output.put_line('l_Return_Status '||l_Return_Status||' l_Msg_Count '||l_Msg_Count||'l_Msg_Data');
dbms_output.put_line('value'||' '||v_Sape_Sco_info_Tbl(1).Assignment_Id);
dbms_output.put_line('completed');
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line(sqlerrm(sqlcode));
END;
error :PL/SQL: numeric or value error: number precision too large
CREATE OR REPLACE TYPE SAPE_PA.SAPE_SCO_INFO_TBL IS TABLE OF SAPE_SCO_INFO_REC;
Prompt OBJECT TYPE SAPE_PA.SAPE_SCO_INFO_REC
DROP TYPE SAPE_PA.SAPE_SCO_INFO_REC;
CREATE OR REPLACE TYPE SAPE_PA.SAPE_SCO_INFO_REC AS OBJECT
( Assignment_Id NUMBER,
project_id Number,
sco_id Number,
Role_START_DATE DATE,
Role_END_DATE DATE,
avg_hrs_per_day NUMBER(2,2),
sco_role_start_date DATE,
sco_role_end_date DATE,
sco_role_mode VARCHAR2(250),
sco_hrs_per_day NUMBER(2,2),
no_of_copies Number,
Active_Flag VARCHAR2(10),
BILLABLE_UPSIDE_INDICATIOR VARCHAR2(5),
RET_CODE VARCHAR2(5),
ERROR_MSG VARCHAR2(255),
ATTRIBUTE1 VARCHAR2(240),
ATTRIBUTE2 VARCHAR2(240),
ATTRIBUTE3 VARCHAR2(240),
ATTRIBUTE4 VARCHAR2(240),
NATTRIBUTE1 NUMBER,
NATTRIBUTE2 NUMBER
CREATE TABLE SAPE_PA.SAPE_SCO_STAFFING_MAPPINGS
( PROJECT_ID NUMBER,
SCO_ID NUMBER,
ASSIGNMENT_ID NUMBER PRIMARY KEY,
SCO_ROLE_START_DATE DATE,
SCO_ROLE_END_DATE DATE,
SCO_ROLE_HOURS NUMBER(2,2),
SCO_MODE VARCHAR2(80),
ACTIVE_FLAG VARCHAR2(5),
LAST_UPDATE_DATE DATE,
LAST_UPDATED_BY NUMBER(15,0),
CREATION_DATE DATE,
CREATED_BY NUMBER(15,0),
LAST_UPDATE_LOGIN NUMBER(15,0),
ATTRIBUTE1 VARCHAR2(240),
ATTRIBUTE2 VARCHAR2(240),
ATTRIBUTE3 VARCHAR2(240),
ATTRIBUTE4 VARCHAR2(240),
NATTRIBUTE1 NUMBER,
NATTRIBUTE2 NUMBER
)The problem here is with avg_hrs_per_day NUMBER(2,2)+ of SAPE_SCO_INFO_REC object.
user12226862 wrote:
CREATE OR REPLACE TYPE SAPE_PA.SAPE_SCO_INFO_REC AS OBJECT
( Assignment_Id NUMBER,
project_id Number,
sco_id Number,
Role_START_DATE DATE,
Role_END_DATE DATE,
avg_hrs_per_day NUMBER(2,2),
sco_role_start_date DATE,And while assigning the value it is:
user12226862 wrote:
v_Sape_Sco_info_rec := SAPE_SCO_INFO_REC(p_assignment,p_project_id,sco_id,'15-Oct-2009','31-
Oct-2009',15.00,'17-Oct-2009','20-
Oct-2009','ADD_EXISTING_RESOURCES',02.50,NULL,'Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);Note that number(2,2) means maximum total of digits in that case is 2 (including scale), not 4.
E.g.
SQL> declare
2 x number(2,2);
3 begin
4 x := 02.50;
5 end;
6 /
declare
ERROR at line 1:
ORA-06502: PL/SQL: numeric or value error: number precision too large
ORA-06512: at line 4However, this works:
SQL> declare
2 x number(2,2);
3 begin
4 x := .50;
5 end;
6 /
PL/SQL procedure successfully completed.Cheers,
AA
Maybe you are looking for
-
Can you only use a credit card to purchase products in the Appstore
Can you only use a credit card to purchase products in the Appstore?
-
how do I change the email address that I originally set iCloud up with? The email address no longer exists.
-
I have a G4 and a Macbook Pro laptop. I am trying to network the two computers so they can exchange files. They are already sharing a wireless cable internet connection via the router and airport. I need to be able to transfer/access the files on the
-
Hi all again, I am setting content-type in the header to "text/xml" yet when I do a POST sap sends as content-type "application/x-www-form-urlencoded". Is there something else I need to set to make it post with text/xml ? cl_http_client=>create_by
-
just got new ipohone 4s and used my wife's appleid to sync some apps. i now have my own appleid. i have logged in on my iphone but when i choose to update apps my wife's appleid is still there.