Quote Form: Repeatively Query gives Error:ORA-06502: PLSQL numeric or value

Hi,
I am trying to query the sales order form (in Order Management) with the order number.
Steps to Reporduce:
Without closing the sales order form, query the same/different order number repetively again and again (upto 30 times) in sales order form and i am getting the following error. It might be due to the form buffer error i think, but i want to know how to resolve this issue.
ORA-06502 : PLSQL : numeric or value error
I have suggested the workaround as closing the form after querying every 15 times, but the customer needs a permanent fix by querying continously without closing the form, they want to query the record. Please suggest how to resolve this issue.
Thanks

The errors comes when in variable or fields data is coming more than the maximum length it.
e.g
declare
vcheck varchar2(1) := 'ABC'; ---Errorplz share your code where you feel the problem might occurring usually POST-QUERY trigger.
Baig,
http://baigsorcl.blogspot.com

Similar Messages

  • Poltergeist in my code?... ORA-06502: PLSQL: Numeric or value error

    Hi all!
    I am experiencing a very strange problem,
    i have the following code:
    BEGIN
    INSERT INTO BD_SESSION_GROUP
    (CDSESION, NM_ANO, CD_CENTRO, CDGRUPO, FCSESION, ITREALIZADA)
    VALUES (:DATOS.CDSESION,
    :GLOBAL.CURSO_ACADEMICO,
    :GLOBAL.COD_CENTRO,
    :DATOS.CDGRUPO,
    :DATOS.FECHA_EVAL,
    REALIZADA
    EXCEPTION
    WHEN DUP_VAL_ON_INDEX THEN
    BEGIN
         message('*1');
         message('*2');
         message('*3');          
    UPDATE BD_SESSION_GROUP
    SET ITREALIZADA = REALIZADA,
    FCSESION = :DATOS.FECHA_EVAL
    WHERE NM_ANO = :GLOBAL.CURSO_ACADEMICO
    AND CDSESION = :DATOS.CDSESION
    AND CD_CENTRO = :GLOBAL.COD_CENTRO
    AND CDGRUPO = :DATOS.CDGRUPO;
    -- GO_ITEM('DATOS.IMPRIMIR');
    EXCEPTION
    WHEN OTHERS THEN
    MENSAJE (SQLERRM || ' No se ha Podido Actualizar BD_SESSION_GROUP');
    END;
    WHEN OTHERS THEN
    MENSAJE (SQLERRM || ' No se ha Podido Insertar en BD_SESSION_GROUP');
    END;
    I have checked that it enters in the WHEN DUP_VAL_ON_INDEX exception, and it shows the code
    message('*1') and then message('*2');
    this is correct, but the problem is that it doesn't show message('*3');
    In fact, it shows the error "ORA-06502: PLSQL: Numeric or value error".
    And more, i have checked that it doesn't matter what code you put above UPDATE BD_SESSION_GROUP...
    it always crashes with the same error...
    it don't really know what to do, because i have tryied using synchronize...
    If someone can help me, it would be very apreciated,
    thx in advance!!!

    Given the message procedure and the mention of "synchronize" I'm assuming this is code from an Oracle Form. You might want to post this in the Forms forum as it could be more of a Forms question than a PL/SQL question.
    Where are you seeing the error? On the message line? Do you have ON-MESSAGE or ON-ERROR triggers?

  • ORA-06502 PLSQL Numeric or value error character string buffer too small

    Hi
    Gurus help!!
    I received error message "ORA-06502: PL/SQL:Numeric or value error: character strong buffer too small." I use example code of "AJAX Get Multiple Values Tabular I" from Denes Kubicek http://apex.oracle.com/pls/otn/f?p=31517:239.
    I did
    1) create an application process on demand (set_multi_items_tabular)
    2) create two application items (temporary_application_item and t_rownum)
    3) create a report page (I assume) and put the below into the page header
    <script language="JavaScript" type="text/javascript">
    function f_set_multi_items_tabular(pValue, pRow){
    var get = new htmldb_Get(null,html_GetElement('pFlowId').value,
    'APPLICATION_PROCESS=Set_Multi_Items_Tabular',0);
    if(pValue){
    get.add('TEMPORARY_APPLICATION_ITEM',pValue)
    get.add('T_ROWNUM',pRow)
    }else{
    get.add('TEMPORARY_APPLICATION_ITEM','null')
    gReturn = get.get('XML');
    if(gReturn){
    var l_Count = gReturn.getElementsByTagName("item").length;
    for(var i = 0;i<l_Count;i++){
    var l_Opt_Xml = gReturn.getElementsByTagName("item");
    var l_ID = l_Opt_Xml.getAttribute('id');
    var l_El = html_GetElement(l_ID);
    if(l_Opt_Xml.firstChild){
    var l_Value = l_Opt_Xml.firstChild.nodeValue;
    }else{
    var l_Value = '';
    if(l_El){
    if(l_El.tagName == 'INPUT'){
    l_El.value = l_Value;
    }else if(l_El.tagName == 'SPAN' && l_El.className == 'grabber'){
    l_El.parentNode.innerHTML = l_Value;
    l_El.parentNode.id = l_ID;
    }else{
    l_El.innerHTML = l_Value;
    get = null;
    </script>
    4) Report Query is
    SELECT apex_item.select_list_from_query
    (31,
    NULL,
    'SELECT FIRST_NAME d, ' || 'EMPLOYEE_ID r FROM EMPLOYEES',
    'style="width:250px" '
    || 'onchange="f_set_multi_items_tabular(this.value,''#ROWNUM#'''
    || ')"',
    'YES',
    '0',
    '- Select FIRST NAME -',
    'f31_' || '#ROWNUM#',
    NULL,
    'NO'
    ) BOOK,
    apex_item.text (32,
    NULL,
    80,
    100,
    'style="width:190px" ',
    'f32_' || '#ROWNUM#'
    ) FIRST_NAME,
    apex_item.text (33,
    NULL,
    80,
    100,
    'style="width:190px" ',
    'f33_' || '#ROWNUM#'
    ) LAST_NAME,
    apex_item.text (34,
    NULL,
    80,
    100,
    'style="width:190px" ',
    'f33_' || '#ROWNUM#'
    ) EMAIL,
    FROM EMPLOYEES
    I did modify Denes' code from table: my_book_store and columns: subject, price, author to match my sample table: EMPLOYEES and columns: FIRST_NAME, LAST_NAME, and EMAIL.
    Am I missing some steps? Please advise and thank you in advance.
    Candice

    Stupid me!! The size of select list is too big. After I delete some record from the table, that programs. Thanks for Denes Kubicek. I guess there is limitation of select list in Apex.
    Candice

  • Error ORA-06502: FROM forms

    I have medical application developed by forms 9i, But its responds error
    ORA-06502 while running a form with enter query mode. it displys the said
    error while execute the query . I dont the exeact SQL query returns this error. How to debug this? Is there any way how to find the sql text returns this error. Kinldy note that, I dont have the forms source code. Only executable available(fmx). I have TOAD too. can i use the toad to traceout it.
    thanks.

    Its an application error.If you don't have the source code,you need to ask for the source code.

  • Report error:ORA-06502: PL/SQL: numeric or value error: character string bu

    We face the above error in HTMLDB (APEX) application Ver 3.1.0. This occurs when we try to display more number of rows/records in drop-down list (LOV in tabular forms). We are able to display 200 records in LOV. When the list of records exceeds 230, we face the below error
    report error:ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    the values listed in LOV are from tables (one of the columns in table)
    Could anyone give us a solution?

    Hi
    As you are using a tabular form, you could actually do the following:
    1 - In the tabular form column's attributes, set the following:
    Display as: Select List (query based on LOV)
    Display extra values: Yes
    List of values definition: SELECT null d, null r FROM DUAL
    2 - Add a new page item and set it to generate your select list
    3 - Create an HTML region with no template and use the following for its source:
    &lt;script type="text/javascript"&gt;
    function loadList(c, l)
    var s = document.getElementsByName(c);
    var lItem = document.getElementById(l);
    var lLength = lItem.options.length;
    var k;
    var j;
    var x = lItem.innerHTML;
    var v;
    var o;
    var z;
    for (k = 0; k &lt; s.length; k++)
    z = s[k];
    v = z.value;
    z.options.length = 0;
    for (j = 0; j &lt; lLength; j++)
    o = new Option()
    o.value = lItem[j].value;
    o.text = lItem[j].text;
    z.options[j] = o;
    z.value = v;
    if (z.selectedIndex == -1)
    z.selectedIndex = 0;
    loadList("f05", "P1_MGR");
    &lt;/script&gt;
    (Change "f05" and "P1_MGR" as appropriate to your column and your new page item respectively)
    Now, when you load the page, the select list contains a null entry plus the entry already on the database. The javascript kicks in automatically, loops through every entry in the "f05" column, copies the existing value, replaces the select list with the new page item version and sets its value to the copied value.
    Your new page item could be in a DIV tag that has a style of "display:none" to hide it from view.
    Andy

  • Import Export Error (ORA-06502)

    All,
    We are trying to migrate the code from windows 2000 HTMLDB 1.5.0.00.33 to solaris 9 HTMLDB 1.5.0.00.33 by using the export/import function. After migration, one report went wrong with the following message.
    report error:
    ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    The tables definition are identical and there's no data in the production table. When we try to reduce the query length from 3000 to 2500 characters, the error message disappears on production.
    Is there any HTMLDB global variable controls the maximum length of the report "region source"?
    Any response would be appreciate.
    Thanks,
    Tony
    ===========================================
    PS: Here's our query:
    select
    x.supreq_id,
    DECODE(x.pk, null, 'Add new record:', ''||'<img src="#IMAGE_PREFIX#edit.gif" border="0" alt="Edit Icon">') edit,
    x.pk,
    x.request,
    x.subject,
    x.severity,
    x.priority,
    x.status,
    x.request_type,
    x.response,
    x.username,
    x.created_date,
    x.note,
    x.cks
    from (
    select
    htmldb_item.hidden(1,supreq_id) supreq_id,
    supreq_id edit,
    supreq_id pk,
    htmldb_item.text(3, request,'','','onFocus="javascript:window.status=this.value" onBlur="javascript:window.status=''Done''"') request,
    htmldb_item.select_list_from_lov(4,subject,'REQUEST_SUBJECT','','NO') subject,
    htmldb_item.select_list(5, severity, '3,2,1', 'style="width:40px"','NO') severity,
    htmldb_item.select_list_from_lov(6,priority,'REQUEST_PRIORITY','','NO') priority,
    htmldb_item.select_list_from_lov(7,status,'REQUEST_STATUS','','NO') status,
    htmldb_item.select_list_from_lov(8, request_type, 'SUPPORT_REQUEST_TYPE','', 'NO') request_type,
    htmldb_item.text(9, response,'','','onFocus=javascript:window.status=this.value;') response,
    htmldb_item.select_list_from_lov(10, username, 'USER_EMPLOYEE', 'style="width:100px"','NO') username,
    htmldb_item.date_popup(11, rownum,created_date, 'mm/dd/yyyy', 8) created_date,
    htmldb_item.text(12, note,'','','onFocus=javascript:window.status=this.value;') note,
    htmldb_item.md5_checksum(request, subject, severity, priority, status, request_type, response, username, created_date,note) cks
    from
    art_sup_requests
    where
    (:P319_PRIORITY IS NULL OR :P319_PRIORITY ='%' OR
    INSTR(UPPER(ART_SUP_REQUESTS.PRIORITY),UPPER(:P319_PRIORITY)) > 0)
    AND
    (:P319_SEVERITY IS NULL OR :P319_SEVERITY ='%' OR
    INSTR(UPPER(ART_SUP_REQUESTS.SEVERITY),UPPER(:P319_SEVERITY)) > 0)
    AND
    (:P319_SUBJECT IS NULL OR :P319_SUBJECT ='%' OR
    INSTR(UPPER(ART_SUP_REQUESTS.SUBJECT),UPPER(:P319_SUBJECT)) > 0)
    AND (:P319_CREATED_DATE IS NULL OR
    TRUNC(ART_SUP_REQUESTS.CREATED_DATE)=TO_DATE(:P319_CREATED_DATE,'MM/DD/YYYY'))
    AND (:P319_REQUEST_TYPE IS NULL OR :P319_REQUEST_TYPE ='%' OR
    INSTR(UPPER(ART_SUP_REQUESTS.REQUEST_TYPE),UPPER(:P319_REQUEST_TYPE)) > 0)
    AND (:P319_REQUEST IS NULL OR
    INSTR(UPPER(ART_SUP_REQUESTS.REQUEST),UPPER(:P319_REQUEST)) > 0)
    AND (:P319_USERNAME IS NULL OR :P319_USERNAME ='%' OR
    INSTR(UPPER(ART_SUP_REQUESTS.USERNAME),UPPER(:P319_USERNAME)) > 0)
    AND (:P319_ID IS NULL OR ART_SUP_REQUESTS.SUPREQ_ID = :P319_ID)
    union all
    select
    htmldb_item.hidden(1,null) supreq_id,
    null edit,
    null pk,
    htmldb_item.text(3, null) request,
    htmldb_item.select_list_from_lov(4,null,'REQUEST_SUBJECT','','NO') subject,
    htmldb_item.select_list(5, null, '3,2,1', 'style="width:40px"','NO') severity,
    htmldb_item.select_list_from_lov(6,null,'REQUEST_PRIORITY','','NO') priority,
    htmldb_item.select_list_from_lov(7,null,'REQUEST_STATUS','','NO') status,
    htmldb_item.select_list_from_lov(8, null, 'SUPPORT_REQUEST_TYPE','', 'NO') request_type,
    htmldb_item.text(9, null) response,
    htmldb_item.select_list_from_lov(10, null,
    'USER_EMPLOYEE','style="width:100px"','NO') username,
    htmldb_item.date_popup(11, null, sysdate,'mm/dd/yyyy', 8) created_date,
    htmldb_item.text(12, null) note,
    htmldb_item.md5_checksum(null,null, null, null, null, null, null, null, null, null) cks
    from dual) x

    Scott,
    Thanks for the response. We've applied HTMLDB version 1.5.1.00.12 on both develop and production servers yesterday but the ORA-06502 error still persist. We've also tried to use package and "pl/sql return sql" instead of a long sql query but received the same result.
    The solaris instance is using "Western European ISO-8859-1" as the file character set and the windows is using "Western European Windows 1252". Is there any easy way to change the DAD character set on the production box?
    Thanks,
    Tony

  • Report error: ORA-06502: PL/SQL: numeric or value error: character string b

    I have a form which uses a customer form/report, drop downs etc..
    the debug shows it running this statement
    ...Execute Statement: begin begin SELECT distinct initcap(RTRIM (LTRIM (e.surname, ' *0123456789-/:.?,'), ' *0123456789-/:.?,') || ', ' || RTRIM (LTRIM (e.first_name, ' *0123456789-/:.?,'), ' *0123456789-/:.?,' )) empname, e.ID bulk collect into wwv_flow_utilities.g_display,wwv_flow_utilities.g_value FROM dms.dms_employees@dmsprd e, dms.dms_employee_contracts@dmsprd ec WHERE e.ID = ec.emp_id and e.surname like '%%' AND :p75_date BETWEEN ec.start_date AND NVL (ec.end_date, :p75_date) AND e.brh_id = 3654 ORDER BY 1; end; end;
    Then says
    "report error: ORA-06502: PL/SQL: numeric or value error: character string buffer too small"
    Any Ideas?
    Thanks
    Dean

    Denes Kubicek wrote:
    A select list is limited in size. I am not sure what the limit is but that is definitelly the case.The maximum size for the HTML generated for a select list is 32K.
    86 options sounds on the low side to be hitting that limit, but there are other concerns to this as well. Scrolling through hundreds/thousands of options in a select list is a pain for users, and huge select lists produce bloated pages that impact load times and network bandwidth. That list of around 200 countries you find on many sites is about the sensible maximum length for a select list.
    You should use popups.Indeed.

  • Report error:ORA-06502:character string buffer too small. urgent!!

    Hi guys,
    My APEX version is 3.0.1.00.08, my application run on my test environment, but on PROD environment, it raised the error:
    report error:
    ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    In this page, on the left is a tree, the right side is a tabular form, when I click one tree node, it will pass the current node id to the form and the form will display the children data. When I click some tree node, it will raise the ORA-06502 error, but when click some other nodes, it is correct. I don't know why. And on my test environment, it has no this error, the test environment has same version with prod environment, only has less data in database. Could you help me???
    I searched in forum, someone says it's LOV problem, if it's LOV problem, all the nodes should have error, why click some nodes are ok?
    Thanks !
    Jessica

    I don't think it is related only to the number of rows but also to the content of the rows. So, counting only the number of rows doesn't say anything about if it is going to work or not. My question: can't you filter those entries? Making a choice between 250 entries in a tabular form isn't a simple task. Using popup-key LOV instead would also be a solution. However, if you use popup-key LOV be aware of the fact that you need two index numbers for those.
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.opal-consulting.de/training
    http://apex.oracle.com/pls/otn/f?p=31517:1
    -------------------------------------------------------------------

  • Error ORA-06502 When using function REPLACE in PL/SQL

    Hi,
    I have a PL/SQL procedure which gives error 'Error ORA-06502 When using function REPLACE in PL/SQL' when the string value is quite long (I noticed this with a string 9K in length)
    variable var_a is of type CLOB
    and the assignment statement where it gives the error is
    var_a := REPLACE(var_a, '^', ''',''');
    Can anyone please help!
    Thanks

    Even then that shouldn't do so:
    SQL> select overload, position, argument_name, data_type, in_out
      2  from all_arguments
      3  where package_name = 'STANDARD'
      4  and object_name = 'LPAD'
      5  order by 1,2
      6  /
    OVERLOAD   POSITION ARGUMENT_NAME                  DATA_TYPE                      IN_OUT
    1                 0                                VARCHAR2                       OUT
    1                 1 STR1                           VARCHAR2                       IN
    1                 2 LEN                            BINARY_INTEGER                 IN
    1                 3 PAD                            VARCHAR2                       IN
    2                 0                                VARCHAR2                       OUT
    2                 1 STR1                           VARCHAR2                       IN
    2                 2 LEN                            BINARY_INTEGER                 IN
    3                 0                                CLOB                           OUT
    3                 1 STR1                           CLOB                           IN
    3                 2 LEN                            NUMBER                         IN
    3                 3 PAD                            CLOB                           IN
    4                 0                                CLOB                           OUT
    4                 1 STR1                           CLOB                           IN
    4                 2 LEN                            NUMBER                         INI wonder what happened?

  • 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

  • Help me about error: ORA-06502

    Hi everyone,
    I have a problem about CLOB datatype: when I insert data into a CLOB column (the data is a sql script, length of the data over 11,000), PL/SQL show an error: "ORA-06502: PL/SQL: numeric or value error: character string buffer too small".
    I know that CLOB datatype store up to 4 Gigabytes of character data in the database, so I don't know why show "ORA-06502" error. Can anybody help me resolve this problem. Thanks so much.

    My application allow user input oracle query to execute a task.
    This is my table structure:
    create table PRO_COMMAND
    ID NUMBER not null,
    NAME VARCHAR2(200) not null,
    COMMAND CLOB not null,
    COMMAND_ORDER NUMBER(3) not null,
    REPEAT NUMBER(1) not null,
    IGNORE_ERROR NUMBER(1),
    NOTE VARCHAR2(200),
    ISACTIVE NUMBER(1) not null,
    CONDITIONID NUMBER(2) default 0 not null,
    MONTHCOND VARCHAR2(6),
    CONDITIONID2 NUMBER(2) default 0,
    MONTHCOND2 VARCHAR2(6)
    tablespace USERS
    pctfree 10
    initrans 1
    maxtrans 255
    storage
    initial 64K
    minextents 1
    maxextents unlimited
    When user add a new command in application, program will insert into PRO_COMMAND table with COMMAND field is query data. Allow me do not show my query, but when I input a query large than 10000 (datalength), it's show above error; other wise: insert OK.

  • Report error:ORA-06502: PL/SQL: numeric or value error: character to number

    The oracle application express environment is created by installing the HTTP Server on the windows server and the application express 3.2.1 components on the 11.1.0.7 oracle database on UNIX. The installation is successfully and have not seen any issues during the installation. After completing all the steps, when tried to login and click the application builder or workspace components, I see the error message
    report error:ORA-06502: PL/SQL: numeric or value error: character to number.
    This error message is seen on most of the pages when trying to accessed and not able to understand the reasons behind it. Its a brand new environment setup and not even presented to developers to test it.
    Below error message is always seen when trying to access most of the components like application builder, schema comparison and some other tabs. Please advice
    report error:
    ORA-06502: PL/SQL: numeric or value error: character to number conversion error
    Edited by: user589320 on Jun 9, 2011 5:17 PM

    I think its better you use APEX 4.x version ratherthan using old version.
    You will get more features and some bug fixes and also it's easy for you to get some help when you need.
    * If this answer is helpfull or correct then please mark it and grant the points.

  • Report error: ORA-06502: PL/SQL: numeric or value error: NULL index table k

    Hi everybody,
    I have two Distinct Databases on two distinct servers. (Oracle Ent. Release 10.2.0.3.0 on AIX 5.3). After I install the latest patch last week, One of the APEX installation has some problems on Home>Application Builder Page. The error message is very random and
    report error:
    ORA-06502: PL/SQL: numeric or value error: NULL index table key value.
    When i change the view (details to icons), everything goes to normal. This error message is reflected some of the pages (report region) of some of my applications randomly. When it appears in a report region, i deselect the order method of the region, the result is normal.
    But the other APEX application on the other instance has no problem. It is a bug? or Should i re-install the APEX instance?
    Thank you for your interest?
    Gökhan ÇATALKAYA

    No, but we have a reproducible test case now so we're working on it. See ORA-06502: PL/SQL: numeric or value error: NULL index table key value
    Scott

  • Error: ORA-06502: PL/SQL: numeric or value error:NULL index table key value

    Hi,
    I am trying toceate an interface which collects data from database make some transformation and populated seeded tables in the same database.
    My Approach is :
    a) Create a record type variable ( concists of multiple segments)
    b) Create a pl/sql table type of the records type in a)
    c) Created a cursor of same structure as pl/sql table type ( collects data)
    d) BULK CoLLECT data from cursor into pl/sql table
    e) Print the data
    But during Bulk Collect i get the below error :
    Unexpected error in xxc_hr2hr_populate_elements.main at FLOW TRACE-1.120. Error: ORA-06502: PL/SQL: numeric or value error: NULL index table key value
    ORA-20003: Unexpected error in xxc_hr2hr_populate_elements.get_data at FLOW TRACE-1.1.100. Error: ORA-06502: PL/SQL: numeric or value error: Bulk Bind: Truncated Bind

    Ashish_Apps wrote:
    Hi,
    I am trying toceate an interface which collects data from database make some transformation and populated seeded tables in the same database.
    My Approach is :
    a) Create a record type variable ( concists of multiple segments)
    b) Create a pl/sql table type of the records type in a)
    c) Created a cursor of same structure as pl/sql table type ( collects data)
    d) BULK CoLLECT data from cursor into pl/sql table
    e) Print the data
    But during Bulk Collect i get the below error :
    Unexpected error in xxc_hr2hr_populate_elements.main at FLOW TRACE-1.120. Error: ORA-06502: PL/SQL: numeric or value error: NULL index table key value
    ORA-20003: Unexpected error in xxc_hr2hr_populate_elements.get_data at FLOW TRACE-1.1.100. Error: ORA-06502: PL/SQL: numeric or value error: Bulk Bind: Truncated BindVerify the rows you are fetching are having the same data types as your Record like Dates should go to date , decimal should not be fetched in type defined as number etc.

  • 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 ?

