ORA-06502: PL/SQL: error TABLE OF BOOLEAN INDEX BY BINARY_INTEGER;

Hi,
I've a Compiled Body Package which code I described below:
create or replace
PACKAGE body emp_pkg
IS
TYPE boolean_tabtype2
IS
  TABLE OF BOOLEAN INDEX BY BINARY_INTEGER;
  valid_jobs boolean_tabtype2; 
PROCEDURE add_employee(
    first_name employees.first_name%TYPE,
    last_name employees.last_name%TYPE,
    deptid employees.department_id%TYPE,
    jobid employees.job_id%type)
IS
BEGIN
  IF valid_deptid(deptid) THEN
  if valid_jobid(jobid) then
              INSERT
              INTO employees
                  employee_id,
                  first_name,
                  last_name,
                  email,
                  hire_date,
                  job_id,
                  department_id
                VALUES
                  employees_seq.NEXTVAL,
                  first_name,
                  last_name,
                  SUBSTR(first_name,1,1)
                  ||SUBSTR(last_name,1,7)
                  ||'@buongio.com',
                  sysdate,
                  'SA_REP',
                  deptid
     ELSE
        RAISE_APPLICATION_ERROR (-20204, 'Invalid job ID. Try again.');
      END IF;
END add_employee;
PROCEDURE init_jobs
is
begin
FOR rec IN
  (SELECT job_id FROM jobs
  LOOP
    valid_jobs(rec.job_id):=true;
  END LOOP;
END init_jobs;
function valid_jobid(
    jobid employees.job_id%type)
  return boolean
is
BEGIN
return valid_jobs.exists(jobid);
EXCEPTION
WHEN no_data_found THEN
dbms_output.put_line('no valid');
  RETURN FALSE;
END valid_jobid ;
BEGIN
  init_jobs;
END emp_pkg;and the server gives me the next output
ORA-06502: PL/SQL: error : error de conversión de carácter a número numérico o de valorI suspect that the problem is the procedure init_jobs but I don't Know what could I do to resolve it.
Thanks in advance...

sorry
I forget to remove it,
the code:
create or replace
PACKAGE body emp_pkg
IS
TYPE boolean_tabtype2
IS
  TABLE OF BOOLEAN INDEX BY BINARY_INTEGER;
  valid_jobs boolean_tabtype2; 
PROCEDURE add_employee(
    first_name employees.first_name%TYPE,
    last_name employees.last_name%TYPE,
    deptid employees.department_id%TYPE,
    jobid employees.job_id%type)
IS
BEGIN
  if valid_jobid(jobid) then
              INSERT
              INTO employees
                  employee_id,
                  first_name,
                  last_name,
                  email,
                  hire_date,
                  job_id,
                  department_id
                VALUES
                  employees_seq.NEXTVAL,
                  first_name,
                  last_name,
                  SUBSTR(first_name,1,1)
                  ||SUBSTR(last_name,1,7)
                  ||'@buongio.com',
                  sysdate,
                  'SA_REP',
                  deptid
     ELSE
        RAISE_APPLICATION_ERROR (-20204, 'Invalid job ID. Try again.');
      END IF;
END add_employee;
PROCEDURE init_jobs
is
begin
FOR rec IN
  (SELECT job_id FROM jobs
  LOOP
    valid_jobs(rec.job_id):=true;
  END LOOP;
END init_jobs;
function valid_jobid(
    jobid employees.job_id%type)
  return boolean
is
BEGIN
return valid_jobs.exists(jobid);
EXCEPTION
WHEN no_data_found THEN
dbms_output.put_line('no valid');
  RETURN FALSE;
END valid_jobid ;
BEGIN
  init_jobs;
END emp_pkg;

Similar Messages

  • ORA-06502: PL/SQL error with dimensions and roles

    Hi everyone,
    When executing a mapping that loads a cube we are always getting that ORA-06502: PL/SQL error character string buffer too small
    The cube contains a number of dimensions, some of them with roles. We've checked that the error appears when we use two different lookup operators to fill dimension atributtes in the cube and its correspondent role. If we map dimension attributes with lookup operator, and the role attributes with constants, the mapping executes without any error. Moreover, even thought it doesnt make any sense, if we map the role dimension attributes with a lookup operator linked to a different dimension, it works too.
    We think that this could be due to attributes names, maybe they are too long, but we have tried to make them shorter and still getting the same error.
    Any ideas of what could be happening?
    Thank you so much in advance.

    The return datatype in a PLSQL function is unconstrained. Which means it does not have a size.
    The size is declared on the receiving end.
    What size variable are you trying to return your value into?
    Here is an example...
    SQL>create or replace function my_func
      2  return varchar2
      3  is
      4  begin
      5    return USER;
      6  end;
      7  /
    Function created.
    SQL>declare
      2    my_string varchar2(30);
      3  begin
      4    my_string := my_func;
      5  end;
      6  /
    PL/SQL procedure successfully completed.
    SQL>declare
      2    my_string varchar2(3);
      3  begin
      4    my_string := my_func;
      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

  • ORA-06502 PL/SQL Error

    Hi All
    Currently I am working on .net based application and Oracle 8.0.6.00 (Multi language Support - (Japanese/English ))as backbend .
    The above mention error is occurring from last few days on our production server when user is trying to save data .
    I have already gone through all packages and procedure used in my application .
    but i didn't find any conversion error .
    Main Problem is that some time data is save properly even if error is occurred and some time it not saving data in to the DB. and the same error we are trying to reproduce on development server but it is not reproducing ...
    I also checked all NLS Setting of my DB .but still in vague about this error
    Can some help me......
    Thanks & Regards
    Shrirang
    Message was edited by:
    user528219

    As you said
    Main Problem is that some time data is save properly even if error is occurred
    and some time it not saving data in to the DB. and the same error we are trying to
    reproduce on development server but it is not reproducing ...
    I also checked all NLS Setting of my DB .but still in vague about this error
    Can some help me......
    Hi Khurram ,
    Thanks for reply
    the problem is not related any perticular code its big package which we call
    to load , modify and save data . i have checked all code . my filed size is 4 time
    more then specified size by user for a perticular field.
    can you plz. suggest me any other way to solve this
    SQL> CREATE OR REPLACE PACKAGE error_06502 AS
      2  FUNCTION  a RETURN VARCHAR2;
      3  END error_06502;
      4  .
    SQL> /
    Package created.
    SQL> CREATE OR REPLACE PACKAGE BODY error_06502 AS
      2    v1   NUMBER:='A';<----------------Damn it is an headache
      3    FUNCTION a RETURN VARCHAR2 AS
      4      BEGIN
      5       RETURN 'No Error';
      6    END a;
      7    BEGIN
      8      DBMS_OUTPUT.PUT_LINE ('Error is going to trapped for assigining variable v1..');
      9      EXCEPTION WHEN OTHERS THEN
    10      DBMS_OUTPUT.PUT_LINE ('Now error is handled..');
    11  END error_06502;
    12  .
    SQL> /
    Package body created.
    First time
    SQL> EXEC DBMS_OUTPUT.PUT_LINE(error_06502.a);
    BEGIN DBMS_OUTPUT.PUT_LINE(error_06502.a); END;
    ERROR at line 1:
    ORA-06502: PL/SQL: numeric or value error: character to number conversion error
    ORA-06512: at "SCOTT.ERROR_06502", line 2
    ORA-06512: at line 1
    Now see here
    SQL> EXEC DBMS_OUTPUT.PUT_LINE(error_06502.a);
    No Error
    PL/SQL procedure successfully completed.See why error showed at first glance but not at second time why??
    First Time
    Whenever you execute the package first time it initiliased once for each
    session,when i run this package first time package initialisation going to first time
    and the assignment makes in variable v first time and raise the error though i
    have exception block in my executable section which is responsible only to handle
    errors that is raised in excutable section.
    Second Time
    Though package intitliasation is failed at first time (intiliasation dont occur properly
    first time) ,Oracle marks the package is initialised and will run continously without
    any error and return the string 'No Error' within the lenght of yours session when
    you will drop yours session and again try to run the package it will raise the same
    error first time
    SQL> DISCONNECT
    Disconnected from Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
    With the Partitioning, OLAP and Oracle Data Mining options
    JServer Release 9.2.0.1.0 - Production
    SQL> CONN scott/tiger
    Connected.
    SQL> EXEC DBMS_OUTPUT.PUT_LINE(error_06502.a);
    BEGIN DBMS_OUTPUT.PUT_LINE(error_06502.a); END;
    ERROR at line 1:
    ORA-06502: PL/SQL: numeric or value error: character to number conversion error
    ORA-06512: at "SCOTT.ERROR_06502", line 2
    ORA-06512: at line 1.
    SQL> SET SERVEROUTPUT ON
    SQL> EXEC DBMS_OUTPUT.PUT_LINE(error_06502.a);
    No Error
    PL/SQL procedure successfully completed.Check your package variable assignment and error handling exception
    properly,you had better to make assignment default value in the executable
    section rather in the declaration section.In declartion section just declare the
    variable but alls assignment should goes at executable section with definging the
    exception which will handle the error nicely.
    SQL> CREATE OR REPLACE PACKAGE BODY error_06502 AS
      2      v1   NUMBER;
      3    FUNCTION a RETURN VARCHAR2 AS
      4      BEGIN
      5       RETURN 'No Error';
      6    END a;
      7    BEGIN
      8       DBMS_OUTPUT.PUT_LINE ('Error is going to trapped for assigining variable v1..');
      9       v1:='A';
    10      EXCEPTION WHEN OTHERS THEN
    11      DBMS_OUTPUT.PUT_LINE ('Now error is handled..');
    12  END error_06502;
    13  .
    SQL> /
    Package body created.
    SQL> EXEC DBMS_OUTPUT.PUT_LINE(error_06502.a);
    Error is going to trapped for assigining variable v1..
    Now error is handled..
    No Error
    PL/SQL procedure successfully completed.----------------------------------------------------------------------------------------------------------------
    In my last post there would be another reason for this error i would code it here again..
    May be the column you are storing the sequence in is defined as NUMBER2(6) to VARCHAR2(2). Some time ORACLE implicitly convert it if you have valid data in varchar2(2) column like 1,2,3 but if 1A,2A
    e.g
    SQL> DECLARE
      2  a   NUMBER(6);
      3  BEGIN
      4  a:='1';
      5  END;
      6  .
    SQL> /
    PL/SQL procedure successfully completed.
    SQL> DECLARE
      2  a   NUMBER(6);
      3  BEGIN
      4  a:='1a';
      5  END;
      6  .
    SQL> /
    DECLARE
    ERROR at line 1:
    ORA-06502: PL/SQL: numeric or value error: character to number conversion error
    ORA-06512: at line 4If none of these reason which i had mentioned please let us know to share yours
    workaround.
    Khurram

  • ORA-06502: PL/SQL APEX 3.2 Upgrade problem

    We have 2 APEX environments on our 2 servers. Both servers are running Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production.
    One server was running APEX 3.0.0.00.24 (or thereabouts) and was upgraded to 3.2.0.00.27. The other server did not previously have APEX and so 3.2.0.00.27 has been installed as a new version.
    We have a form that is filled in by the users. When they click submit the process adds an entry to a table, and then tries to send an email to our users as a HTML formatted email. The process creates a VARCHAR Variable and then using a cursor creates the text for the the email (including all the HTML tags). Running this process on the original server before the upgrade, but using the formatted email resulted in an ORA-06502: PL/SQL error. Creating an email that was a lot simpler (not html formated and therfore shorter) did actually work correctly.
    I am lead to believe that there was a bug in Apex versions 3.0 that even if a PL/SQL VARCHAR2 variable was defined as 32000 characters it would actually only be able to use/store a lot less than that (1-2000 characters), and any attempt to use more would result in a ORA-06502: PL/SQL error (string buffer too small type message). I cannot seem to access Metalink at the moment so cannot confirm what the actual bug number is. I am also lead to believe that this error was actually addressed and fixed in one of the releases of APEX 3.1, and definitely in APEX 3.2.
    So going with the advice that the issue had been resolved in APEX 3.2, I tried it out in the server with the brand new install. It worked perfectly. I then proceeded to try it in the server that had been upgraded to APEX 3.2.0.00.27. It fails with the same error as before even with the same data as used in the clean install.
    Is there a file / setting / configuration somewhere that has to be changed so the APEX applications can use VARCHAR2 variable with more actual characters?
    Here is a copy of the code being used:
    for c1 in (select DISTINCT OUT_ID, OUT_REQUEST_DATE, OUT_ISSUE, OUT_ETA,
    OUT_KEY_COMMENTS, STATUS_UPDATE_DATE, STATUS_NOTES,
    OUT_EMAIL_TO, P_STATUS, P_SYS, SYS, STATUS,
    ASSIGNED_TO, EMAIL_ADDR, USERNAME, STAT_USERNAME, OUTAGE_LENGTH_BUS_HRS,
    AFFECTED_SYSTEM, SMSLIST, NVL(OUT_BUSINESS_IMPACT,'NOT KNOWN') OUT_BUSINESS_IMPACT,
    OUT_CAUSE_COMMENT, FINAL_CAUSE, FIX,EM.EMAIL
    from HTMLDB_DEV_OPP.VW_OUT_CURRENT_STATUS ST,
    APEX_WORKSPACE_APEX_USERS EM
    where OUT_ID = :P8_OUT_ID
    AND INSTR(':'||ST.EMAIL_ADDR||':',':'||EM.USER_NAME||':') > 0
    ) loop
    if c1.EMAIL is not null then
    l_body_html := '<table align="center" border="0"
    cellpadding="0" cellspacing="0" width="800">
    <tbody>
    <tr>
    <td colspan="3"
    bgcolor="#87b5ed"> 
    Name of section within company here
    </td>
    </tr>
    <tr>
    <td colspan="3"
    style="font-weight: bold; font-size: 28px; color: rgb(0, 0, 102); font-family: Arial,Helvetica,sans-serif;"
    bgcolor="#87b5ed">DASS OUTAGE - ' || C1.SYS ||'</td>
    </tr>
    <tr>
    <td colspan="3"
    style="font-size: 12px; color: rgb(255, 255, 255); font-family: Arial,Helvetica,sans-serif;"
    bgcolor="#87b5ed" valign="center">' ||
    TO_CHAR(SYSDATE,'DY DD MON YYYY HH24:MI') || '</td>
    </tr>
    <tr>
    <td bgcolor="#87b5ed" width="50"><br>
    </td>
    <td rowspan="1"
    bgcolor="#ffffff" valign="top" width="400">
    <table
    style="width: 808px; height: 63px;" border="0"
    cellpadding="0" cellspacing="0">
    <tbody>
    <tr>
    <td
    style="background-color: rgb(21, 103, 171); width: 800px; font-weight: bold; color: rgb(255, 255, 255); font-family: Arial,Helvetica,sans-serif;"
    colspan="3"><img alt="" src="cbi_out2_files/spacer.gif" align="middle" height="30" width="20">' || C1.OUT_KEY_COMMENTS ||'</td>
    </tr>
    </tbody>
    </table>
    <table
    style="height: 722px; width: 804px;" align="center"
    border="0" cellpadding="0" cellspacing="0">
    <tbody>
    <tr>
    <td style="width: 802px;"
    valign="top">
    <p
    style="margin-left: 0px; width: 800px; font-size: 16px; color: rgb(0, 0, 102); font-family: Arial,Helvetica,sans-serif;"><strong>An
    outage has been created in the CBI DASS System. </strong></p>
    <p
    style="margin-left: 0px; width: 800px; font-size: 16px; color: rgb(0, 0, 102); font-family: Arial,Helvetica,sans-serif;"><strong>
    What is the Outage?</strong><br>'||
    C1.OUT_ISSUE||'<br>
    </p>
    <p
    style="margin-left: 0px; width: 800px; font-size: 16px; color: rgb(0, 0, 102); font-family: Arial,Helvetica,sans-serif;"><strong>
    What is the current status?</strong><br>'||
    C1.STATUS||'<br>
    </p>
    <p
    style="margin-left: 0px; width: 800px; font-size: 16px; color: rgb(0, 0, 102); font-family: Arial,Helvetica,sans-serif;"><strong>
    Status update Comments?</strong><br>
    AT '||C1.STATUS_UPDATE_DATE || ' ' ||C1.STAT_USERNAME||' updated the system
    with the following:'||C1.STATUS_NOTES ||'<br>
    </p>
    <p
    style="margin-left: 0px; width: 800px; font-size: 16px; color: rgb(0, 0, 102); font-family: Arial,Helvetica,sans-serif;"><strong>
    Streams Affected?</strong><br>
    Reported against '||C1.SYS||', also affecting downstream systems ' ||
    C1.AFFECTED_SYSTEM ||'<br>
    </p>
    <p
    style="margin-left: 0px; width: 800px; font-size: 16px; color: rgb(0, 0, 102); font-family: Arial,Helvetica,sans-serif;"><strong>
    What is the Business Impact?</strong><br>' ||
    C1.OUT_BUSINESS_IMPACT||'<br>
    </p>
    <p
    style="margin-left: 0px; width: 800px; font-size: 16px; color: rgb(0, 0, 102); font-family: Arial,Helvetica,sans-serif;"><strong>
    What was the cause?</strong><br>' ||
    C1.FINAL_CAUSE||'. ('||C1.OUT_CAUSE_COMMENT||')<br>
    </p>
    <p
    style="margin-left: 0px; width: 800px; font-size: 16px; color: rgb(0, 0, 102); font-family: Arial,Helvetica,sans-serif;"><strong>
    Has a fix been identified?</strong><br>'||
    C1.FIX||'<br>
    </p>
    <p
    style="margin-left: 0px; width: 800px; font-size: 16px; color: rgb(0, 0, 102); font-family: Arial,Helvetica,sans-serif;"><strong>
    When did the Outage commence?</strong><br>'||
    C1.OUT_REQUEST_DATE||' (Length in Bus/Hrs '||C1.OUTAGE_LENGTH_BUS_HRS||')<br>
    </p>
    <p
    style="margin-left: 0px; width: 800px; font-size: 16px; color: rgb(0, 0, 102); font-family: Arial,Helvetica,sans-serif;"><strong>Estimated
    Restore Time / Day?</strong><br>'||
    C1.OUT_ETA||'
    </p>
    <p
    style="margin-left: 0px; width: 800px; font-size: 16px; color: rgb(0, 0, 102); font-family: Arial,Helvetica,sans-serif;"><strong>
    Click the link for further info View DASS '||:P8_OUT_ID||
    '</p>
    </td>
    </tr>
    </tbody>
    </table>
    </td>
    <td bgcolor="#87b5ed" width="50"></td>
    </tr>
    <tr>
    <td bgcolor="#87b5ed"><br>
    </td>
    <td bgcolor="#1567ab"><br>
    </td>
    <td bgcolor="#87b5ed"><br>
    </td>
    </tr>
    <tr>
    <td colspan="3"
    bgcolor="#87b5ed"> </td>
    </tr>
    </tbody>
    </table>
    <br>';
    APEX_MAIL.SEND(
    P_TO => c1.EMAIL,
    P_FROM => '"CBI DASS Email"<OUR EMAIL ADDRESS>',
    P_BODY => l_body_html,
    P_BODY_HTML => l_body_html,
    P_SUBJ => 'CBI System / Data Delay Notification '|| c1.OUT_ID || ' (System ' || c1.SYS ||') ');
    end if;
    end loop;
    Thanks
    Russell

    bump ... does anyone have any ideas?
    Thanks Russell

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

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

    Hi,
    Can anyone let me know what is the issue on below code and how can we avoid that? i am getting the error like below
    ORA-06502: PL/SQL: numeric or value error: NULL index table key value
                        v_while_loop := 1;
                        v_delete_char_id := v_tabtype_result_values.FIRST;
                        WHILE v_while_loop <> v_tabtype_result_values.COUNT
                        LOOP
                            IF check_duplicate_nc_data (v_result_view,
                                                        v_tabtype_result_values(v_delete_char_id).value,
                                                        v_collection_id,
                                                        v_occurrence,
                                                        v_plan_id,
                                                        v_delete_char_id
                            THEN
                                DBMS_OUTPUT.PUT_LINE(v_delete_char_id);
                                v_tabtype_result_values.DELETE(v_delete_char_id);
                            ELSE
                                DBMS_OUTPUT.PUT_LINE(v_delete_char_id||','||v_tabtype_result_values(v_delete_char_id).id||','
                                                        ||v_tabtype_result_values(v_delete_char_id).value||','
                                                        ||v_tabtype_result_values(v_delete_char_id).validation_flag
                            END IF;
                            v_while_loop := v_while_loop + 1;
                            v_delete_char_id := v_tabtype_result_values.NEXT(v_delete_char_id);
                        END LOOP;

    Change:
    WHILE v_while_loop &#60;&#62; v_tabtype_result_values.COUNT to
    WHILE v_while_loop <= v_tabtype_result_values.LASTSY.

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

    W've been experiencing the Oracle Error: ORA-06502: PL/SQL: numeric or value error: NULL index table key value Report’ [we are currently on apex v3.0.1]. From the forum there was a reference to a bug fix: apex bug (6416829) fixed in 3.1. When we view '6416829' in Metalink we can see the bug title but cannot see any details as it's protected. Can anyone shed some light on why it's protected or provide further details.
    We have many LIVE customers reporting this error and we want to be certain it's fixed in v3.1.
    (currently we are working around this by flushing the shared pool but this is not ideal).
    Any help would be appreciated.

    Scott,
    This error has been thrown several times in the past 24 hours. Yesterday several of my reports threw the error, these reports have done so in the past. This morning APEX has begun throwing the error of which I have seen only once before. This is occuring at Home>Application>My Application. The error appears when I attempt to View the report in Details mode, is OK when I view the report in Icons mode. The error is occuring in my Prodution environment which has not been updated since 2/25/2009.
    As before, I edited the SQL on my application's reports and the error then disappeared.
    We are running Application Express 3.2.0.00.27 and Oracle Release 10.2.0.1.0. My browser is IE 7.0.
    Plan to test later with FireFox provided I can download it to see if this might browser related.
    Any inforamtion or guidance is appreciated.
    Jeff

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

    There 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.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • UTL_SMTP , ORA-06502: PL/SQL: numeric or value error

    Hi there,
    I have a procedure that sends emails using UTL_SMTP. It is showing the "ORA-06502: PL/SQL: numeric or value error" whenever the message spans over the limit of the varchar2 type (32'767). I want to send in one email more than that limit, is there a way? any help?
    Thanks in advance

    try this procedure... it works to me!!
    create or replace procedure po8.mail_files ( from_name varchar2,
    to_name varchar2,
    subject varchar2,
    message varchar2,
    max_size number default 9999999999,
    filename1 varchar2 default null,
    filename2 varchar2 default null,
    filename3 varchar2 default null,
    debug number default 0 ) is
    This procedure uses the UTL_SMTP package to send an email message.
    Up to three file names may be specified as attachments.
    Parameters are:
    1) from_name (varchar2)
    2) to_name (varchar2)
    3) subject (varchar2)
    4) message (varchar2)
    5) max_size (number)
    5) filename1 (varchar2)
    6) filename2 (varchar2)
    7) filename3 (varchar2)
    eg.
    mail_files( from_name => 'oracle' ,
    to_name => '[email protected]' ,
    subject => 'A test',
    message => 'A test message',
    filename1 => '/data/oracle/dave_test1.txt',
    filename2 => '/data/oracle/dave_test2.txt');
    Most of the parameters are self-explanatory. "message" is a varchar2
    parameter, up to 32767 bytes long which contains the text of the message
    to be placed in the main body of the email.
    filename{1,2,3} are the names of the files to be attached to the email.
    The full pathname of each file must be specified. The files must exist
    in one of the directories specified in the init.ora parameter
    UTL_FILE_DIR. All filename parameters are optional: It is not necessary
    to specify unused file parameters (eg. filename3 is missing in the above
    example).
    The max_size parameter enables you to place a constraint on the maximum
    size of message, including all attachments, that the procedure will send.
    If this limit is exceeded, the procedure will truncate the message at
    that point with a '*** truncated ***' message. The default is effectively
    unlimited. However, the text of message body is still limited to 32Kb, as
    it is passed in as a varchar2.
    Obviously, as with any Oracle procedure, the parameter values can (and
    usually will be) PL/SQL variables, rather than hard-coded literals, as
    shown here.
    Written: Dave Wotton, 14/6/01 (Cambridge UK)
    This script comes with no warranty or support. You are free to
    modify it as you wish, but please retain an acknowledgement of
    my original authorship.
    Amended: Dave Wotton, 10/7/01
    Now uses the utl_smtp.write_data() method to send the message,
    eliminating the 32Kb message size constraint imposed by the
    utl_smtp.data() procedure.
    Amended: Dave Wotton, 20/7/01
    Increased the v_line variable, which holds the file attachment
    lines from 400 to 1000 bytes. This is the maximum supported
    by RFC2821, The Simple Mail Transfer Protocol specification.
    Amended: Dave Wotton, 24/7/01
    Now inserts a blank line before each MIME boundary line. Some
    mail-clients require this.
    Amended: Dave Wotton, 4/10/01
    Introduced a 'debug' parameter. Defaults to 0. If set to
    non-zero then errors in opening files for attaching are
    reported using dbms_output.put_line.
    Include code to hand MS Windows style pathnames.
    You may need to modify the following variable if you don't have a local
    SMTP service running (particularly relevant to Windows 2000 servers).
    Refer to http://home.clara.net/dwotton/dba/oracle_smtp.htm for more
    details.
    v_smtp_server varchar2(20) := 'doc148.xtec.es';
    v_smtp_server_port number := 25;
    v_directory_name varchar2(100);
    v_file_name varchar2(100);
    v_line varchar2(1000);
    crlf varchar2(2):= chr(13) || chr(10);
    mesg varchar2(32767);
    conn UTL_SMTP.CONNECTION;
    type varchar2_table is table of varchar2(200) index by binary_integer;
    file_array varchar2_table;
    i binary_integer;
    v_file_handle utl_file.file_type;
    v_slash_pos number;
    mesg_len number;
    mesg_too_long exception;
    invalid_path exception;
    mesg_length_exceeded boolean := false;
    begin
    -- first load the three filenames into an array for easier handling later ...
    file_array(1) := filename1;
    file_array(2) := filename2;
    file_array(3) := filename3;
    -- Open the SMTP connection ...
    conn:= utl_smtp.open_connection( v_smtp_server, v_smtp_server_port );
    -- Initial handshaking ...
    utl_smtp.helo( conn, v_smtp_server );
    utl_smtp.mail( conn, from_name );
    utl_smtp.rcpt( conn, to_name );
    utl_smtp.open_data ( conn );
    -- build the start of the mail message ...
    mesg:= 'Date: ' || TO_CHAR( SYSDATE, 'dd Mon yy hh24:mi:ss' ) || crlf ||
    'From: ' || from_name || crlf ||
    'Subject: ' || subject || crlf ||
    'To: ' || to_name || crlf ||
    'Mime-Version: 1.0' || crlf ||
    'Content-Type: multipart/mixed; boundary="DMW.Boundary.605592468"' || crlf ||
    '' || crlf ||
    'This is a Mime message, which your current mail reader may not' || crlf ||
    'understand. Parts of the message will appear as text. If the remainder' || crlf ||
    'appears as random characters in the message body, instead of as' || crlf ||
    'attachments, then you''ll have to extract these parts and decode them' || crlf ||
    'manually.' || crlf ||
    '' || crlf ||
    '--DMW.Boundary.605592468' || crlf ||
    'Content-Type: text/plain; name="message.txt"; charset=US-ASCII' || crlf ||
    'Content-Disposition: inline; filename="message.txt"' || crlf ||
    'Content-Transfer-Encoding: 7bit' || crlf ||
    '' || crlf ||
    message || crlf ;
    mesg_len := length(mesg);
    if mesg_len > max_size then
    mesg_length_exceeded := true;
    end if;
    utl_smtp.write_data ( conn, mesg );
    -- Append the files ...
    for i in 1..3 loop
    -- Exit if message length already exceeded ...
    exit when mesg_length_exceeded;
    -- If the filename has been supplied ...
    if file_array(i) is not null then
    begin
    -- locate the final '/' or '\' in the pathname ...
    v_slash_pos := instr(file_array(i), '/', -1 );
    if v_slash_pos = 0 then
    v_slash_pos := instr(file_array(i), '\', -1 );
    end if;
    -- separate the filename from the directory name ...
    v_directory_name := substr(file_array(i), 1, v_slash_pos - 1 );
    v_file_name := substr(file_array(i), v_slash_pos + 1 );
    -- open the file ...
    v_file_handle := utl_file.fopen(v_directory_name, v_file_name, 'r' );
    -- generate the MIME boundary line ...
    mesg := crlf || '--DMW.Boundary.605592468' || crlf ||
    'Content-Type: application/octet-stream; name="' || v_file_name || '"' || crlf ||
    'Content-Disposition: attachment; filename="' || v_file_name || '"' || crlf ||
    'Content-Transfer-Encoding: 7bit' || crlf || crlf ;
    mesg_len := mesg_len + length(mesg);
    utl_smtp.write_data ( conn, mesg );
    -- and append the file contents to the end of the message ...
    loop
    utl_file.get_line(v_file_handle, v_line);
    if mesg_len + length(v_line) > max_size then
    mesg := '*** truncated ***' || crlf;
    utl_smtp.write_data ( conn, mesg );
    mesg_length_exceeded := true;
    raise mesg_too_long;
    end if;
    mesg := v_line || crlf;
    utl_smtp.write_data ( conn, mesg );
    mesg_len := mesg_len + length(mesg);
    end loop;
    exception
    when utl_file.invalid_path then
    if debug > 0 then
    dbms_output.put_line('Error in opening attachment '||
    file_array(i) );
    end if;
    -- All other exceptions are ignored ....
    when others then
    null;
    end;
    mesg := crlf;
    utl_smtp.write_data ( conn, mesg );
    -- close the file ...
    utl_file.fclose(v_file_handle);
    end if;
    end loop;
    -- append the final boundary line ...
    mesg := crlf || '--DMW.Boundary.605592468--' || crlf;
    utl_smtp.write_data ( conn, mesg );
    -- and close the SMTP connection ...
    utl_smtp.close_data( conn );
    utl_smtp.quit( conn );
    end;
    NOT MINE BUT COPY PASTE TO HELP YOU...

  • 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

  • ORA-06502 : PL/SQL: numeric or value error in Report formattrigger

    Hi guys,
    I have a Format Trigger code to not display any amount less than 1.00 at a group frame level and outside of the group frame is the Grand Total in my report but I am getting
    " REP-1401: ' r_headerformattrigger ' : Fatal PL/SQL error occurred.
    "ORA-06502 : PL/SQL: numeric or value error"
    every time I try to run it.
    function R_headerFormatTrigger return boolean is
    begin
    if :c_header_amount_accrual1_disp > 0.99 then
    return (TRUE);
    else
    return (FALSE);     
    end if;
    end;
    Does any one have any idea as why?

    read this code
    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 88 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
    Rizwan

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

    Hi 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 While Exporting in Oracle 10g

    Connected to: Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Production
    With the Partitioning, OLAP and Data Mining options
    Export done in AR8MSWIN1256 character set and AL16UTF16 NCHAR character set
    server uses AR8ISO8859P6 character set (possible charset conversion)
    About to export the entire database ...
    . exporting tablespace definitions
    . exporting profiles
    . exporting user definitions
    . exporting roles
    . exporting resource costs
    . exporting rollback segment definitions
    . exporting database links
    . exporting sequence numbers
    . exporting directory aliases
    . exporting context namespaces
    . exporting foreign function library names
    . exporting PUBLIC type synonyms
    . exporting private type synonyms
    . exporting object type definitions
    . exporting system procedural objects and actions
    . exporting pre-schema procedural objects and actions
    . exporting cluster definitions
    . about to export SYSTEM's tables via Conventional Path ...
    . . exporting table DEF$_AQCALL 0 rows exported
    . . exporting table SRC_RQST_SEQ 1 rows exported
    EXP-00091: Exporting questionable statistics.
    . . exporting table SRC_USERS 6 rows exported
    EXP-00091: Exporting questionable statistics.
    . . exporting table SRC_YEAR_LOOKUP 40 rows exported
    EXP-00091: Exporting questionable statistics.
    . . exporting table TENDER_DETAIL_TABLE 36 rows exported
    EXP-00091: Exporting questionable statistics.
    . . exporting table TENDER_MASTER_TABLE 34 rows exported
    EXP-00091: Exporting questionable statistics.
    . . exporting table TENDER_NEW_DETAIL_TABLE 4 rows exported
    EXP-00091: Exporting questionable statistics.
    . exporting synonyms
    . exporting views
    EXP-00056: ORACLE error 6502 encountered
    ORA-06502: PL/SQL: numeric or value error
    LPX-00210: expected '<' instead of 'n'
    ORA-06512: at "SYS.UTL_XML", line 152
    ORA-06512: at "SYS.DBMS_METADATA_INT", line 7195
    ORA-06512: at "SYS.DBMS_METADATA_INT", line 9135
    ORA-06512: at "SYS.DBMS_METADATA", line 1882
    ORA-06512: at "SYS.DBMS_METADATA", line 3707
    ORA-06512: at "SYS.DBMS_METADATA", line 3689
    ORA-06512: at line 1
    EXP-00056: ORACLE error 6502 encountered
    ORA-06502: PL/SQL: numeric or value error
    LPX-00210: expected '<' instead of 'n'
    ORA-06512: at "SYS.UTL_XML", line 152
    ORA-06512: at "SYS.DBMS_METADATA_INT", line 7195
    ORA-06512: at "SYS.DBMS_METADATA_INT", line 9135
    ORA-06512: at "SYS.DBMS_METADATA", line 1882
    ORA-06512: at "SYS.DBMS_METADATA", line 3707
    ORA-06512: at "SYS.DBMS_METADATA", line 3689
    ORA-06512: at line 1
    EXP-00000: Export terminated unsuccessfully
    Plz reply me the appropriate Solution
    Edited by: user8920919 on May 3, 2010 12:27 AM

    hi,
    EXP-00091: Exporting questionable statistics The client character set(NLS_LANG) does not match the server character;
    select parameter,value from nls_database_parameters where parameter like '%CHARACTERSET%';
    and check the client system character set
    - Pavan Kumar N
    - ORACLE OCP - 9i/10g
    https://www.oracleinternals.blogspot.com

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

Maybe you are looking for