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 Bhat
I 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
Similar Messages
-
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
nullWe have fixed the problem !!! :-DDD
Thanks to all Oracle analysts who replied this issue.
aLeX
[email protected] -
OLAP -- ORA-6502: numeric or value error: character string buffer too small
Hi all,
We got installed Oracle 9201. After applying the patch #2761332 (to upgrade up to 9203)
and interim patch #2897078 (9203 Patch 1) we always get OLAP Catalog invalid.
I've tried to mend this problem by doing all it is said in Notes 23268.1 & 226443.1 but
my effort was worthless. OLAP catalog is still invalid though BI_Checkconfig says is okay at all.
Nevertheless, we can create dimensions, cubes and measures well, but other problem arises when
I try to add a dimension to a cube issuing the following command:
cwm2_olap_cube.add_dimension_to_cube( owner, NAME, owner, DIM_NAME);
ORA-06502: PL/SQL: numeric or value error: character string buffer too small
ORA-06512: at "OLAPSYS.CWM2_OLAP_MANAGER", line 380
ORA-06512: at "OLAPSYS.CWM2_OLAP_MANAGER", line 397
ORA-06512: at "OLAPSYS.CWM2_OLAP_CUBE", line 281
Paying attention to other metalink/otn threads about this subject we found similar problems with
Oracle 9203 in Japanese (keeping in mind we use Oracle in Spanish).
Any patch we can apply? Any ideas? Your comments are welcome ...
Thanks in advanced !!
[email protected]We have fixed the problem !!! :-DDD
Thanks to all Oracle analysts who replied this issue.
aLeX
[email protected] -
Getting error ora-6502- numeric or value error at line 11
declare
type idstab is table of employees.employee_id%type;
type nametab is table of employees.last_name%type;
ids idstab;
names nametab;
cursor c1 is select employee_id,last_name from employees where job_id='st_clerk';
begin
open c1;
fetch c1 bulk collect into ids,names;
close c1;
for i in ids.first..ids.last loop
if ids(i)>140 then
dbms_output.put_line(ids(i));
end if;
end loop;
for i in names.first..names.last loop
if names(i) like '%ma%' then
dbms_output.put_line(names(i));
end if;
end loop;
end;
/It fails because the range specified for the 'for' loop cannot contain null values. You would get the same error with this:
begin
for i in null..null loop -- 'i' cannot be null so this fails with value error
null;
end loop;
end;Try adding a test condition:
declare
type idstab is table of employees.employee_id%type;
type nametab is table of employees.last_name%type;
ids idstab;
names nametab;
cursor c1 is
select employee_id, last_name
from employees
where job_id = 'st_clerk';
begin
open c1;
fetch c1 bulk collect into ids, names;
close c1;
if ids.count > 0 then
for i in ids.first .. ids.last loop
if ids(i) > 140 then
dbms_output.put_line(ids(i));
end if;
end loop;
for i in names.first .. names.last loop
if names(i) like '%ma%' then
dbms_output.put_line(names(i));
end if;
end loop;
end if;
end; -
ORA-06502:Numeric or value error ORA-01403: No data found --6502
Dear All
I am using Forms 10g.
I am calling a report from my form.
but when i am calling then it is showing this error:
ORA-06502:Numeric or value error ORA-01403: No data found --6502
My code is in Print Button :
DECLARE
repid REPORT_OBJECT;
v_rep VARCHAR2(100);
rep_status VARCHAR2(20);
plid ParamList;
vParamValue number;
BEGIN
plid := Get_parameter_List('tmp');
IF NOT Id_Null(plid) THEN
Destroy_parameter_List( plid );
END IF;
plid := Create_parameter_List('tmp');
Add_Parameter(PLid, 'P_Block', Text_Parameter, :block_query.item_block);
Add_Parameter(PLid, 'P_Category', Text_Parameter, :block_query.item_category);
Add_Parameter(PLid, 'P_Dept', Text_Parameter, :block_query.item_dept);
Add_Parameter(PLid, 'P_sub_Category', Text_Parameter, :block_query.item_sub_category);
Add_Parameter(PLid, 'P_FLOOR', Text_Parameter, :block_query.item_floor);
Add_Parameter(PLid, 'P_IP', Text_Parameter, :block_query.item_ip);
Add_Parameter(PLid, 'P_Room', Text_Parameter, :block_query.item_room);
Add_Parameter(PLid, 'P_Userid', Text_Parameter, :block_query.item_usr_id);
Add_Parameter(PLid, 'PARAMFORM', Text_Parameter, 'NO');
repid := FIND_REPORT_OBJECT('rp_report');
SET_REPORT_OBJECT_PROPERTY(repid,REPORT_COMM_MODE,SYNCHRONOUS);
SET_REPORT_OBJECT_PROPERTY(repid,REPORT_DESTYPE,cache);
SET_REPORT_OBJECT_PROPERTY(repid,REPORT_DESFORMAT,'PDF');
SET_REPORT_OBJECT_PROPERTY(repid,REPORT_OTHER, 'paramform=no');
SET_REPORT_OBJECT_PROPERTY(repid,REPORT_SERVER,'rep_oracleapps_eHOpeAS');
v_rep := RUN_REPORT_OBJECT(repid,plid);
rep_status := REPORT_OBJECT_STATUS(v_rep);
WHILE rep_status in ('RUNNING','OPENING_REPORT','ENQUEUED')
LOOP
rep_status := report_object_status(v_rep);
END LOOP;
WEB.SHOW_DOCUMENT('/reports/rwservlet/getjobid'||substr(v_rep,instr(v_rep,'_',-1)+1)||'?
'||'server=rep_oracleapps_eHOpeAS');
Exception
When others then
message(Sqlerrm||'-'||sqlcode);
End;
Edited by: Sandip Mohapatra on Feb 8, 2010 12:44 AMhi
u can write for all no problem.
here is an example please modify it with u r requirements.
DECLARE
repid REPORT_OBJECT;
v_rep VARCHAR2(100);
rep_status VARCHAR2(20);
plid ParamList;
vParamValue number;
BEGIN
plid := Get_parameter_List('tmp');
IF NOT Id_Null(plid) THEN
Destroy_parameter_List( plid );
END IF;
plid := Create_parameter_List('tmp');
add_parameter(plid,'P_code',text_parameter,to_char(:hr.employee_code));
add_parameter(plid,'P_name',text_parameter,to_char(:hr.name));
add_parameter(plid,'P_fname',text_parameter,to_char(:hr.fname));
add_parameter(plid,'P_gender',text_parameter,to_char(:hr.gender));
add_parameter(plid,'P_married',text_parameter,to_char(:hr.marital_status));
add_parameter(plid,'P_job',text_parameter,to_char(:hr.job));
add_parameter(plid,'P_sal',text_parameter,to_char(:hr.sal));
add_parameter(plid,'P_dob',text_parameter,to_char(:hr.dob));
add_parameter(plid,'P_country',text_parameter,to_char(:hr.country));
add_parameter(plid,'P_nationality',text_parameter,to_char(:hr.nationality));
add_parameter(plid,'P_address',text_parameter,to_char(:hr.address));
add_parameter(plid,'p_imagecode',text_parameter,to_char(:images.employee_code));
Add_parameter(plid, 'PARAMFORM', TEXT_parameter, 'NO');
repid := FIND_REPORT_OBJECT('REPORT6');
SET_REPORT_OBJECT_PROPERTY(repid,REPORT_COMM_MODE,SYNCHRONOUS);
SET_REPORT_OBJECT_PROPERTY(repid,REPORT_DESTYPE,cache);
SET_REPORT_OBJECT_PROPERTY(repid,REPORT_DESFORMAT,'PDF');
SET_APPLICATION_PROPERTY(CURSOR_STYLE,'NORMAL');
SET_REPORT_OBJECT_PROPERTY(repid,REPORT_OTHER, 'paramform=no');
v_rep := RUN_REPORT_OBJECT(repid,plid);
rep_status := REPORT_OBJECT_STATUS(v_rep);
WHILE rep_status in ('RUNNING','OPENING_REPORT','ENQUEUED')
LOOP
rep_status := report_object_status(v_rep);
END LOOP;
/*Display report in the browser*/
WEB.SHOW_DOCUMENT('http://sarah:8890/reports/rwservlet/getjobid'||
substr(v_rep,instr(v_rep,'_',-1)+1)||'?'||'server=repserver&P_code='||:hr.employee_code||'&P_name'
||:hr.name ||'&P_fname'|| :hr.fname ||'&P_gender'||:hr.gender||'&P_married'||:hr.marital_status||'&P_job'||:hr.job||'&P_sal'||:hr.sal||'&P_dob'||:hr.dob||
'&p_country'||:hr.country||'&p_natioanlity'||:hr.nationality||'&p_address'||:hr.address||'&p_image'||:images.employee_code||'¶mform=no','_SELF');
END;sarah -
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 -
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 ? -
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
-
Error occurred during quick migration: ORA-06502: numeric or value error
I am very beginner on sql developer.I have a problem during a quick migration from mySQL db to Oracle DB as:
step1: captured model processed successful
step2: convered mode processed failed @ ORA-06502: numeric or value error
My work environment:
SQL Developer (2.1.1.64)
Java platform: 1.6.0
Oracle ide:2.1.1
Ojdbc5.jar
Oracle server ver. 9i
mySQL Datatype: datetime (default_value: 0000-00-00 00:00:00) ,float,varchar(100),int(11)
Please help me!
Thanks in advance!
Vien.kgronau wrote:
could you please log into MySQL using mysql-utility, then change to the db (use <your mysql db) and provide the output of
desc bars_eoptHi kgronau,
Thanks for your response. Below is the table "bars_eopt" description from MySQL db. (first row is a description) sorry about the display is not in line as typing.
Field Type Collation Null Key Default Extra Privileges Comment
Bar_Index int(11) NO PRI 0 select,insert,update,references
Recipe varchar(100) latin1_swedish_ci NO MUL select,insert,update,references
Date_Time datetime NO 0000-00-00 00:00:00 select,insert,update,references
ThresholdCurrent float NO 0 select,insert,update,references
SlopeEfficiency float NO 0 select,insert,update,references
Pmax float NO 0 select,insert,update,references
Voltage_at_Imax float NO 0 select,insert,update,references
SeriesResistance float NO 0 select,insert,update,references
PeakWavelength float NO 0 select,insert,update,references
FWHM float NO 0 select,insert,update,references
CentroidWavelength float NO 0 select,insert,update,references
Efficiency_at_Imax float NO 0 select,insert,update,references
ForwardVoltage float NO 0 select,insert,update,references
FW_90_Percent float NO 0 select,insert,update,references
Emitter_at_Ith float NO 0 select,insert,update,references
Emitter_at_Imax float NO 0 select,insert,update,references
Delta_Emitter float NO 0 select,insert,update,references
LOT_ID varchar(100) latin1_swedish_ci NO MUL select,insert,update,references
Part_Number varchar(100) latin1_swedish_ci NO MUL select,insert,update,references
Pak_Number int(11) NO 0 select,insert,update,references
Pak_Position int(11) NO 0 select,insert,update,references
Tracer int(11) NO 0 select,insert,update,references
OCR varchar(100) latin1_swedish_ci NO select,insert,update,references
Inspection_Result varchar(100) latin1_swedish_ci NO select,insert,update,references
Inspection_Defect varchar(100) latin1_swedish_ci NO select,insert,update,references
Facette varchar(1000) latin1_swedish_ci NO select,insert,update,references
Facette2 varchar(1000) latin1_swedish_ci NO select,insert,update,references
Upside varchar(1000) latin1_swedish_ci NO select,insert,update,references
Downside varchar(1000) latin1_swedish_ci NO select,insert,update,references
Thanks again and Best Regards,
Vien.T -
Ora-06502 numeric or value error --urgent
Hai ALL,
In our Application some fields are blank and gives an error 'ora-06502 numeric or value error'. The blanked Fields are taken from another server. Before the error some os booting problem arises and reboot the server. no oracle maintanace and software maintanace done this place. the network connectivity is ok. How the oracle error comes? how to rectify ..please help.. Oracle version is 7..and an urgent matter.
ShijuHi Orashiju,
ORA-06502: PL/SQL: numeric or value error string
Cause: An arithmetic, numeric, string, conversion, or constraint error occurred. For example, this error occurs if an attempt is made to assign the value NULL to a variable declared NOT NULL, or if an attempt is made to assign an integer larger than 99 to a variable declared NUMBER(2).
Action: Change the data, how it is manipulated, or how it is declared so that values do not violate constraints.
For more use this link. I am certain you will get an solution.
http://ora-06502.ora-code.com/
Thanks
Shivank -
ORA - 06502 NUMERIC OR VALUE ERROR
Hi,
When i try to compile my below code am getting NUMERIC OR VALUE ERROR.
Here is my code :
CREATE OR REPLACE PACKAGE SendMailJPkg AS
-- EOL is used to separate text line in the message body
EOL CONSTANT STRING(2) := CHR(13) || CHR(10);
TYPE ATTACHMENTS_LIST IS TABLE OF VARCHAR2(4000);
-- High-level interface with collections
FUNCTION SendMail(SMTPServerName IN STRING,
Sender IN STRING,
Recipient IN STRING,
CcRecipient IN STRING DEFAULT '',
BccRecipient IN STRING DEFAULT '',
Subject IN STRING DEFAULT '',
Body IN STRING DEFAULT '',
ErrorMessage OUT STRING,
Attachments IN ATTACHMENTS_LIST DEFAULT NULL) RETURN NUMBER;
END SendMailJPkg;
CREATE OR REPLACE PACKAGE BODY SendMailJPkg AS
PROCEDURE ParseAttachment(Attachments IN ATTACHMENTS_LIST,
AttachmentList OUT VARCHAR2) IS
AttachmentSeparator CONSTANT VARCHAR2(12) := '///';
BEGIN
-- Boolean short-circuit is used here
IF Attachments IS NOT NULL AND Attachments.COUNT > 0 THEN
AttachmentList := Attachments(Attachments.FIRST);
-- Scan the collection, skip first element since it has been
-- already processed;
-- accommodate for sparse collections;
FOR I IN Attachments.NEXT(Attachments.FIRST) .. Attachments.LAST LOOP
AttachmentList := AttachmentList || AttachmentSeparator || Attachments(I);
END LOOP;
ELSE
AttachmentList := '';
END IF;
END ParseAttachment;
-- Forward declaration
FUNCTION JSendMail(SMTPServerName IN STRING,
Sender IN STRING,
Recipient IN STRING,
CcRecipient IN STRING,
BccRecipient IN STRING,
Subject IN STRING,
Body IN STRING,
ErrorMessage OUT STRING,
Attachments IN STRING) RETURN NUMBER;
-- High-level interface with collections
FUNCTION SendMail(SMTPServerName IN STRING,
Sender IN STRING,
Recipient IN STRING,
CcRecipient IN STRING,
BccRecipient IN STRING,
Subject IN STRING,
Body IN STRING,
ErrorMessage OUT STRING,
Attachments IN ATTACHMENTS_LIST) RETURN NUMBER IS
AttachmentList VARCHAR2(4000) := '';
AttachmentTypeList VARCHAR2(2000) := '';
BEGIN
ParseAttachment(Attachments,AttachmentList);
RETURN JSendMail(SMTPServerName,
Sender,
Recipient,
CcRecipient,
BccRecipient,
Subject,
Body,
ErrorMessage,
AttachmentList);
END SendMail;
-- JSendMail's body is the java function SendMail.Send()
-- thus, no PL/SQL implementation is needed
FUNCTION JSendMail(SMTPServerName IN STRING,
Sender IN STRING,
Recipient IN STRING,
CcRecipient IN STRING,
BccRecipient IN STRING,
Subject IN STRING,
Body IN STRING,
ErrorMessage OUT STRING,
Attachments IN STRING) RETURN NUMBER IS
LANGUAGE JAVA
NAME 'SendMail.Send(java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String[],
java.lang.String) return int';
END SendMailJPkg;
var ErrorMessage VARCHAR2(4000);
var ErrorStatus NUMBER;
-- enable SQL*PLUS output;
SET SERVEROUTPUT ON
-- redirect java output into SQL*PLUS buffer;
exec dbms_java.set_output(5000);
BEGIN
:ErrorStatus := SendMailJPkg.SendMail(
SMTPServerName => 'localhost',
Sender => '[email protected]',
Recipient => '[email protected]',
CcRecipient => '',
BccRecipient => '',
Subject => 'This is the subject line: Test JavaMail',
Body => 'This is the body: Hello, this is a test' ||
SendMailJPkg.EOL || 'that spans 2 lines',
ErrorMessage => :ErrorMessage,
Attachments => SendMailJPkg.ATTACHMENTS_LIST(
'C:\Users\Zahn\Work\sendmail.sql',
'C:\Users\Zahn\Work\ferien-2002.txt'
END;
Can any one please suggest me how to over come this problem ???
Regards,
BharathRaunaq wrote:
This error generally comes , when you try to assign a non-numeric value to a numeric variable
ORA-06502: PL/SQL: numeric or value error Occur's at various instance. The second part of the message exactly stats the reason for this error. Here are few examples.
SQL> declare
2 v number(2);
3 begin
4 v := 123;
5 end;
6 /
declare
ERROR at line 1:
ORA-06502: PL/SQL: numeric or value error: number precision too large
ORA-06512: at line 4
SQL> declare
2 v number(2);
3 begin
4 v:= 'a';
5 end;
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> declare
2 v varchar2(1);
3 begin
4 v := 'ab';
5 end;
6 /
declare
ERROR at line 1:
ORA-06502: PL/SQL: numeric or value error: character string buffer too small
ORA-06512: at line 4
SQL> -
ORA-06502: numeric or value error: character string buffer too small
I have a stored proc with a parameter pio_med_rec_nbr patient.med_rec_nbr%TYPE
where patient.med_rec_nbr is a varchar2(12) .
character set is we8mswin1252 semantics are bytes
the stored proc retrieves max(med_rec_nbr) into nTmp( number) from a reference table
and does pio_med_rec_nbr := lpad(TO_CHAR(nTmp),12,'0')
which throws the ORA-06502: PL/SQL: numeric or value error: character string buffer too smallwhen I check the length, I get length(pio_med_rec_nbr) = 12
I can pass one digit or null but no more. Any idea what I need to do to debug this? I can do xxtmp := lpad(TO_CHAR(nTmp),12,'0') where xxtmp varchar2(255), so I know the assignments are okay.
Thanks,Do, pio_med_rec_nbr := trim(lpad(TO_CHAR(nTmp),12,'0') )
-
ORA-06502: numeric or value error: character to number conversion error
I met the following error when I ran Donald's PL/SQL function to_number_or_null. Could somebody here help me find the resolution? Thanks!
SQL> create or replace FUNCTION to_number_or_null (
2 aiv_number in varchar2 )
3 return number is
4 /*
5 to_number_or_null.fun
6 by Donald J. Bales on 12/15/2006
7 An errorless to_number( ) method
8 */
9 begin
10 return to_number(aiv_number);
11 exception
12 when INVALID_NUMBER then
13 return NULL;
14 end to_number_or_null;
15 /
Function created.
SQL> select to_number_or_null('A') from dual;
select to_number_or_null('A') from dual
ERROR at line 1:
ORA-06502: PL/SQL: numeric or value error: character to number conversion error
ORA-06512: at "CAROL.TO_NUMBER_OR_NULL", line 10Only INVALID_NUMBER exception is handled and also VALUE_ERROR should be handeled. You can resolve it by handling VALUE_ERROR exception or by adding WHEN OTHERS as I did in following example.
SQL> create or replace FUNCTION to_number_or_null (
2 aiv_number in varchar2 )
3 return number is
4 /*
5 to_number_or_null.fun
6 by Donald J. Bales on 12/15/2006
7 An errorless to_number( ) method
8 */
9 begin
10 return to_number(aiv_number);
11 exception
12 when INVALID_NUMBER then
13 return NULL;
14 when OTHERS then
15 return null;
16 end to_number_or_null;
17 /
Function created.
SQL> select to_number_or_null('A') from dual;
TO_NUMBER_OR_NULL('A')
----------------------With kind regards
Krystian Zieja -
I need help with error ORA-06502: numeric or value error
Hi, all, i need help finding the error here, im getting a numeric or value error when i add information to the variable vlcadena when vlcadena is a clob type, and i check the length of the vlcadena variable and sometimes makes the error at 8000 characters some other times 32k i have no idea whats happening, does anyone have a clue?
PROCEDURE REGISTRO_551 (
VPNUMPARTE IN PARTESC.NUMPARTE%TYPE,
VPFRACCION IN IMPOMAT.FRACCIONMEXIMPO%TYPE,
VPDESCRIPCION IN PARTESC.DESCESPANOL%TYPE,
VPVALORDLS IN IMPOMAT.VALORDOLARES%TYPE,
VPCANTIDAD IN IMPOMAT.CANTIDAD%TYPE,
VPUNIMED IN PARTESC.UNIMEDPARTE%TYPE,
VPCANTIDADTARIFA IN IMPOMAT.CANTIDAD%TYPE,
VPVALORAGREGADO IN EXPOPT.VALORAGREGADO%TYPE,
VPPAISORIGEN IN PARTESC.PAISORIGEN%TYPE,
VPCOMPVEND IN PARTESC.PAISORIGEN%TYPE,
VPTIPOFRACCION IN IMPOMAT.TIPOFRACCION%TYPE,
VPPESONETO IN IMPOMAT.PESONETO%TYPE,
VPTIPOMONEDA IN MIMPOMAT.TIPOMONEDAEXTRANJERA%TYPE
) AS
BEGIN
vgproceso := 207310;
vllong2:=length(vlCadena);
vlCadena:=vlCadena||'551'||'|'; --1. TIPO DE REGISTRO
vgproceso := 207311;
vllong2:=length(vlCadena);
vlCadena:=vlCadena||VPFRACCION||'|'; --2. FRACCION
vgproceso := 207312;
vllong2:=length(vlCadena);
QUITA_ENTERS(NVL(VPDESCRIPCION,' '),VLTEMP);
IF LENGTH(VLTEMP)>80 THEN
VLTEMP:=SUBSTR(VLTEMP,1,80);
END IF;
vgproceso := 207313;
vllong2:=length(vlCadena);
IF VLTEMP IS NULL THEN
vlCadena:=vlCadena||'|'; --3. DESCRIPCION
ELSE
vlCadena:=vlCadena||VLTEMP||'|'; --3. DESCRIPCION
END IF;
vgproceso := 207314;
vllong2:=length(vlCadena);
IF VPNUMPARTE IS NULL THEN
vlCadena:=vlCadena||'|';--4. NO. DE PARTE
ELSE
vlCadena:=vlCadena||VPNUMPARTE||'|';--4. NO. DE PARTE
END IF;
vgproceso := 207315;
vllong2:=length(vlCadena);
vlCadena:=vlCadena||VPVALORDLS||'|'; --5. VALOR MERCANCIA
vgproceso := 207316;
vllong2:=length(vlCadena);
vlCadena:=vlCadena||VPCANTIDAD||'|'; --6. CANTIDAD COMERCIAL
vgproceso := 207317;
vllong2:=length(vlCadena);
IF VPUNIMED IS NULL THEN
VPDESCERROR:='ALGUNA PARTIDA CON FRACCION '||VPFRACCION||' NO TIENE UNIDAD DE MEDIDA';
END IF;
vgproceso := 207320;
GET_CATGRAL('ADUANAS','UNIMED',NVL(VPUNIMED,' '),CL_D1,CL_D2,CL_D3,CL_D4,CL_V1,CL_V2,CL_V3,CL_CATG);
IF CL_V2=0 THEN
vlCadena:=vlCadena||VPUNIMED||'|'; --7. UNIDAD MEDIDA COMERCIAL
ELSE
SELECT TO_CHAR(TRUNC(CL_V2)) INTO VLUMCOMERCIAL FROM DUAL;
IF LENGTH(VLUMCOMERCIAL)=1 THEN
VLUMCOMERCIAL:='0'||VLUMCOMERCIAL;
END IF;
vlCadena:=vlCadena||VLUMCOMERCIAL||'|'; --7. UNIDAD MEDIDA COMERCIAL
END IF;
vlCadena:=vlCadena||VPCANTIDADTARIFA||'|';--8. CANTIDAD TARIFA
vlCadena:=vlCadena||VPVALORAGREGADO||'|';--9. VALOR AGREGADO
GET_CATGRAL('ADUANAS','CONFADU','IVIN-REG',CL_D1,CL_D2,CL_D3,CL_D4,CL_V1,CL_V2,CL_V3,CL_CATG);
vlCadena:=vlCadena||CL_D1||'|'; --10. VINCULACION
vlCadena:=vlCadena||CL_D2||'|'; --11. METODO DE VALORACION
vlCadena:=vlCadena||'|'; --12. MARCA
vlCadena:=vlCadena||'|'; --13. MODELOIf the expected maximum length of the concatenated string is less than 32K, then use VARCHAR2 and at the end convert to CLOB if necesary.
:p
PS: At what line in the code does it give the error?
Edited by: LKBrwn_DBA on Aug 20, 2009 2:49 PM -
ORA-06502:numeric or value errORA-04088: error during execution of trigger
I received the following error message while entering a number within the maximum value (i.e. 9,999,999.) allowed in a data entry form which is separate from the base form:
ORA-06502: PL/SQL: numeric or value error:number precision too large ORA-06512:at "<Owner>.<Trigger>", line 194 ORA-04088: error during execution of trigger "<Owner>.<Trigger>"
Where <Owner> is the schema name and <Trigger> is the trigger name. The data block of the entry form is based on a database table, and the sum of all values entered (w/ a maximum value of 99,999,999.) is displayed in the base form. A grand total of this sum along w/ other totals on the base form is also displayed w/ a maximum value defined as 999,999,999. I only receive the above error message when the grand total is greater than 99,999,999. If the grand total is less than or equal to 99,999,999, the base form works fine. Why????
I have verified all the attributes for the database columns and form fields and all seems to be okay, and I am running out of my wits. I am desperately in need of your help in resolving this issue soon because pressure is on...
Thanks in advance for any/all the help.Orchid wrote:
I received the following error message while entering a number within the maximum value (i.e. 9,999,999.) allowed in a data entry form which is separate from the base form:
ORA-06502: PL/SQL: numeric or value error:number precision too large ORA-06512:at "<Owner>.<Trigger>", line 194 ORA-04088: error during execution of trigger "<Owner>.<Trigger>"
Where <Owner> is the schema name and <Trigger> is the trigger name. The data block of the entry form is based on a database table, and the sum of all values entered (w/ a maximum value of 99,999,999.) is displayed in the base form. A grand total of this sum along w/ other totals on the base form is also displayed w/ a maximum value defined as 999,999,999. I only receive the above error message when the grand total is greater than 99,999,999. If the grand total is less than or equal to 99,999,999, the base form works fine. Why????
I have verified all the attributes for the database columns and form fields and all seems to be okay, and I am running out of my wits. I am desperately in need of your help in resolving this issue soon because pressure is on...
Thanks in advance for any/all the help.check your associated database column length. It's precision is not able to hold you said value. increase the length by
ALTER TABLE table_name
MODIFY (column_name NUMBER(20) );it's above solution don't work. Then, probably you use variable in the trigger code which hold the vale and it's size is limited. increase it.
added
try this
increase the length of TAB_S_TOT_COST 9 to 18.
and your problem will solved.
Hamid
Edited by: HamidHelal on Feb 13, 2013 10:28 AM
Maybe you are looking for
-
How to change airport settings in safe boot mode ?
At the moment my new macmini boots only in safe mode. I think its because of a faulty airport. Unfortunately, the safe mode does not offer a GUI for disabling airport for normal boot. The Apple Support page says "2. Remove the AirPort Extreme Card" b
-
Copy and paste text from pdf tablet to indesign cc 9.1
Is it poosible to copy/paste from a PDF (created from an exel-fil) into an inDesign-dokument without getting all the tekst into the first cell?? (Paste without formatting is not avaible)
-
HT4993 my phone wont connect to itunes so i can restore it
My phone won't connect
-
ThinkPad USB Keyboard with TrackPoint (55Y9053 ) scrolling problems
Hello, After typing on a Thinkpad keyboard for over 8 years at home, I decided it was time to get one to use at the office. I found the 55Y9053 at a local reseller and have been waiting very anxious to get my hands on it. However my enthousiasm for
-
I want to burn an MP3 disc of my purchases for my car but it will not let. Do I need to deauthorize or something? I tried that and it did nothing. If you cant do this then think might start buying real cds again.thanks in advance folks