Need help in resolving ORA-06502: PL/SQL: related to WF objects

Hi,
We are getting the following error "Oracle error -6502: ORA-06502: PL/SQL: numeric or value error: character string buffer too small has been detected in FND_USER_RESP_GROUPS_API.UPDATE_ASSIGNMENT" when we add a new user or make changes to the existing user or anything associated with Workflow process. We have an SR open for over a week, but no resolution yet...!
We ran autoconfig few times, complied Invalid objects etc ...but no luck!
This is ERP 11.5.10.2 on Red Hat Linux 4.0 on a 2-node RAC cluster and 2-node Apps Cluster (PCP) ---; thanks in advance..!
Subroto

Did this work successfully before ? If so, what has changed ? Can this error be reproduced consistently on all instances ? Can you pl provide the navigation path to reproduce the error ?
Are you using the Internal Controls Manager module ? If so, MOS Doc 456950.1 (Preventive Segregation of Duties Constraints On Users Form Fails With Ora-6512, Ora-4088) may help.
HTH
Srini

Similar Messages

  • Difficulty in resolving ORA-06502: PL/SQL: numeric or value error:

    Hi
    I am having great difficulty to resolve the following error - ORA-06502: PL/SQL: numeric or value error: character string buffer too small . In my Oracle Package, I have a Function that returns a varchar(255).
    My Function is basically as follows:
    FUNCTION GetUserDept (DeptNum IN NUMBER) RETURN VARCHAR2
    IS
    deptname varchar(255);
    BEGIN
    SELECT name INTO deptname
    FROM depts
    where id = DeptNum;
    RETURN deptname
    END;
    The SQL is running correctly and returns one result, which is what I want. However, when I call the function in my .NET C# code, this is when I am seeing the error message.
    In my code, I said that the commandtype is a stored procedure, passed the parameters, and add it to to the parameters, with the return type and direction put first and executed as a scalar. The code executes, and then fails at the ExecuteScalar line, and it is at this point on my exception handler that I see the error message ORA-6502.
    This really odd, because I have two other functions that return numbers, and I have executed them in the same way, and theses works!
    I have checked my function and can't see what is wrong, and I have tried changing the return type from varchar2 to NVarchar on the return type, but this made no difference.
    This problem has really dogged me for hours and I cannot see how to resolve it.
    Can someone, please help me?

    user633278 wrote:
    This really odd, because I have two other functions that return numbers, and I have executed them in the same way, and theses works!It is that very reason that your code fails. You need to declare the return variable as a string.
    SQL?create or replace
    FUNCTION GetUserDept (DeptNum IN NUMBER) RETURN VARCHAR2
    IS
    deptname varchar(255);
    BEGIN
      RETURN 'hello world';
    END;
      2    3    4    5    6    7    8    9   10 
    Function created.
    SQL?
    SQL?
    declare
      x number;
    begin
      x := GetUserDept(100);
    end;
    SQL?  2    3    4    5    6  declare
    ERROR at line 1:
    ORA-06502: PL/SQL: numeric or value error: character to number conversion error
    ORA-06512: at line 4
    SQL?
    SQL?
    declare
      x varchar2(255);
    begin
      x := GetUserDept(100);
    end;
    SQL?  2    3    4    5    6 
    PL/SQL procedure successfully completed.

  • I need help with error ORA-06502: numeric or value error

    Hi, all, i need help finding the error here, im getting a numeric or value error when i add information to the variable vlcadena when vlcadena is a clob type, and i check the length of the vlcadena variable and sometimes makes the error at 8000 characters some other times 32k i have no idea whats happening, does anyone have a clue?
    PROCEDURE REGISTRO_551 (
    VPNUMPARTE IN PARTESC.NUMPARTE%TYPE,
    VPFRACCION IN IMPOMAT.FRACCIONMEXIMPO%TYPE,
    VPDESCRIPCION IN PARTESC.DESCESPANOL%TYPE,
    VPVALORDLS IN IMPOMAT.VALORDOLARES%TYPE,
    VPCANTIDAD IN IMPOMAT.CANTIDAD%TYPE,
    VPUNIMED IN PARTESC.UNIMEDPARTE%TYPE,
    VPCANTIDADTARIFA IN IMPOMAT.CANTIDAD%TYPE,
    VPVALORAGREGADO IN EXPOPT.VALORAGREGADO%TYPE,
    VPPAISORIGEN IN PARTESC.PAISORIGEN%TYPE,
    VPCOMPVEND IN PARTESC.PAISORIGEN%TYPE,
    VPTIPOFRACCION IN IMPOMAT.TIPOFRACCION%TYPE,
    VPPESONETO IN IMPOMAT.PESONETO%TYPE,
    VPTIPOMONEDA IN MIMPOMAT.TIPOMONEDAEXTRANJERA%TYPE
    ) AS
    BEGIN
        vgproceso := 207310;
        vllong2:=length(vlCadena);
        vlCadena:=vlCadena||'551'||'|'; --1. TIPO DE REGISTRO
        vgproceso := 207311;
        vllong2:=length(vlCadena);
        vlCadena:=vlCadena||VPFRACCION||'|'; --2. FRACCION
        vgproceso := 207312;
        vllong2:=length(vlCadena);
        QUITA_ENTERS(NVL(VPDESCRIPCION,' '),VLTEMP);
        IF LENGTH(VLTEMP)>80 THEN
            VLTEMP:=SUBSTR(VLTEMP,1,80);
        END IF;
        vgproceso := 207313;
        vllong2:=length(vlCadena);
        IF VLTEMP IS NULL THEN
            vlCadena:=vlCadena||'|'; --3. DESCRIPCION
        ELSE
            vlCadena:=vlCadena||VLTEMP||'|'; --3. DESCRIPCION
        END IF;
        vgproceso := 207314;
        vllong2:=length(vlCadena);
        IF VPNUMPARTE IS NULL THEN
            vlCadena:=vlCadena||'|';--4. NO. DE PARTE
        ELSE
            vlCadena:=vlCadena||VPNUMPARTE||'|';--4. NO. DE PARTE
        END IF;
        vgproceso := 207315;
        vllong2:=length(vlCadena);
        vlCadena:=vlCadena||VPVALORDLS||'|'; --5. VALOR MERCANCIA
        vgproceso := 207316;
        vllong2:=length(vlCadena);
        vlCadena:=vlCadena||VPCANTIDAD||'|'; --6. CANTIDAD COMERCIAL
        vgproceso := 207317;
        vllong2:=length(vlCadena);
        IF VPUNIMED IS NULL THEN
            VPDESCERROR:='ALGUNA PARTIDA CON FRACCION '||VPFRACCION||' NO TIENE UNIDAD DE MEDIDA';
        END IF;
        vgproceso := 207320;
        GET_CATGRAL('ADUANAS','UNIMED',NVL(VPUNIMED,' '),CL_D1,CL_D2,CL_D3,CL_D4,CL_V1,CL_V2,CL_V3,CL_CATG);
        IF CL_V2=0 THEN
           vlCadena:=vlCadena||VPUNIMED||'|'; --7. UNIDAD MEDIDA COMERCIAL
        ELSE
            SELECT TO_CHAR(TRUNC(CL_V2)) INTO VLUMCOMERCIAL FROM DUAL;
            IF LENGTH(VLUMCOMERCIAL)=1 THEN
                VLUMCOMERCIAL:='0'||VLUMCOMERCIAL;
            END IF;
            vlCadena:=vlCadena||VLUMCOMERCIAL||'|'; --7. UNIDAD MEDIDA COMERCIAL
        END IF;
        vlCadena:=vlCadena||VPCANTIDADTARIFA||'|';--8. CANTIDAD TARIFA
        vlCadena:=vlCadena||VPVALORAGREGADO||'|';--9. VALOR AGREGADO
        GET_CATGRAL('ADUANAS','CONFADU','IVIN-REG',CL_D1,CL_D2,CL_D3,CL_D4,CL_V1,CL_V2,CL_V3,CL_CATG);
        vlCadena:=vlCadena||CL_D1||'|'; --10. VINCULACION
        vlCadena:=vlCadena||CL_D2||'|'; --11. METODO DE VALORACION
        vlCadena:=vlCadena||'|'; --12. MARCA
        vlCadena:=vlCadena||'|'; --13. MODELO

    If the expected maximum length of the concatenated string is less than 32K, then use VARCHAR2 and at the end convert to CLOB if necesary.
    :p
    PS: At what line in the code does it give the error?
    Edited by: LKBrwn_DBA on Aug 20, 2009 2:49 PM

  • Need help in resolving the below error - SQL statement to execute cannot be

    Here is my CO as below , which creates a callable statement.
    try {
    OAApplicationModule oaapplicationmodule = pageContext.getApplicationModule(webBean);
    OADBTransactionImpl t = (OADBTransactionImpl)oaapplicationmodule.getOADBTransaction();
    OracleCallableStatement proc = (OracleCallableStatement)t.createCallableStatement(lquery, -1);
    proc.execute();
    t.commit();
    catch(SQLException sqlexception)
    throw OAException.wrapperException(sqlexception);
    After running the page , getting the below error ... ( Please find the below error stack )
    I reffered the developement guide but did not get helpful things.
    Please provide me any clues on the same.
    Regards Raghu
    -- Error Stack ---------------------------------------------------------
    Error Page
    Exception Details.
    oracle.apps.fnd.framework.OAException: oracle.jbo.SQLStmtException: JBO-27123: SQL error during call statement preparation. Statement: null
         at oracle.apps.fnd.framework.OAException.wrapperException(OAException.java:888)
         at oracle.apps.fnd.framework.webui.OAPageErrorHandler.prepareException(OAPageErrorHandler.java:1145)
         at oracle.apps.fnd.framework.webui.OAPageErrorHandler.processErrors(OAPageErrorHandler.java:1408)
         at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(OAPageBean.java:2637)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1659)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:497)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:418)
         at OA.jspService(OA.jsp:40)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:727)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:259)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:106)
         at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:803)
         at java.lang.Thread.run(Thread.java:534)
    ## Detail 0 ##
    java.sql.SQLException: SQL statement to execute cannot be empty or null
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:269)
         at oracle.jdbc.driver.OracleConnection.privatePrepareCall(OracleConnection.java:1138)
         at oracle.jdbc.driver.OracleConnection.prepareCall(OracleConnection.java:1054)
         at oracle.jbo.server.DBTransactionImpl.createCallableStatement(DBTransactionImpl.java:3033)
         at cisco.oracle.apps.xxchr.element.server.webui.XXCHRElementSetSearchCO.processFormRequest(XXCHRElementSetSearchCO.java:343)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:799)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
         at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processFormRequest(OAPageLayoutHelper.java:1118)
         at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processFormRequest(OAPageLayoutBean.java:1579)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:995)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:961)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:816)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
         at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processFormRequest(OAFormBean.java:395)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:995)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:961)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:816)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
         at oracle.apps.fnd.framework.webui.beans.OABodyBean.processFormRequest(OABodyBean.java:363)
         at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(OAPageBean.java:2633)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1659)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:497)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:418)
         at OA.jspService(OA.jsp:40)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:727)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:259)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:106)
         at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:803)
         at java.lang.Thread.run(Thread.java:534)
    java.sql.SQLException: SQL statement to execute cannot be empty or null
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:269)
         at oracle.jdbc.driver.OracleConnection.privatePrepareCall(OracleConnection.java:1138)
         at oracle.jdbc.driver.OracleConnection.prepareCall(OracleConnection.java:1054)
         at oracle.jbo.server.DBTransactionImpl.createCallableStatement(DBTransactionImpl.java:3033)
         at cisco.oracle.apps.xxchr.element.server.webui.XXCHRElementSetSearchCO.processFormRequest(XXCHRElementSetSearchCO.java:343)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:799)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
         at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processFormRequest(OAPageLayoutHelper.java:1118)
         at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processFormRequest(OAPageLayoutBean.java:1579)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:995)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:961)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:816)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
         at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processFormRequest(OAFormBean.java:395)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:995)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:961)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:816)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
         at oracle.apps.fnd.framework.webui.beans.OABodyBean.processFormRequest(OABodyBean.java:363)
         at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(OAPageBean.java:2633)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1659)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:497)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:418)
         at OA.jspService(OA.jsp:40)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:727)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:259)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:106)
         at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:803)
         at java.lang.Thread.run(Thread.java:534)
    Edited by: Raghu on Sep 14, 2010 2:58 AM

    check the code pasted by me again
    Connection conn = pageContext.getApplicationModule(webBean).getOADBTransaction().getJdbcConnection();
    Connection conn = oaapplicationmodule.getOADBTransaction().getJdbcConnection(); //Right oneThanks
    --Anil                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Help with ORA-06502: PL/SQL: numeric or value error:

    ORA-06502: PL/SQL: numeric or value error: character to number conversion error
    I passed a fiscal year in as a parameter, and try to set a local variable to that value so i can use that variable later on in the for loop statement to increment the fiscal year to 2009, 2010, etc.
    I kept getting the error message above, is it because I can't assign value greater than 99 to a variable? The local variable's type is based on the table.fiscal_year%type.
    Thanks.

    The data type of the fiscal_year is number(4);
    this is the beginning of the procedure code:
    PROCEDURE load_data ( fiscal_year_in IN table8.fiscalyear%TYPE) IS
         l_fiscal_year table8.fiscalyear%TYPE := fiscal_year_in ;
    and I run the procedure as
    exec import_data.load_data(2008);
    Edited by: jasmine6 on Oct 7, 2008 8:50 AM

  • Issue in appending the LOBs -ORA-06502: PL/SQL: numeric or value error

    Hi
    I am using Oracle 11g.
    I have a requirement in which I have to append LOBs and I have to insert the LOB into a table column. I am facing problem when the data exceeds certain limit. My program works like the below:
    (please note that my program logic is given below, not the exact program)
    DECLARE
    final_html CLOB;
    int_html CLOB;
    v_str VARCHAR2(32767);
    i number:=0;
    BEGIN
    dbms_lob.createtemporary(lob_loc => int_html, CACHE => TRUE, dur => dbms_lob.CALL);
    dbms_lob.createtemporary(lob_loc => final_html, CACHE => TRUE, dur => dbms_lob.CALL);
    DBMS_LOB.OPEN(int_html, DBMS_LOB.LOB_READWRITE);
    DBMS_LOB.OPEN(final_html, DBMS_LOB.LOB_READWRITE);
    dbms_output.ENABLE(1000000);
    FOR i IN 1..100 loop
    v_str := '<tr>' ||
    '<td style="WORD-WRAP: break-word" width="50"><font size="2">' ||
    i || '</font></td>' ||
    '</tr>';
    dbms_lob.writeappend(lob_loc => int_html, amount => LENGTH(v_str), BUFFER => v_str);
    END LOOP;
    dbms_output.put_line( 'The length of int_html is:'||dbms_lob.getlength(int_html));
    dbms_output.put_line( 'The int_html is:'||int_html);
    final_html:= '<html>'||int_html||'</html>';
    dbms_output.put_line('The final_html is:'||final_html);
    EXCEPTION
    WHEN OTHERS THEN
    dbms_output.put_line(SQLCODE||'-'||SQLERRM);
    DBMS_LOB.CLOSE (int_html);
    DBMS_LOB.CLOSE (final_html);
    DBMS_LOB.FREETEMPORARY(int_html);
    DBMS_LOB.FREETEMPORARY(final_html);
    END;
    when the looping is done for lesser value say for e.g FOR i IN 1..10 loop, the program works fine, but when the looping is done for more values I am getting "-6502-ORA-06502: PL/SQL: numeric or value error" error message.
    Please help me to resolve this issue.
    Thanking you in advance.
    Regards,
    Sri

    Can you please specify in which environment you are executing this ?
    I modified your code as follows
    The code executed successfully until the length was <= 32767 i.e ( until FOR i IN 1..1092)
    Also, you need to use the APPEND function to concatenate clob variables.
    Please verify the default max size for varchar2 or dbms_output in your server since you get the error for just the loop within the range (FOR i IN 1..100) .
    And yes, the comments from Siva are valid.
    DECLARE
    final_html CLOB;
    int_html CLOB;
    v_str VARCHAR2(32767);
    i number:=0;
    BEGIN
    dbms_lob.createtemporary(lob_loc => int_html, CACHE => TRUE, dur => dbms_lob.CALL);
    dbms_lob.createtemporary(lob_loc => final_html, CACHE => TRUE, dur => dbms_lob.CALL);
    DBMS_LOB.OPEN(int_html, DBMS_LOB.LOB_READWRITE);
    DBMS_LOB.OPEN(final_html, DBMS_LOB.LOB_READWRITE);
    dbms_output.ENABLE(1000000);
    FOR i IN 1..1092 loop
    v_str := '<tr>' ||
    '<td style="">' ||
    i || '</td>' ||
    '</tr>';
    dbms_lob.writeappend(lob_loc => int_html, amount => LENGTH(v_str), BUFFER => v_str);
    END LOOP;
    dbms_output.put_line( 'The length of int_html is:'||dbms_lob.getlength(int_html));
    begin
    dbms_output.put_line( 'The int_html is:'||int_html);
    dbms_output.put_line( 'The length of int_html is:'||dbms_lob.getlength(int_html));
    exception when others then
    dbms_output.put_line(SQLCODE||'-'||SQLERRM);
    end;
    begin
    final_html:= '<html>'||int_html||'</html>';
    dbms_output.put_line('The final_html is:'||final_html);
    exception when others then
    dbms_output.put_line(SQLCODE||'-'||SQLERRM);
    end; */
    EXCEPTION
    WHEN OTHERS THEN
    dbms_output.put_line(SQLCODE||'-'||SQLERRM);
    DBMS_LOB.CLOSE (int_html);
    DBMS_LOB.CLOSE (final_html);
    DBMS_LOB.FREETEMPORARY(int_html);
    DBMS_LOB.FREETEMPORARY(final_html);
    END;
    Edited by: Jitesh Gurnani on Jul 29, 2011 3:11 AM
    Edited by: Jitesh Gurnani on Jul 29, 2011 3:14 AM

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

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

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

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

  • PL/SQL function body returning SQL query - ORA-06502: PL/SQL: numeric or value error

    I'm attempting to dynamically generate a rather large SQL query via the "PL/SQL function body returning SQL query" report region option.  The SQL query generated will possibly be over 32K.  When I execute my page, I sometimes receive the "ORA-06502: PL/SQL: numeric or value error" which points to a larger than 32K query that was generated.  I've seen other posts in the forum related to this dynamic SQL size limitation issue, but they are older (pre-2010) and point to the 32K limit of the DNS (EXECUTE IMMEDIATE) and DBMS_SQL.  I found this post (dynamic sql enhancements in 11g) which discusses 11g no longer having the 32K size limitation for generating dynamic SQL.  Our environment is on 11gR2 and using ApEx 4.2.1.  I do not know which dynamic SQL method -- DNS or DBMS_SQL -- ApEx 4.2.1 is using.  Can someone clarify for me which dynamic SQL method ApEx uses to implement the "PL/SQL function body returning SQL query" option?
    As a test, I created a page on apex.oracle.com with a report region with the following source:
    declare
      l_stub varchar2(25) := 'select * from sys.dual ';
      l_sql  clob := l_stub || 'union all ';
      br     number(3) := 33;
    begin
      while length ( l_sql ) < 34000 loop
        l_sql := l_sql || l_stub || 'union all ';
      end loop;
      l_sql := l_sql || l_stub;
      for i in 1 .. ceil ( length ( l_sql ) / br ) loop
        dbms_output.put_line ( dbms_lob.substr ( l_sql, br, ( ( i - 1 ) * br ) + 1 ) );
      end loop;
      return l_sql;
    end;
    The dbms_output section is there to be able to run this code in SQL*Plus and confirm the size of the SQL is indeed larger than 32K.  When running this in SQL*Plus, the procedure is successful and produces a proper SQL statement which can be executed.  When I put this into the report region on apex.oracle.com, I get the ORA-06502 error.
    I can certainly implement a work-around for my issue by creating a 'Before Header' process on the page which populates an ApEx collection with the data I am returning and then the report can simply select from the collection, but according to documentation, the above 32K limitation should be resolved in 11g.  Thoughts?
    Shane.

    What setting do you use in your report properties - especially in Type and in Region Source?
    If you have Type="SQL Query", then you should have a SELECT statement in the Region Source. Something like: SELECT .... FROM ... WHERE
    According to the ERR-1101 error message, you have probably set Type to "SQL Query (PL/SQL function body returning SQL query)". In this situation APEX expects you to write a body of a PL/SQL function, that will generate the text of a SQL query that APEX should run. So it can be something like:
    declare
    mycond varchar2(4000);
    begin
    if :P1_REPORT_SEARCH is not null THEN
    mycond:='WHERE LAST_NAME like :P1_REPORT_SEARCH ||''%''';
    end if;
    return 'select EMPLOYEE_ID, FIRST_NAME, LAST_NAME from EMPLOYEES ' ||mycond;
    end;
    And for escaping - are you interested in escaping the LIKE wildcards, or the quotes?
    For escaping the wildcards in LIKE function so that when the user enters % you will find a record with % and not all functions, look into the SQL Reference:
    http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14200/conditions007.htm
    (You would than need to change the code of your function accordingly).
    If you are interested in escaping the quotes, try to avoid concatenating the values entered by the user into the SQL. If you can, use bind variables instead - as I have in my example above. If you start concatenating the values into the text of SQL, you are open to SQLInjection - user can enter anything, even things that will break your SQL. If you really need to allow users to choose the operator, I would probably give them a separate combo for operators and a textfield for values, than you could check if the operator is one of the allowed ones and create the condition accordingly - and than still use bind variable for inserting the filtering value into the query.

  • Ora-06502 pl/sql numeric or value error in Report Query in oracle apex

    Hello all,
    I need your help...
    ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    I am using bi publisher to generate PDF reports in oracle apex.
    We were using APEX 4.0 and migrated to 4.2 just a week ago.
    Now we have apex 4.2.
    When I try to Create report query,
    Shared Components >> Report Queries then create.
    and test a report in a create wizard I am getting a error "ORA-06502: PL/SQL: numeric or value error: character string buffer too small".
    I have also applied a patch "16760897".
    This issue is because of number of columns in a query is more then 26.
    If I run a report with 26 or less number of columns then the is working fine, otherwise getting this error.
    My before migration report queries working perfectly even now, but not new queries.
    This issue is also in apex.oracle.com.
    You can see
    Not working  - http://apex.oracle.com/pls/apex/f?p=619:4
    Working - http://apex.oracle.com/pls/apex/f?p=619:2:
    Please give a solution.
    Thanks you.

    check the DB version compatibility with apex 4 or your DB version to apex 4.0 support for upgrade!
    Oracle Application Express Installation Requirements for 4.0

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

    HI All,
    I am facing the following issue and looking forward for help to find the cause.
    We are converting PDF documents in our repository to HTML using Oracle API
    ctx_doc.ifilter (v_datablob, v_dataclob);
    a highly simplified version of our code will be something like this..
    1) Create table to store the BLOB(Binary PDF documents)
    create table tbl_pdf_store(pdf_doc blob);
    2) Insert a row and store a PDF.
    3) Convert the PDF into HTML and store it in a CLOB object..
    DECLARE
    v_datablob BLOB;
    v_dataclob CLOB;
    BEGIN
    --Create temporary clob objects
    DBMS_LOB.createtemporary (v_dataclob, TRUE, DBMS_LOB.SESSION);
    DBMS_LOB.createtemporary (v_datablob, TRUE, DBMS_LOB.SESSION);
    --get the pdf to be converted from store table
    SELECT pdf_doc
    INTO v_datablob
    FROM tbl_pdf_store
    WHERE rownum < 1;
         --convert the BLOB to HTML and store it in CLOB
         ctx_doc.ifilter (v_datablob, v_dataclob);
    exception
         when others then
         dbms_output.put_line(sqlerrm||' - '||sqlcode);
    end;
    Now the issue I am facing is, the above code works fine for few documents and for few others I get this cryptic error message
    ORA-06502: PL/SQL: numeric or value error
    ORA-06512: at "CTXSYS.DRUE", line 180
    ORA-06512: at "CTXSYS.CTX_DOC", line 1142
    ORA-06502: PL/SQL: numeric or value error - -6502
    I cant reproduce the exact code here, but if anyone had faced the similar issue, then it would be great if they help me out.
    thanks,
    Prashant

    > Billy, its not just plain wrong its a sin :). "When
    others" should itself be avoided if possible(it just
    shows you don't know what error can occur). In the
    actual code, we are using separate package to handle
    and log errors. Here it was just for simplification I
    added that putline code.
    Phew.. You had me worried there... :-)
    > I ran my procedure in debug mode and it throws this
    exception when its executing the Oracle API
    ctx_doc.ifilter
    And there is very little you can do debugging that, as that source code is encoded (wrapped).
    Which means that unfortunately you have to treat that code as a black box and investigate the bug with respects to:
    a) the "environment" from which the call is made (ito of session settings, the sequence of calls made, etc)
    b) the data and parameters passed
    > this is not the case with all the PDFs..I was able to
    convert more than 11 thousand documents without any
    issues. I have this for only few hundred documents.
    This would seem to point to a bug in Oracle's CTX conversion/filter code. Maybe those PDFs are a newer version and is not correctly supported. Maybe they're an older version that is not supported.
    Which is why I said you need to isolate the error. Determine which PDFs are failing. Create a test harness (simplified code as you've posted) to perform a conversion (and nothing else).
    Determine which PDFs fail and which works. Look at the differences between PDFs. E.g. can those problem PDFs be opened with different Acrobat Reader version - or do some of them fail?
    > Another issue is I cannot view the content of the
    these documents to check if anything is different :(.
    You can with Acrobat Reader.. right?
    > so no sure how to go from here...is there a
    printstack method in Oracle 9i(similar to 10g I
    guess) which can give me more information as I am
    currently lost and not sure where to look.
    Dumping the stack will not be of much help. In fact, the error message sequence you pasted already show the call sequence. And as these are in Oracle PL/SQL code, there is nothing really you can do about it.
    My suggestion is to
    a) isolate the error
    b) consult the manual(s) to ensure that the Oracle PL/SQL s/w is used correctly
    c) determine if this is data related (e.g. different PDF versions for example)
    d) log a SR (Service Request) with Oracle Support
    The more you can do ito of (a) - (c), the better the chance for finding the root cause, and the quicker resolution when you have no choice but to do (d).

  • Oracle.DataAccess.Client.OracleException ORA-06502: PL/SQL

    I have the following Simple PL/SQL function:
    FUNCTION INSERTFBEXP (
    p_expid INTEGER,
    p_run_identifier     VARCHAR2,
    p_run_complete     INTEGER,
    p_run_completion_status VARCHAR2,
    p_complete_errors INTEGER
    RETURN INTEGER
    IS
    newid INTEGER;
    concheck INTEGER;
    BEGIN
    concheck := 1;
    newid := 1;
    INSERT INTO test.exp
    (ID, concheck, expid, run_identifier,run_complete, run_completion_status, complete_errors
    VALUES (test.id_testexp.NEXTVAL, concheck, p_expid, p_run_identifier, p_run_complete, p_run_completion_status, p_complete_errors
    ) RETURNING ID INTO newid;
    RETURN newid;
    END;
    Which I am calling from the following .Net procedure:
    Public Function insertTestExp(ByVal expid As Int32, ByVal Run_Identifier As String, _
    ByVal Run_Complete As Boolean, ByVal CompletionStatus As String, ByVal Complete_Errors As Boolean) As Integer
    Dim id As Integer
    With m_OraCmd
    .CommandText = "USER.FBPROCESS.INSERTFBEXP"
    .CommandType = CommandType.StoredProcedure
    With .Parameters
    .Clear()
    .Add(New OracleParameter("p_expid", OracleDbType.Int32)).Value = expid
    .Add(New OracleParameter("p_run_identifier", OracleDbType.Varchar2, 50)).Value = Run_Identifier
    .Add(New OracleParameter("p_run_complete", OracleDbType.Int32)).Value = Convert.ToInt32(Run_Complete)
    .Add(New OracleParameter("p_run_completion_status", OracleDbType.Varchar2, 50)).Value = CompletionStatus
    .Add(New OracleParameter("p_complete_errors", OracleDbType.Int32)).Value = Convert.ToInt32(Complete_Errors)
    .Add(New OracleParameter("newid", OracleDbType.Int32)).Direction = ParameterDirection.ReturnValue
    End With
    Try
    .ExecuteNonQuery()
    Catch ex As Exception
    MsgBox(ex.ToString)
    End Try
    Return CType(.Parameters(5).Value, Int32)
    End With
    End Function
    When I attempt to run the .Net function I get the following error:
    Oracle.DataAccess.Client.OracleException ORA-06502: PL/SQL
    I have determined by trial and error that the problem is in passing the VARCHAR2 parameters. I do not have this problem with the Microsoft Oracle Provider. Can someone help me with what I'm missing? Thanks.

    Note that I have not tested your code... but, it looks like you are using bind by position (which is the default). In this mode the return value needs to be bound first since ODP.NET will generate code similar to this:
    :ret_val := proc(:1, :2,...);That's where I would start anyway.
    Hope that helps a bit,
    Mark

  • ORA-06502:PL/SQL:numeric or value error. Dynamic SQL the only answer??

    ORA-06502: PL/SQL: numeric or value error: character string buffer too small.
    I have an HTMLDB report that errors with the above message. The query is over 7000 characters long so I'm guessing this is the cause. If I retrieve the query from a query table, replace the variables in the LONG query using PL/SQL and execute using dynamic SQL, are the HTMLDB reporting features the same as if I was using a simple SQL query? Is there a better way? I will need to 'drill-down' from this report so how do I create the links? The only HTMLDB PL/SQL package I can find mentioned in the User's Guide is HTMLDB_PLSQL_JOB.
    Cheers, Paul

    Hello All,
    I have the same problem.
    For me it started when i got about 500 rows in the table
    on which the LOV is based.
    With a lot of trying with substr I managed to find the size of the string which it still accepted, which was 51 characters.
    So I thought it was some glitch in the APEX insides, and since I had no time to resolve it further, I went on working.
    But I have to resolve it now, because the following mysterious behaviour is occurring:
    Every few records added to the base table, the problem occurs again, and I can resolve it by cutting down the string
    with one character.
    I have now reached 39 characters !?
    I am afraid that I will end up with 1 character or even null.
    If I switch to Popup list based on LOV there's no problem, and the complete strings are shown.
    The maximum length of the string in my basetable is 252, but the data in it now reaches 55 at most.
    Any idea welcome!
    I did already recreate the master-detail form from scratch, but there the same behaviour.
    greetings,
    Richard Kloostra

  • ORA-06502: PL/SQL: numeric or value error: invalid LOB locator specified:

    "ORA-06502: PL/SQL: numeric or value error: invalid LOB locator specified: ORA-22275"
    I use the procedure to convert the documents if it is not already converted before using procedure as follows
    PROCEDURE "STARDOC"."HTMLOUTPUT" (
    "DOCID" IN NUMBER) IS
    mklob clob;
    doccount number;
    errorcode number;
    errormessage varchar2(200);
    BEGIN -- executable part starts here
    SELECT COUNT(document_id) INTO doccount FROM docviewhtml where document_id=docid;
    --dbms_output.put_line(doccount);
    if doccount=0 then
         dbms_output.put_line('Document Not Found: Converting '||docid);
         --If document is not found run document coversion routine
         ctx_doc.filter('idxdocuments',docid, mklob,FALSE);
         INSERT INTO docviewhtml(document_id, html) VALUES (docid, mklob);
         COMMIT;
    elsif doccount=1 then
         --return;
         dbms_output.put_line('Document Found');
         --if document id found then return the document content
         null;
    else
         --dbms_output.put_line('Error occured');
         --need to deal with duplicate documents
         null;
    end if;
    dbms_lob.freetemporary(mklob);
    EXCEPTION
    --rollback when an exception occurs
         WHEN OTHERS THEN
              errorcode:=SQLCODE;
              errormessage:=SQLERRM;     
              dbms_output.put_line(sqlcode || ':' ||sqlerrm);
              ROLLBACK;
              LOGERROR(errorcode,errormessage);
    END "HTMLOUTPUT";
    i get the error when i convert large documents
    "ORA-06502: PL/SQL: numeric or value error: invalid LOB locator specified: ORA-22275"
    what is wrong. please help!

    "ORA-06502: PL/SQL: numeric or value error: invalid
    LOB locator specified: ORA-22275"
    PROCEDURE "STARDOC"."HTMLOUTPUT" (
    "DOCID" IN NUMBER) IS
    mklob clob;
         ctx_doc.filter('idxdocuments',docid, mklob,FALSE);
    INSERT INTO docviewhtml(document_id, html) VALUES (docid, mklob);I think You forget to initialize variable mklob.
    You can do it, assigning the empty_clob().

  • Error ORA-06502 PL/SQL

    Hi, i have this error when i try to call a store procedure from my VB.NET (2005) program.
    The store procedure:
    CREATE OR REPLACE PROCEDURE MY_EXECUTE (CMD IN VARCHAR2, FIELD IN VARCHAR2, IID OUT NUMBER) IS
    BEGIN
    EXECUTE IMMEDIATE CMD || ' RETURNING ' || FIELD || ' INTO :1' USING OUT IID;
    END;
    I use this function tu return th value of a sequence field in an insert istruction.
    When i call this SP from my .net program (i use ODP dirver vers. 2.102.2.20) i recieve the error:
    We recieve ORA-06502: PL/SQL: numeric or value error
    ORA-06512: at line 1 on some updates.
    If i call the same SP with OleDB provider all works fine.
    SYSTEM:
    Thanks for help.
    A.T.

    Hi,
    Is this behavior consistent or intermittent?
    If intermitten, and your db is 9206, you're likely encountering the following rdbms bug:
    Bug.4015165 (74) REGRN SCALAR VARCHAR2 IN BINDS WITH DIFFERENT SIZE RANDOMLY FAILS WITH ORA-06502
    and should be resolved by patching your database.
    I'm not sure why, but ODP seems to encounter this bug a lot more than other drivers.
    If not intermittent, or if you are using a current patch level of database, a complete testcase would probably be best.
    Cheers,
    Greg

Maybe you are looking for

  • Albums that aren't compilations, sorted as compilations...

    Some albums that I downloaded for some reason are put in the compilations section of my iPod and I don't know why. I've tried going to the compilations folder and moving them out, but it still stays in the compilations section on my iPod... help plea

  • Unsynced after transcoding...

    I couldn't find help after a forum search, so I thought I'd ask here... When I use the Media Encoder in CS3, I find that when I convert my footage -- Quicktime Video/wav 24-bit audio -- into MPEG2 video/MPEG 16-bit audio, the audio is unsynced. Any s

  • If  Websphere 5.1.1  can support JSR-045 ?

    I want to devalop JSP Debugger on Eclipse 3.0.0. When add breakpoint on jsp to VM(websphere5.1.1 / IBM JDK1.4.2 ) , I find virtualMachine.canGetSourceDebugExtension() = false. On JBoss & sun jdk 1.4.2 is well If Websphere 5.1 not support JSR-045 ?

  • Crossfade crossfading fade fading doesn't work

    crossfade crossfading fade fading doesn't work properly. 12 sec results in about 45 sec. around 2 sec is like 12 sec. but still it's no true crossfade. just the first song fading and the second starting abruptly afterwards. Any idea?

  • Is there a way to get ipod media onto itunes????

    My dektop crashed and I lost my itunes library. When I tried plugging my ipod into itunes, it said that an ipod can only be connected to one library at a time. I would've lost all my songs if I had ocntinued. If I delete and reinstall itunes will it