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

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

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

Similar Messages

  • ORA-06502 character string buffer too small “  error

    We trying to insert a string of more then 500 character from our VB.net application (uses ODP.net), it’s giving “ORA-06502 character string buffer too small “ error.
    Kindly help us on this.
    OS version: AIX 5.1 (IBM/AIX RISC System/6000)
    Oracle Database version: 9.2.0.1.0

    Just for reference and to close the loop, I found the fix to this problem (quite by accident).
    The problem turned out to be a bug in the apex listener, which in some cases ended up doing a divide by zero, which caused the problem.
    This is listed as a known bug, and a fixed listener is available.
    Once I installed the fixed listener, problem solved!

  • ORA-06502 character string buffer too small, works in query not procedure

    The following query works prefect as a single query:
    with t as (select steroid_start_date as the_date from treatments where patientid = 1378 and visitnumber = 0)
        select max(case when instr(mon, '/') > 0 then NULL else mon end) mon,
             max(case when instr(yr, '/') > 0 then NULL else yr end) yr
      from ( select the_date, substr(the_date, nvl(last_pos,1), pos-1) mon, substr(the_date, pos+1) yr
              from ( select t.*,
                               instr(the_date, '/', 1, lvl) pos,
                            lag(instr(the_date, '/', 1, lvl))
                                over (
                                        partition by the_date
                                        order by instr(the_date, '/', 1, lvl)
                                     ) last_pos
                     from t, (
                                select 1 lvl
                                from dual
                                UNION ALL
                                select 2 lvl
                                from dual
                             ) b
                      where instr(the_date, '/', 1, lvl) > 0
          );I have a procedure contains:
    CREATE OR REPLACE PROCEDURE update_steroid_start_date(patid number, visit number)
    IS
        mon varchar2(3);
        yr varchar2(3);
    date1 varchar2(12);
    insert_date varchar2(12);
    BEGIN
        select steroid_start_date into date1 from treatments where patientid = patid and visitnumber = visit;
        with t as (select date1 the_date from dual)
        select max(case when instr(mon, '/') > 0 then NULL else mon end),
             max(case when instr(yr, '/') > 0 then NULL else yr end) into mon, yr
      from ( select the_date, substr(the_date, nvl(last_pos,1), pos-1) mon, substr(the_date, pos+1) yr
              from ( select t.*,
                               instr(the_date, '/', 1, lvl) pos,
                            lag(instr(the_date, '/', 1, lvl))
                                over (
                                        partition by the_date
                                        order by instr(the_date, '/', 1, lvl)
                                     ) last_pos
                     from t, (
                                select 1 lvl
                                from dual
                                UNION ALL
                                select 2 lvl
                                from dual
                             ) b
                      where instr(the_date, '/', 1, lvl) > 0
          );when I try to execute this procedure, I am getting ORA-06502 character string buffer too smal on the line
    with t as (select date1 the_date from dual)why is that? I am trying to break user input 1/2000, sometimes junk (1/ , /2000), and apply some logic so they will be 01/01/2000, NULL, 01/01/2000
    Edited by: OracleNoob on Feb 17, 2009 10:58 AM

    Hi,
    That error occurs when the variables that are being set are too short to hold the entire value being selected.
    Either make the variables longer, or the columns shorter.
    If you need mnore help, post
    (1) The version of Oracle (and any other relevant software) you're using
    (2) A little sample data (just enough to show what the problem is) from all the relevant tables
    (3) The results you want from that data
    (4) Your formatted code
    (5) The full error message(s), including line number
    Executable SQL statements (like "CREATE TABLE AS ..." or "INSERT ..." statements) are best for (2).
    Formatted tabular output is okay for (3) and essential for (4). Type {code} before and after the tabular text, to preserve spacing.

  • WWV_FLOW_WORKSHEET_CONDITIONS - ORA-06502 character string buffer too small

    Hi,
    I am currently working on a application that can upload CSV files inside many tables. Since I hate reinventing the wheels, I have decided to reverse engineer APEX and APEX APIs that are used by the SQL Workshop to upload CSV files to a single table. Since this feature was tested many times by many developers around the world, I know I can trust the code. If in a future release of APEX those packages are modified, I'll have to update my abstraction layer to call my own packages instead of APEX packages. (This is not an issue for our team.)
    First Step
    Use apex_040000.wwv_flow_load_data.create_csv_collection to create an apex collection with the first 20 rows of the csv file. At this step, we can validate the format of a sample of the file without loading all rows of the csv file.
    Second Step
    Use apex_040000.wwv_flow_load_data.load_csv_data to upload all rows of the csv file inside a table.
    Third Step
    Do whatever you want with the data inside the table. (i.e.: Send the data into multiple tables...)
    Here's my problem..._
    After the first or second steps, I display the data using interactive reports. I want to highlight every cells containing "invalid" data. I use apex_040000.wwv_flow_worksheet_api.add_or_update_highlight. When I have too many invalid cells, the IR doesn't show at run time, and you can see ORA-06502: PL/SQL: numeric or value error: character string buffer too small on the page.
    I would like to know the limitations of IR using the table WWV_FLOW_WORKSHEET_CONDITIONS. Is there a way to create many highlight conditions inside a single row of WWV_FLOW_WORKSHEET_CONDITIONS ? I want to find the best approach to add hundreds of conditions.
    Thanks
    Louis-Guillaume Carrier-Bédard
    My Google+: https://profiles.google.com/lgcarrier
    My Blog: http://www.lgcarrier.com
    Twitter: http://www.twitter.com/lgcarrier
    APEX Québec: http://www.apexquebec.com
    APEXFramework: http://www.apexframework.com

    At run time, when I look at the html source code, I can see all the generated CSS rules to highlight the cells of the IR.
    ie.: *.apexir_WORKSHEET_DATA tr td.rule_5352115461902443_td {background-color:#FF0000 !important;}*

  • ORA-06502 (character string buffer too small) on import application via script

    Running apex 4.2.2.00.11
    oracle 10.2.0.5
    I'm using a script to import my development application to a few production applications.
    It worked great on apex 4.1.1, but now I get an 'ORA-06502 PL/SQL numeric of value error: character string buffer too small'
    In the command window, I see that the script fails after it starts on the plugins.
    My question: is this a bug in 4.2.2?
    I could be a incompatible plugin, but how can I found out which plugin?
    My script is quite simple:
    In a command window I run
    sqlplus SCHEMA/PASSWORD@SPIEU10 @_IMPORT_F102.sql
    The script is
    declare
    l_workspace_id number;
    begin
        -- determine the workspace id for the workspace FM in the target system
        select workspace_id into l_workspace_id from apex_workspaces where workspace = 'BY_APEX_SHARED';
        -- set the context for the target workspace
        apex_application_install.set_workspace_id( l_workspace_id );
        -- override the original application id 102
        apex_application_install.set_application_id ( 102 );
        -- set a different application name and alias, it should be unique within an APEX instance
        apex_application_install.set_application_alias( 'MY_ALIAS' );
        apex_application_install.set_application_name( 'MY_APP_NAME' );
        -- Use fixed offset
        apex_application_install.set_offset( p_offset => 0);
        -- override the original parsing schema FM with a different value
        apex_application_install.set_schema( 'BY_SCHEMA' );
    end;
    -- install the original application export, now the values for the workspace
    @f102.sql
    exit;
    Error message from command window:
    ...ui types
    ...plugins
    begin
    ERROR at line 1:
    ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    ORA-06512: at line 3
    Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64
    bit Production
    With the Partitioning, Data Mining and Real Application Testing options

    ListAGG throws an ORA-01489 for varchar2 > 4000 bytes
    OP has an ORA-06502 --> the IR is running into a 4k/32k limit.
    quick solution: wrap USER_COMMENTS ListAGG in a substr( ...., 1, 4000)
    Longer solution, use a subquery to modify the comments based on ROW_NUMBER() (ie after nth row, change it to NULL)
    with
    -- simulating data
    t as (select task_id, sysdate - lv as date_entered
      ,round(dbms_random.value(1,24)) hours
      , '-*' || lv || '.' || task_id || '*-' as user_comments
    from ( select level as task_id from dual connect by level <=10 ), (select level lv from dual connect by level < 1000)
    -- modify data
    modified_data as (
      select task_id, hours, date_entered
        ,case
          when row_number() over (partition by task_id order by date_entered desc) < 5
            then user_comments
          else null
         end USER_COMMENTS
        from t)
    select task_id, sum(hours) total_hours,
      listagg( user_comments  ) within group (order by date_entered desc)
      || case when count(*) >= 5 then '! MORE COMMENTS !' else null end
        as user_comments
    from modified_data
    group by task_id;

  • Ideas for working around ORA-06502: character string buffer too small on Interactive report

    Hello,
    This is for Apex 4.2.  We are trying to create an interactive report.  The report is for something similar to a time tracking application.  We are trying to concat a comments column while summing the hours.  For example,
    select TASK_NAME, sum(HOURS), to_char(XMLAGG(XMLELEMENT(E,E.COMMENTS || ' : ')).EXTRACT('//text()').getstringval()) USER_COMMENTS from ......
    This query works fine if we are looking only at a 1 week window.  The issue we are experiencing is that when we expand the range of the query to include data from 3 months, we hit ORA-06502 in the interactive report.  If we remove this column from the Interactive report, then the report runs fine.
    Does anyone have any ideas on how we might be able to work around this?  I am guessing we are hitting the 32k limit on the report.  Ideally we would just show the last X number of comments and then have a link to view all the comments
    Any help would be appreciated
    Thanks
    Mike

    ListAGG throws an ORA-01489 for varchar2 > 4000 bytes
    OP has an ORA-06502 --> the IR is running into a 4k/32k limit.
    quick solution: wrap USER_COMMENTS ListAGG in a substr( ...., 1, 4000)
    Longer solution, use a subquery to modify the comments based on ROW_NUMBER() (ie after nth row, change it to NULL)
    with
    -- simulating data
    t as (select task_id, sysdate - lv as date_entered
      ,round(dbms_random.value(1,24)) hours
      , '-*' || lv || '.' || task_id || '*-' as user_comments
    from ( select level as task_id from dual connect by level <=10 ), (select level lv from dual connect by level < 1000)
    -- modify data
    modified_data as (
      select task_id, hours, date_entered
        ,case
          when row_number() over (partition by task_id order by date_entered desc) < 5
            then user_comments
          else null
         end USER_COMMENTS
        from t)
    select task_id, sum(hours) total_hours,
      listagg( user_comments  ) within group (order by date_entered desc)
      || case when count(*) >= 5 then '! MORE COMMENTS !' else null end
        as user_comments
    from modified_data
    group by task_id;

  • 'ORA-06502 character string buffer too small' when called from C# app

    I have researched this problem and checked my variable sizes over and over again. I have tested the procedure within the Oracle Express environment and it works fine; HOWEVER, when the procedure is called from my C# app it produces the ORA-06502 error.
    The stored procedure signature looks like this...
    create or replace save_new_project (p_custorgid in number,
      p_title in varchar2,
      p_AOIName in varchar2,
      p_description in varchar2,
      p_receiveddate in date,
      p_deadlinedate in date,
      p_startdate in date,
      p_createddate in date,
      p_createdby in varchar2,
      p_projectid out number,
      p_statustypedescrip out varchar2)The OracleParameter in my C# app for the last out param is defined as such...
    cmd.Parameters.Add(new OracleParameter("p_statustypedescrip", OracleDbType.Varchar2, 30, ParameterDirection.Output));As I said at the beginning of this post, the procedure works fine in the Oracle environment. So why is it not working by simply calling it from C#? I've tried changing the OracleDbType to CLOB which eliminates the error but it returns a bizarre result. It returns this string, "Oracle.DataAccess.Types.OracleClob". WTH?!!
    Since CLOB doesn't really work either I switch back to Varchar2 and specify a size of 5000 (in the database the field I am querying is defined as Varchar(30)). I still get the ORA-06502 error.
    I am clueless as to what the problem is. It should work and it does if I run a series of SQL statements in an Oracle SQL Command window. The test that works fine looks like this...
    declare
      v_projid projects.projectid%type;
      v_statustypedescrip projectstatustypes.type%type;   /* this is a varchar(30) */
    begin
      save_new_project(2, 'Some input text goes here', 'More input text', 'And more again','26-APR-2007','26-APR-2007','26-APR-2007','26-APR-2007','users name as inpujt text here',v_projid,v_statustypedescrip);
      dbms_output.put_line('v_projid = ' || v_projid);
      dbms_output.put_line('v_statustypedescrip = ' || v_statustypedescrip);
    end;But calling save_new_project from C# throws ORA-06502. It identifies line 40 of my stored procedure. This is line 40...
    p_statustypedescrip := v_statustypedescrip;

    Problem solved!!!
    I don't know why this worked but it did. I changed how I declared the output parameter in my C# app. I used to have it on one line like this...
    cmd.Parameters.Add(new OracleParameter("p_statustypedescrip", OracleDbType.Varchar2, 30, ParameterDirection.Output));but then I changed it to multiple lines like this...
    OracleParameter prm11 = new OracleParameter();
    prm11.ParameterName = "p_statustypedescrip";
    prm11.OracleDbType = OracleDbType.Varchar2;
    prm11.Size = 30;
    prm11.Direction = ParameterDirection.Output;
    cmd.Parameters.Add(prm11);I don't know why it works this way but it does and that's all I care about.

  • ORA – 06512: Character String Buffer Too Small.

    hi..
    when i'm call the Stored Procedure from php i'm getting this error
    ORA – 06512: Character String Buffer Too Small.
    but its working fine via pl/sql block in sqlplus
    CREATE OR REPLACE procedure sp_RecurringDetails(v_p in out pmxpackage.gen ,v_pmCount in out number, v_pmResult in out number) is
    v_Stmt varchar2(4000);
    v_stmtcount varchar2(4000);
    begin
    v_Stmt:= 'SELECT orders.ord_id, sub.smt_id, sub.smt_date,
    MEMBER.mem_fname,
         MEMBER.mem_lname,
         sub.smt_amount,
         sub.smt_qty,
    sub.smt_pv
         FROM MEMBER MEMBER,
         orders orders,
         sub_monthly_track sub
    WHERE ( (MEMBER.mem_id = orders.ord_memid)
    AND (MEMBER.mem_id = sub.smt_mem_id)
              AND ORDERS.ORD_RECURRING=2
              and member.MEM_DEL_STATUS=''N''
              and smt_status=0
    union
    (SELECT orders.ord_id, null,null,
    MEMBER.mem_fname,
         MEMBER.mem_lname,
         null,
         null,
    null
         FROM MEMBER MEMBER,
         orders orders
    where
    MEMBER.mem_id = orders.ord_memid
    and
    orders.ORD_RECURRINGID=2
    and orders.ord_status=''f'') order by ord_id     ';
              v_stmtcount:='select count(*) from ('||v_stmt||')';
    if (v_pmCount=-1) then
    dbms_output.put_line('');
              EXECUTE IMMEDIATE ' set serveroutput on';
              EXECUTE IMMEDIATE v_stmtcount INTO v_pmCount;
    end if;
    open v_p for v_stmt ;
    v_pmResult:=1;
    exception
    when others then
    null;
    end;
    when i'm gettting Count from the Stored Procedure sp returns the error... other wise its working fine in php
    pls give the solution for this issue
    Thanks,
    Message was edited by:
    venkatraman.L

    Tx for ur Response
    I didnt get any log when i excute this..... But it is woking fine in pl/sql Block .. But when i call from PHP page it Gives the Error
    Re: ORA – 06512: Character String Buffer Too Small.
    CREATE OR REPLACE procedure sp_RecurringDetails(v_p in out pmxpackage.gen ,v_pmCount in out Integer, v_pmResult in out Integer) is
    v_Stmt varchar2(4000);
    v_stmtcount varchar2(4000);
    v_ErrMsg varchar(1000);
    v_Errorcode number;
    begin
    v_ErrMsg:='Data--'||'Param1 is Cursor'||'--' ||Pmxpackage.Fun_Param(v_pmCount,'Param2 is null')||'--' ||Pmxpackage.Fun_Param(v_pmResult,'Param3 is null');
         IF v_pmCount IS NULL OR v_pmResult IS NULL THEN
         Pmxpackage.sp_pmxerrorlog(v_ErrMsg,'sp_RecurringDetails');
              v_pmResult:=0;
              dbms_output.put_line('nulld is ');
              RETURN ;
         END IF;
    v_Stmt:= 'SELECT orders.ord_id, sub.smt_id, sub.smt_date,
    MEMBER.mem_fname,
         MEMBER.mem_lname,
         sub.smt_amount,
         sub.smt_qty,
    sub.smt_pv
         FROM MEMBER MEMBER,
         orders orders,
         sub_monthly_track sub
    WHERE ( (MEMBER.mem_id = orders.ord_memid)
    AND (MEMBER.mem_id = sub.smt_mem_id)
              AND ORDERS.ORD_RECURRING=2
              and member.MEM_DEL_STATUS=''N''
              and smt_status=0
    union
    (SELECT orders.ord_id, null,null,
    MEMBER.mem_fname,
         MEMBER.mem_lname,
         null,
         null,
    null
         FROM MEMBER MEMBER,
         orders orders
    where
    MEMBER.mem_id = orders.ord_memid
    and
    orders.ORD_RECURRINGID=2
    and orders.ord_status=''f'') order by ord_id     ';
              v_stmtcount:='select count(*) from ('||v_stmt||')';
    if (v_pmCount=-1) then
    dbms_output.put_line('');
              EXECUTE IMMEDIATE ' set serveroutput on';
              EXECUTE IMMEDIATE v_stmtcount INTO v_pmCount;
    end if;
    open v_p for v_stmt ;
    v_pmResult:=1;
    EXCEPTION
         WHEN OTHERS THEN
              v_pmResult:=0;
              v_Errorcode:=SQLCODE;
              Pmxpackage.Sp_Pmxerrorlog(v_Errorcode,' sp_RecurringDetails',v_ErrMsg);
    end;

  • Error in notification - "character string buffer too small"

    Hi All,
    Hope everyone is doing great...
    I have issue with one of the procedure which sends out status email for the reports. Below is the code.
    It worked fine from last six months but today it failed because of the length of characters (more reports are added).
    The variable "l_an_report" is VARCHAR and it has crossed it limit so gave the below error. Not sure how to handle the report so that it includes all the data.
    Also please let me if this is good solution :- Have the report status in excel sheet and attach to the email.
    If its fine please let me know how i can achieve this and any prerequisite from network team we need to get?
    ERROR :-
    ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    ORA-06512: at "REPORT_STAT.PACKG_EMAIL", line 441
    ORA-06512: at line 2
    Procedure PRC_SUMMARY IS
          l_an_report varchar2(32767);
          l_header VARCHAR2(1000);
          cnxn UTL_SMTP.connection;
          P_job           NUMBER (10)    DEFAULT TO_NUMBER (TO_CHAR (SYSDATE,'YYYYMMDD'));
    BEGIN
                          l_an_report := '<style type="text/css">
    <!--.style1 { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10pt; font-style: normal; color: #FF0000}-->
    <!--.sidebar1 { font-family: Arial, Helvetica, sans-serif; font-size: 10px}-->
    <!--.text { font-family: Arial, Helvetica, sans-serif; font-size: 12px}-->
    </style>
    <center><b><font face="Arial">Summary Report '
                || '<br><br></font></b></center>'
                || ' <div align="center"><table width="90%" border="1" cellspacing="0" cellpadding="1"'
                || 'style="font-size: 10pt; font-family: Arial" > '
                || '<tr bgcolor=b4b4b4><td align="center"> <font size="3"> <b>'
                || 'Report</b></td><td align="center"><font size="3"> <b>'
                || 'Run Duration </b></td><td align="center"><font size="3"> <b>'
                || 'Status</b></font></td></tr> ' || UTL_TCP.CRLF;
                    FOR curr_refresh IN (SELECT
                                         AN.NAME report_NAME,
                                         ROUND(((ARH.RUN_END_TIME-ARH.RUN_START_TIME)*24*60),2) RUN_TIME,
                                         ARH.JOB_STATUS STATUS
                                         FROM
                                         REPORT_HISTORY ARH,REPORT AN
                                         WHERE
                                         ARH.RUN_START_TIME>TO_DATE(SYSDATE-93)
                                         AND AN.report_ID=ARH.report_ID
                                         and arh.JOB_NAME like 'QA%'
                                         and arh.JOB_STATUS='Completed')
                                  LOOP
              l_an_report  := l_an_report ||
              '<tr><td align="center">'|| curr_refresh.report_name|| '</td><td align="center">'|| curr_refresh.RUN_TIME ||
              '</td><td align="center">'|| curr_refresh.STATUS ||
               '</td><td align="center">' || UTL_TCP.CRLF;                      
                exit when length (l_an_report) > 32767;                   
          END LOOP;
           l_an_report := l_an_report || '</table><br><br>';
                FOR curr_email IN (SELECT global_name instance_name,
                REU.EMAIL_USER_LAST_NAME last_name,
                REU.EMAIL_USER_FIRST_NAME first_name,
                REU.EMAIL_USER_EMAIL_ID,
                '[email protected]' mail_from
                                 FROM EMAIL_USER REU, EMAIL_GROUP REG,GLOBAL_NAME
                                             WHERE REU.EMAIL_GROUP_ID = REG.EMAIL_GROUP_ID
                                                   AND REG.EMAIL_GROUP_NAME ='IT') LOOP
                cnxn := UTL_SMTP.open_connection('smtprelay.ats.com', 25);
                UTL_SMTP.helo(cnxn, 'smtprelay.ats.com');
                UTL_SMTP.mail(cnxn, '[email protected]');
                UTL_SMTP.rcpt(cnxn, curr_email.EMAIL_USER_EMAIL_ID);
                   l_header := 'MIME-Version: 1.0'||'
                   To: ' || curr_email.last_name || ' <' || curr_email.EMAIL_USER_EMAIL_ID || '>
                   From: ' || curr_email.mail_from || '
                   Subject: Summary Report for ' || curr_email.instance_name || ' on ' || to_char(sysdate, 'DD-MON-YYYY') || '
                   Reply-To: [email protected]
                   Content-Type: text/html;' || UTL_TCP.CRLF || UTL_TCP.CRLF;
                UTL_SMTP.data(cnxn, l_header || l_an_report);
                UTL_SMTP.quit(cnxn);
          END LOOP;
    END PRC_SUMMARY;Please share your thoughts.
    Regards,
    Sunny

    >
    It worked fine from last six months but today it failed because of the length of characters (more reports are added).
    ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    >
    The error is because you don't check the length of 'l_an_report' until it is already too long.
    This code checks the length AFTER adding to it.
    >
    l_an_report := l_an_report ||
    '<tr><td align="center">'|| curr_refresh.report_name|| '</td><td align="center">'|| curr_refresh.RUN_TIME ||
    '</td><td align="center">'|| curr_refresh.STATUS ||
    '</td><td align="center">' || UTL_TCP.CRLF;
    exit when length (l_an_report) > 32767;
    >
    You need to test the length of the new string to be added to make sure it won't cause 'l_an_report' to be too long
    -- add a new variable in the declare section
    v_new_string VARCHAR2(2000);
    -- in loop do calc
    v_new_string := '<tr><td align="center">'|| curr_refresh.report_name|| '</td><td align="center">'|| curr_refresh.RUN_TIME ||
              '</td><td align="center">'|| curr_refresh.STATUS ||
               '</td><td align="center">' || UTL_TCP.CRLF;                      
    -- test length
    IF (length(v_new_string) + length (l_an_report) > 32767 THEN EXIT;But as others have said if you need to handle lengths > 32767 then use an attachment as shown in the links provided.

  • ORA-6502 Character String buffer too small

    Stored procedure call from C#. Ref cursors are no problem but trying to return Varchar2 is a bit of a puzzle. Just the simple code fragment below blows with ORA-6502.
    PROCEDURE getjdt2 (X OUT VARCHAR2) IS
    BEGIN
    X := 'TEST RETURN VARCHAR2';
    END;
    OracleCommand cmd = new OracleCommand ("GETJDT2", conn);
    cmd.CommandType = CommandType.StoredProcedure;
    cmd.Parameters.Add("param1",OracleDbType.Varchar2);
    cmd.Parameters[0].Direction = ParameterDirection.Output;
    OracleDataReader reader;
    reader = cmd.ExecuteReader();
    reader.Read();
    Console.WriteLine ("Val: {0}", reader.GetString(0));

    Never mind. A bit more research and I figured it out.

  • "ORA-19011: Character string buffer too small" doing select xmlelement???

    Apparently there is a 4K limit on the amount of XML that can be produced doing a select with SQL/XML syntax, or so it appears. That is pretty disappointing. It makes this feature uselful only for demos. 256K would be a much more realistic limit for real-world applications.

    Is there any work around for this when I was using XPath I was to able use xmlsequence and come around this. But when I am using xquery execution seems to be slow, I do not want to xmlsequence and further reduce the performance.

  • ORA-19011: Character string buffer too small

    my query
    select to_clob(xmldata) from ei_output where id=1my java code...
           //load jdbc driver
                Class.forName("oracle.jdbc.driver.OracleDriver");
                // create connection
                c=DriverManager.getConnection(UI.jTxtConStr.getText(),UI.jTxtUsr.getText(),UI.jTxtPsw.getText());
                //create statement
                Statement stmt=c.createStatement();
                ResultSet rs=stmt.executeQuery(UI.jTxtAreaSQL.getText());//resulset pe baza a ceea ce e in TextArea din UI
                //get the result
                while(rs.next()){
                    is=rs.getClob(1).getAsciiStream();
                }I need the ascii stream in order to do a transform provided by apache xalan...
    what can I do about it? how can I get the ascii stream of the xmldata(xmltype)?

    Maybe a possibility would be to let the query return an XMLType instead of a CLOB or VARCHAR2 and then you can do the transformation on the server in Java instead of on the database. We tried something similar for a PL/SQL procedure:
    public Document getXML() {
    try {
    Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
    java.sql.Connection connecton =
    DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:ORCL",
    "scott", "tiger");
    oracle.jdbc.OracleCallableStatement statement =
    (oracle.jdbc.OracleCallableStatement)connecton.prepareCall("BEGIN \"WEBSERVICE\".TEST_XML(:1 ); END;");
    statement.registerOutParameter(1, OracleTypes.OPAQUE,
    "SYS.XMLTYPE");
    statement.executeUpdate();
    //Object out = statement.getObject(1);
    XMLType xml = XMLType.createXML(statement.getOPAQUE(1));
    statement.close();
    System.out.println("out: " + xml);
    return xml.getDOM();
    } catch (Exception e) {
    e.printStackTrace();
    return null;
    The WEBSERVICE.TEST_XML procedure returns data as an XMLType object.
    Regards,
    Ronald

  • Character string buffer too small

    ORA-19011: Character string buffer too small
    My query is regarding the above error. I have a requirement to concatenate two XMLType columns in the result set and am running into the above issue. Can you please let me know how I can workaround the above problem.
    Thanks,
    YM

    Error:     ORA-19011 (ORA-19011)
    Text:     Character string buffer too small
    Cause:     The string result asked for is too big to return back
    Action:     Get the result as a lob instead

  • Erreur : ORA-06502: PL/SQL: numeric or value error: character string buffer too small

    Hi there...
    I'm sugin 9Iasv2 Portal.
    When i clik on the "approbations" tab in the parameters of a page, i always get this error :
    Erreur : ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    Could you please help me ?
    regards
    Arnaud

    Please report this problem to Oracle Support.

  • Listener Error - character string buffer too small (ORA-06502)

    I am running into a very strange problem with the APEX listener on seemingly random pages. I can hit every page in my application just fine, but as soon as I hit this specific one, Glassfish throws an HTTP 500 error. If I click Debug, the page seems to load fine with no indications of trouble, but as soon as I turn debug back off, it goes back to the HTTP 500 error. I don't see anything special about the page that makes this happen. It is pretty simple and has 4 regions. I have noticed that if I set any 1 of the 4 regions to "Never display", the page loads fine. It's like having all 4 of them enabled at once are causing some overload, even though it's actually a smaller amount of data than most of my other pages.
    **Update: I just discovered this only happens if I'm logged into the workspace first and then try to run the page! If I log out of APEX and then hit the application as a normal user, page loads error-free. This is still an annoying problem, but at least it seems I have a decent workaround since regular users never see it.
    After a couple days, I noticed the exact same problem on a second APEX application I'm using. Again, it is on some random page whereas all the other pages work fine.
    Both applications and pages in question worked without issue in APEX 3.x. I am trying to get an APEX application up and running on the latest version.
    I have tried both Glassfish server and simply downloading the latest listener (version 1.1.1) and running it in standalone mode. I get the problem both ways, which is why it seems it's a listener issue.
    I have seen a few other threads of people having this problem, but I never did find anyone with a solution, and most of the posts stopped back in December.
    Some details on my environment:
    Database version: Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bi
    APEX version: 4.0.2
    Webserver: Glassfish 3.1
    Here is the log entry from Glassfish when the HTTP 500 error displays as I try to load one of the bugged pages.
    [#|2011-05-10T21:14:22.967-0500|INFO|oracle-glassfish3.1|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=111;_ThreadName=Thread-1;|MaxConnectionReuseCount=50000|#]
    [#|2011-05-10T21:14:46.431-0500|SEVERE|oracle-glassfish3.1|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=112;_ThreadName=Thread-1;|
    ***********ERROR***********
    init: # headers=46
    declare nm owa.vc_arr := ?;
    vl owa.vc_arr := ?;
    begin
    owa.init_cgi_env( ?, nm, vl );
    htp.init; htp.HTBUF_LEN := 63;
    ? := sys_context('USERENV','SID');
    end;
    SID:1242
    CALL:
    begin
    f(p=>?);
    commit;
    end;
    BINDS
    p:100:2:220529248574492::NOPAGE CALL:
    declare
    nlns number := 999999;
    l_clob CLOB;
    lines htp.htbuf_arr;
    l_buff varchar2(32767);
    l_clob_init boolean:= false;
    l_file varchar2(5);
    l_doc_info varchar2(1000);
    begin
    OWA.GET_PAGE(lines, nlns);
    if (nlns > 1) then
    for i in 1..nlns loop
    if ( length(lines(i)) > 0 ) then
    if ( ( lengthb(l_buff) + lengthb(lines(i))) > 32767) then
    if (NOT l_clob_init) then
    dbms_lob.createtemporary(l_clob, TRUE);
    dbms_lob.open(l_clob, dbms_lob.lob_readwrite);
    l_clob_init:=true;
    end if;
    dbms_lob.writeappend(l_clob,length(l_buff),l_buff);
    l_buff := lines(i);
    else
    l_buff := l_buff || lines(i);
    end if;
    end if;
    end loop;
    end if;
    if (l_clob_init) then
    dbms_lob.writeappend(l_clob,length(l_buff),l_buff);
    l_buff := '';
    end if;
    ? := l_clob;
    ? := l_buff;
    if (wpg_docload.is_file_download) then l_file:='TRUE'; wpg_docload.get_download_file(l_doc_info); else l_file := 'FALSE'; end if; ? := l_file;
    ? := l_doc_info;
    end;
    get_page FAILED:ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    ORA-06512: at line 33
    Edited by: BrianB on May 11, 2011 7:50 AM
    Edited by: BrianB on May 11, 2011 8:01 AM

    Brian,
    this post is going to get a bit longer, so the summary comes first.
    h6. Summary
    1. I could reproduce the problem on my system using the APEX Listener in standalone mode.
    2. I don't think the problem is content-related in the sense that you have any issue in your page or database contents.
    3. I have a workaround for your problem.
    h6. Error message
    Having that error in my environment made me start to think. I not only disabled some item and got it work, but I could also add something to achieve this effect.
    So I came to think, this really is somewhere deep down. The error message doesn't seem very helpful on first sight, but when starting to follow on what's happening there, things get clearer:
    APEX generates pages dynamically, replacing substitution strings and other tokens to get the actual page definition. This has to be read by a requesting client. The use of VARCHAR2 as buffer introduces a limit of 32767 bytes, after which the contents is handled as CLOB instead.
    h6. Analysis
    Obviously, there are cases where the "estimation" fails. Of course, this is may only be relevant in rare cases, because:
    1. If a page would exceed the maximum without some charset interpretation problem, the buffer would be switched to clob.
    2. If a page stays small enough to stay below 32767 even with some characters that are acutally larger then expected, the buffer isn't busted.
    To find out, if your could be one of these rare cases, I investigated the HTTP headers, focussing on X-DB-Content-length and made an odd observation.
    Test case 1: "Go" button disabled, so the page runs fine with APEX Listener
    1. It has *31968 bytes* when coming from APEX Listener with a Go button disabled.
    2. It has *31938 bytes* according to the header set by EPG - for exactly the same page.
    That makes a difference of 30 bytes for what is expected to be the same contents.
    Test case 2: The button is enabled again
    1. This causes the page load to crash in APEX Listener.
    2. EPG transports *32341 bytes* according to that header.
    So we are pretty close to the hard limit for the VARCHAR2 buffer.
    For some reason, APEX Listener seems to cause a false calculation of the actual page size. Whether this is due to some charset problem or due to some other problem with response handling, I don't know. The 30 bytes difference may result from the odd header "X-ORACLE-IGNORE" with value "IGNORE, IGNORE, IGNORE, IGNORE" sent by the APEX Listener. This value has exactly 30 bytes in length, but this could be coincidence, as there are more differences in headers. If I add the size of all headers, we are even closer to the buffer limit and probably exceed it when some items need more bytes than expected.
    This could even be as simple as a line break, as your page has about 424 lines when I disabled the button... Adding 1 byte per line to the 32341 bytes of the EPG, I get 32765 bytes. Now add that button (403 bytes difference on EPG) and you exceeed the limit. Reduce that value by the line count again and you are still below.
    Could be coincidence as well, but makes me wonder.
    h6. Workaround
    To make sure that we were actually hitting that limit, I now introduce my suggestion for a workaround.
    Test case 3: Add a hidden item
    1. APEX Listener loads the page, stating the size to be *32876 bytes*
    2. EPG sees 30 bytes less and transmits the header with *32846 bytes*
    h6. Conclusion
    I can't give you a real solution for that problem, nor do I have a definitive answer on what is the root cause for it. It seems, only one of the developers may find it. But I can offer you a workaround, which is to just add some hidden item to your page so it exceeds the limit for the VARCHAR2 buffer and gets handled as clob.
    Note that this may occur outside the app builder as well. The app builder just renders some additional items when starting that page, so it has a different size from its productive representation. On the other hand, I may start counting the size of that additional page section - I wouldn't wonder if that results in a value around 400 bytes, and this is the forgotten part...
    Unfortunately, if it actually is happening outside of the app builder, this workaround isn't very handy: Dynamic contents can't be calculated that easy all the time, so you may have cases where you just don't know in advance if you are close to the limit and have to add some item to exceed it or if you've already exceeded it or if you are far below, or close enough to actually hit it when adding just one byte...
    -Udo

Maybe you are looking for

  • In af:query component , need to make Match option invisble

    Hi, i am using af:query component and do not want to show the Match with radio button options (All, Any). Can anyone suggest how to achieve this.

  • About third party components

    hi, where can i find components like tabbedpane , messagepane , menus to include in the pages . As i like to add as third party . It does not avail in standard jsf components yet.

  • New podcast subscription in iTunes store.

    the podcast that I submitted to the iTunes store got approved a couple of days ago and just started being displayed in it today. The information in the website for iTunes to pull in the image is correct and was in there when I submitted the podcast.

  • Solaris 10 scripts in /etc/rc2.d at boot time

    On Solaris 8, boot our scripts in /etc/rc2.d displayed echo to the console and allowed "read" from the console. In Solaris 10, the input/output from our scripts goes to msglog. How can I get these scripts to send output and receive input to the conso

  • ABAP Language

    Hello everyone,    I am working on the Netweaver 7.2L release. I see lot of ABAP language developments which are not there in Netweaver 7.11. Can anyone provide me with the information of what is new developed in the Netweaver 7.2L release Thanks and