Maybe you are looking for

  • Can't get Keynote to open iCloud

    I can't get Keynote to load the presentations that are in my iCloud drive. I know they are there, because I can see them on my Mac. When I change the Keynote settings to use iCloud, the setting does not stick. Pages and Numbers DO use iCloud. I'm usi

  • File Content Conversion for Multi Hierarchical Structure for Sender Adapter

    Hi Gurus, My text file is coming as Header,filed1,field2(Occurrence=1) Content,field3,field4(Occurrence =1-Unbounded) Detail,field4,field5(Occurrence = 1-unbounded) Trailer,fieldN(Occurrence=1) My requirement is to write a file content conversion, so

  • Throws Exception

    Dear Expert, May I know how to throw Exception from a thread back to calling program ? As I always get the following message when compiling the code cannot override run() in java.lang.Thread; overridden method does not throw java.lang.Exception publi

  • 3rd gen ipod collides with magnet

    My 9 year old recently stuck a magent to my 20GB dock connector ipod. All of the files appear corrupted. Do I just need to reset it and plug it into itunes?

  • Adobe Creative Suite 5 Web Premium - Aufrüstung DW CS5.5

    Hallo - ich bräuchte mal dringend Hilfe - BITTE ich habe die Adobe Creative Suite CS5 Web Premium - und möchte diese nun nur mit DW CS5.5 aufrüsten - funkt das oder MUSS ich mir die komplette Suite CS5.5 besorgen??? Lieben DANK