ORA 60502 :PL/SQL Error

ORA 60502 :PL/SQL Error: numeric or value error : character to numeric
conversion error is displayed at the following line, all the variables are varchar2
rno :='XYZ-'+ substr(n1,1,15)
any solution ??
thanks
DSD

Maybe change it to
rno := 'XYZ-' || substr(n1,1,15);?
C.

Similar Messages

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

  • ORA-06521: PL/SQL: Error mapping function

    Hi folks,
    I am trying to run gather_table_stats for a particular table but am getting the below error. Any ideas?
    SQL> execute DBMS_STATS.gather_table_stats( ownname=>'DBO',tabname=>'CD_JOURNAL_CHANGE_REG',method_opt=>'FOR ALL INDEXED COLUMNS',cascade=>TRUE);
    BEGIN DBMS_STATS.gather_table_stats( ownname=>'DBO',tabname=>'CD_JOURNAL_CHANGE_REG',method_opt=>'FOR ALL INDEXED COLUMNS',cascade=>TRUE); END;
    ERROR at line 1:
    ORA-06521: PL/SQL: Error mapping function
    ORA-06512: at "SYS.DBMS_STATS", line 10301
    ORA-06512: at "SYS.DBMS_STATS", line 10315
    ORA-06512: at line 1
    I have runt utlrp.sql as sys but with no avail.
    Kindest Regards,
    Will

    You did not mention if the applicable table contains an ADT columns, nested tables and so on.
    You can also do a basic test to determine if the problem is potentially with the table, or with dbms_stats itself. Create a plain table, e.g.
    create table foo( id number, foo_char varchar2(100), constraint pk_foo primary key( id ) using index );
    Using the exact same dbms_stats parameters, do this table. If it works, it points to a potential problem with the other table - some data structure/data type issue maybe. If it does not, then you have a problem with dbms_stats itself.
    You can also drop the indexes on the DBO table and try dbms_stats with different parameters. I.e. change the conditions to see if the error still occur in order to isolate the problem.
    You also could log an iTar/SR for this with Oracle Support.

  • ORA-06521: PL/SQL: Error mapping function with 10.1.0 external procedure

    We have an external procedure running fine on 8.1.7 on VMS. After compiling and linking succesfully under 10.1.0, I get ORA-06521 PL/SQL: Error mapping function and ORA-06522: ERROR - vms_dlsym for file x, where x in the filename of the linked executable. Another external procedure that does not connect to the 10.1.0 database runs fine. What could be causing this error in Server 10.1.0 on VMS?
    Thanks,
    Dave

    Here is the code to create the function:
    CREATE OR REPLACE FUNCTION f1
    (h_file_name IN VARCHAR2)
    RETURN BINARY_INTEGER
    IS EXTERNAL
    LIBRARY l1
    NAME "f1"
    LANGUAGE C
    WITH CONTEXT
    PARAMETERS
    (CONTEST,
    h_file_name string);
    Here is the beginning of the Pro*C:
    int f1(epctx, h_file_name)
    OCIExtProcContext *epctx;
    char h_file_name[70];
    char h_line_txt [251];
    int lineno;
    FILE *fptr;
    /* register the connection context ... */
    EXEC SQL REGISTER CONNECT USING :epctx;
    The function loads a flat file into the database. It is probably not related but are unable to SQLPLUS/ or SQLLDR/ into the database from an OS autheniticated account (get ORA-12547: TNS:lost contact.) Thanks for taking the time to look at this. There aren't many people trying this on VMS, I'd bet.

  • ORA-06521: PL/SQL: Error mapping function :ORA-06522:undefined :ODCIAggre

    Hi,
    I am getting the following error :
    SQL> select MinDistance(TT) from egg1;
    select MinDistance(TT) from egg1
    ERROR at line 1:
    ORA-06521: PL/SQL: Error mapping function
    ORA-06522: /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/lib/custagg.so:
    undefined symbol: ODCIAggregateInitialize
    I am compiling my C program with OCI using the following command :
    g++ -Wall -c custagg.c -o custagg.o -I$ORACLE_HOME/rdbms/public -I/usr/lib
    I am linking to get a shared library custagg.so file with following command :
    ld -shared -o custagg.so custagg.o $ORACLE_HOME/lib/l*.so ../../usr/lib/libstdc++.s*
    I am not getting any errors during these two phases.
    And when i am calling the extproc custagg(Mindistance) which i implemented using ODCI(oracle data catridge interface) ...I am getting the error undefined symbol : ODCIAggregateInitialize
    So can any one please let me know what shared libraries are required to access the ODCI services and also am I compiling and linking it the right way or am I missing any libraries.
    I have the oci.h & odci.h and several other header files in my :
    $ORACLE_HOME/rdbms/public
    And while linking i am using : $ORACLE_HOME/lib/*.so files.
    So I don't know whether my directory is missing some shared files related to ODCI : can any one please let me know which files or shared libraries I am missing :
    Below are list of files in my : $ORACLE_HOME/lib :
    custagg123.o libclntsh.so libdbcfg10.so libjox10.so libocci.so.10.1 liborasdkbase.so libskgxpd.so libunwind.so.5
    custagg.so libclntsh.so.10.1 libemmas10.so libldapjclnt10.so libocijdbc10.so liborasdkbase.so.10.2 libskgxpu.so libxdb.so
    facility.lis libclsra10.so libhasgen10.so libnjni10.so libocr10.so liborasdk.so libsqlplus.so shell.so
    hsdb_odbc.so libcorejava.so libheteroxa10.so libnjssl10.so libocrb10.so liborasdk.so.10.2 libsqora.so.10.1 sysliblist
    hsdb_ora.so libcoresh10.so libhsbase.so libnnz10.so libocrutl10.so libqsmashr.so libsrvm10.so
    lclasses12.zip libcprts.so.5 libhsnav.so libnque10.so libodm10.so libskgxn2.so libsrvmhas10.so
    libagtsh.so libcxa.so.3 libimf.so libntcpaio10.so libodmd10.so libskgxns.so libsrvmocr10.so
    libagtsh.so.1.0 libcxa.so.5 libirc.a libocci.so libons.so libskgxp10.so libuini10.so
    Please reply to my queries.
    Please let me know if you want to have a look at the symbols of my object file
    Thanks & Regards,
    -NN

    Your issue may relate to XE and it may relate to OCI but it does not relate to SQL and PL/SQL. Consider posting your question in a forum where it will be on topic.
    When you do include full version information (3 decimal places) and the code that is generating the exception.

  • ORA-06521:PL/SQL:Error mapping function :ORA-06522:undefined :ODCIAggregate

    Hi,
    I am getting the following error :
    SQL> select MinDistance(TT) from egg1;
    select MinDistance(TT) from egg1
    ERROR at line 1:
    ORA-06521: PL/SQL: Error mapping function
    ORA-06522: /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/lib/custagg.so:
    undefined symbol: ODCIAggregateInitialize
    I am compiling my C program with OCI using the following command :
    g++ -Wall -c custagg.c -o custagg.o -I$ORACLE_HOME/rdbms/public -I/usr/lib
    I am linking to get a shared library custagg.so file with following command :
    ld -shared -o custagg.so custagg.o $ORACLE_HOME/lib/l*.so ../../usr/lib/libstdc++.s*
    I am not getting any errors during these two phases.
    And when i am calling the extproc custagg(Mindistance) which i implemented using ODCI(oracle data catridge interface) ...I am getting the error undefined symbol : ODCIAggregateInitialize
    So can any one please let me know what shared libraries are required to access the ODCI services and also am I compiling and linking it the right way or am I missing any libraries.
    I have the oci.h & odci.h and several other header files in my :
    $ORACLE_HOME/rdbms/public
    And while linking i am using : $ORACLE_HOME/lib/*.so files.
    So I don't know whether my directory is missing some shared files related to ODCI : can any one please let me know which files or shared libraries I am missing :
    Below are list of files in my : $ORACLE_HOME/lib :
    custagg123.o libclntsh.so libdbcfg10.so libjox10.so libocci.so.10.1 liborasdkbase.so libskgxpd.so libunwind.so.5
    custagg.so libclntsh.so.10.1 libemmas10.so libldapjclnt10.so libocijdbc10.so liborasdkbase.so.10.2 libskgxpu.so libxdb.so
    facility.lis libclsra10.so libhasgen10.so libnjni10.so libocr10.so liborasdk.so libsqlplus.so shell.so
    hsdb_odbc.so libcorejava.so libheteroxa10.so libnjssl10.so libocrb10.so liborasdk.so.10.2 libsqora.so.10.1 sysliblist
    hsdb_ora.so libcoresh10.so libhsbase.so libnnz10.so libocrutl10.so libqsmashr.so libsrvm10.so
    lclasses12.zip libcprts.so.5 libhsnav.so libnque10.so libodm10.so libskgxn2.so libsrvmhas10.so
    libagtsh.so libcxa.so.3 libimf.so libntcpaio10.so libodmd10.so libskgxns.so libsrvmocr10.so
    libagtsh.so.1.0 libcxa.so.5 libirc.a libocci.so libons.so libskgxp10.so libuini10.so
    Please reply to my queries.
    Please let me know if you want to have a look at the symbols of my object file
    Thanks & Regards,
    -NN

    It's only a quick guess but have you checked your tnsnames.ora file to ensure you've opened the environment to find the libraries? If you set the EXTPROC_DLLS=ANY, you open the database to security issues but it should tell you if this cause because you can't access the library that contains the symbol.
    SID_LIST_CALLOUT_LISTENER =
    (SID_LIST =
    (SID_DESC =
    (SID_NAME = PLSExtProc)
    (ORACLE_HOME = <oracle_home_directory>)
    (PROGRAM = extproc)
    (ENV = "EXTPROC_DLLS=ONLY:
    <oracle_home_directory>/customlib/writestr1.so
    ,LD_LIBRARY_PATH=<oracle_home_directory>/lib")
    )

  • ORA-06521: PL/SQL: Error mapping function while writting into a text file

    Hi,
    I'm getting an errror ORA-06521: PL/SQL: Error mapping function while trying to write data into a text file.
    I'm using the following code:
    --To create a new directory
    create or replace directory temp as 'C:/temp';
    declare
                    l_str varchar2(1000);
                    output_file utl_file.file_type;
                    cursor test_write_cur is
                         select EMPNO,ENAME,JOB,SAL,HIREDATE
                           from EMP
                         where DEPTNO=30;
    begin
               output_file := utl_file.fopen('TEMP','TESTFILE.txt','w');
               for test_write_rec IN test_write_cur
               loop          
                l_str :=     test_write_rec.EMPNO||'^'||test_write_rec.ENAME||'^'||test_write_rec.JOB||'^'||
                         test_write_rec.HIREDATE||'^'||test_write_rec.SAL||chr(10);
                utl_file.put_line(output_file,l_str);
                     end loop;                                                                           
               utl_file.fclose(output_file);
    end;Please suggest me if i'm wrong.
    Thanks & Regards,
    Sanket Mishra

    Dear Sanket,
    I think you are need use TO_CHAR() function
      to_char(test_write_rec.EMPNO) ,
      to_char(test_write_rec.HIREDATE,'DD.MM.YYYY')
      to_char(test_write_rec.SAL)

  • Call to ldap server fails ORA-06521: PL/SQL: Error mapping function

    I am getting this error(s)
    ORA-06521: PL/SQL: Error mapping function
    ORA-06512: at "SYS.DBMS_LDAP_API_FFI", line 0
    ORA-06512: at "SYS.DBMS_LDAP", line 1338
    ORA-06512: at "SYS.DBMS_LDAP", line 1273
    ORA-06512: at "SYS.DBMS_LDAP", line 529
    ORA-06512: at line 127
    after binding and searching an ldap directory.
    Line 127 is:
    my_dn := DBMS_LDAP.get_dn(my_session, my_entry);
    Both of the 'my_xx' parameters have been successfully set earlier in the script I believe as they produce no errors and DBMS_LDAP.count_entries(my_session, my_message) returns = 1.
    I am following the example at:
    http://download-west.oracle.com/docs/cd/B10501_01/network.920/a96577/smplcode.htm#636994
    In fact any of the functions used in the 'while loop' in the above example give a similar error.
    Apparently SYS.DBMS_LDAP_API_FFI is a call to an external C program, but this would be a standard Oracle one, not one I have written.
    I am connecting to a non-Oracle ldap server, and have tried several (OpenLDAP 2.X, & Windows 2000 AD), with same results.
    Any suggestions gratefully received.
    Cheers
    KIM

    Fixed by running the catldap.sql script (ORACLE_HOME/rdbms/admin/catldap.sql) as SYS user and recreated the dbms_ldap packages. I am not sure why some of the functions worked OK and others did not.
    KIM

  • Ldap problem, ORA-06521: PL/SQL: Error mapping function

    I am getting this error(s)
    ORA-06521: PL/SQL: Error mapping function
    ORA-06512: at "SYS.DBMS_LDAP_API_FFI", line 0
    ORA-06512: at "SYS.DBMS_LDAP", line 1338
    ORA-06512: at "SYS.DBMS_LDAP", line 1273
    ORA-06512: at "SYS.DBMS_LDAP", line 529
    ORA-06512: at line 127
    after binding and searching an ldap directory.
    Line 127 is:
    my_dn := DBMS_LDAP.get_dn(my_session, my_entry);
    Both of the 'my_xx' parameters have been successfully set earlier in the script I believe as they produce no errors and DBMS_LDAP.count_entries(my_session, my_message) returns = 1.
    I am following the example at:
    http://download-west.oracle.com/docs/cd/B10501_01/network.920/a96577/smplcode.htm#636994
    In fact any of the functions used in the 'while loop' in the above example give a similar error.
    Apparently SYS.DBMS_LDAP_API_FFI is a call to an external C program, but this would be a standard Oracle one, not one I have written.
    I am connecting to a non-Oracle ldap server, and have tried several (OpenLDAP 2.X, & Windows 2000 AD), with same results.
    Any suggestions gratefully received.
    Cheers
    KIM

    Scott,
    Thanks for your concern. I should have explained. I am working in HTMLdb, successfully using ldap to authenticate, but now need to get the logged-in user's name and other details. All my attemps to use the wwv_flow_ldap functions have failed, and I am no resorting to DBMS_LDAP to get what I want. I am hoping thatsome helpful person can shed some light on this problem
    Cheers
    KIM

  • ORA-06520: PL/SQL: Error loading external library

    Hi
    I am trying to use an external C program from sql using following steps.
    copy the dll in dir ORACLE/806/BIN
    create or replace library outs as
    'e$/ORACLE/806/BIN/SmlCrcChecking.dll'
    create or replace FUNCTION plsCheck_File_CRC (fname Varchar2)
    return boolean
    AS LANGUAGE C
    library outs
    name "Check_File_CRC";
    and call the dll using
    select plsCheck_File_CRC('c:\mttest.txt') from dual;
    The dll is notc alled the message is
    ERROR at line 1:
    ORA-06520: PL/SQL: Error loading external library
    ORA-06522: Unable to load DLL
    Please help
    Prashant

    I am trying to create a Pl/SQL test env using
    create or replace procedure file_test
    (fname in varchar2,
    status out number)
    is
    begin
    If Check_File_CRC (fname) then
    status:=0;
    else
    status:=1;
    end if;
    end;
    However the following errros are displayed
    Errors for PROCEDURE FILE_TEST
    6/1 PL/SQL: Statement ignored
    6/4 PLS-00382: expression is of wrong type
    mY TNSNAMES.ORA contains following
    additions
    EXTPROC_CONNECTION_DATA =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
    (CONNECT_DATA = (SID = PLSExtProc)(PRESENTATION = RO))
    extproc_connection_data.world =
    (DESCRIPTION =
    (ADDRESS =
    (PROTOCOL = IPC)
    (KEY = extproc))
    (CONNECT_DATA =
    (SID = extproc)
    AND LISTNER.ORA
    SID_LIST_LISTENER =
    (SID_LIST =
    (SID_DESC =
    (SID_NAME = PLSExtProc)
    (ORACLE_HOME = D:\oracle\ora81)
    (PROGRAM = extproc)
    Message was edited by:
    prashant13

  • 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-60502: PL/SQL: numeric or value error

    I am stuck in a loop. I have a trigger that runs before inserting new records into a table and it looks like below:
    ...WHILE (PARENTKEY IS NOT NULL)
    LOOP      
         --PLACE FOLDERNAME INTO FOLDERPATH TO CREATE DIR'S PATH
         FOLDERNAME := FOLDERNAME || '/';
         --here's where the error lies!!!!!!!!
         TEMPPATH := FOLDERNAME || FOLDERPATH;          
         FOLDERPATH := TEMPPATH;
    It seems that whenever I adjust the size of FOLDERPATH the TEMPPATH needs to be re-adjusted as well and vice versa. Does anyone know of a solution to this problem? Thanks in advance.
    Message was edited by:
    user631770

    If you are not using the variable TEMPPATH anywhere else in your code except the line which you have provided then you can very well do away with it.
    --PLACE FOLDERNAME INTO FOLDERPATH TO CREATE DIR'S PATH
    FOLDERNAME := FOLDERNAME || '/';
    Replace the lines –
    TEMPPATH := FOLDERNAME || FOLDERPATH;
    FOLDERPATH := TEMPPATH;
    With –
    FOLDERPATH := Trim(FolderName) || Trim(FolderPath);
    You will not need TEMPPATH anymore.
    Shailender Mehta

  • 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

  • ORA-29284: File read error

    Good morning,
    Need to do two flat file on a 2000 lien.
    1 - Read a file. csv
    2 - Keep it plain, unformatted information from a table
    These are the steps I performed to achieve the first goal ...
    1 - READING TEST FILE
    CREATE OR REPLACE DIRECTORY PUBLIC_ACCESS AS 'C:\REPORTES_REY';
    GRANT READ, WRITE ON DIRECTORY PUBLIC_ACCESS TO PUBLIC;
    -- THIS PL / SQL works ok..
    DECLARE
    v1 utl_file.file_type;
    v2 varchar2(600);
    begin
    v1:= utl_file.fopen('PUBLIC_ACCESS','prueba20110218.csv','R'); -- WORKS WELL ...
    --v1:= utl_file.fopen('PUBLIC_ACCESS','sui_facturacion_alcantarillado_15085_2011_01_76845_001.csv','R');
    loop
         begin
              utl_file.get_line(v1,v2);
              dbms_output.put_line('el contenido del archivo es: '||v2);
              exception
              when no_data_found then
              exit;
         end;
              dbms_output.put_line(' - ');  JUMP LINE
    end loop;
         utl_file.fclose(v1);
    exception
         when others then
         dbms_output.put_line(sqlerrm);
    end;
    but when you change the file name by map prueba20110218.csv de-> sui_facturacion_alcantarillado_15085_2011_01_76845_001.csv displays the following error
    ORA-29284: File read error+
    - this error to be?
    I am grateful for the attention and cooperation extended ...
    good day ...
    REYNEL SALAZAR MARTÍNEZ
    Cali-Colombia

    Thank you very much for your cooperation extended
    The file if it exists, the operating system is Windows, I'm running for the line of command and the file is in the same direction as the file prueba20110218.csv
    Segi therefore his advice and remove:
    exception
    when others then
    dbms_output.put_line(sqlerrm);
    then run the following code:
    DECLARE
    v1 utl_file.file_type;
    v2 varchar2(800);
    begin
    v1:= utl_file.fopen('PUBLIC_ACCESS','prueba20110218.csv','R'); FUNCIONA BIEN...+
    v1:= utl_file.fopen('PUBLIC_ACCESS','sui_facturacion_alcantarillado_15085_2011_01_76845_001.csv','R',32767);
    loop
    begin
    utl_file.get_line(v1,v2);
    dbms_output.put_line('el contenido del archivo es: '||v2);
    exception
    when no_data_found then
    exit;
    end;
    dbms_output.put_line(' - ');  SALTO DE LINEA+
    end loop;
    utl_file.fclose(v1);
    exception
    when others then
    dbms_output.put_line(sqlerrm);
    end;
    +/+
    ORA-06502: PL / SQL: error: character string buffer too small numeric or value
    I do not understand the error -> ORA-06502
    thanks...
    good day
    Reynel Salazar Martínez
    Cali-Colombia

Maybe you are looking for