Literal string is too long and too small string buffer

Hello

Can someone please explain what the difference is between these two errors.

The maximum size of the character in SQL is 4000 and PL/SQL its 32 k. So if a string literal exceeds this limit "string literal too long" error message is triggered by oracle.

Here is an example

SQL> select 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  2  xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  3  xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  4  xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  5  xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  6  xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  7  xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx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xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
 31  xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' str
 32    from dual;
select 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
       *
ERROR at line 1:
ORA-01704: string literal too long

Now, when you try to set a string variable with a value greater than the defined size, you get "too small character string buffer.

Here is an example

SQL> declare
  2    var varchar2(1);
  3  begin
  4    var := 'aa';
  5  end;
  6  /
declare
*
ERROR at line 1:
ORA-06502: PL/SQL: numeric or value error: character string buffer too small
ORA-06512: at line 4

Oracle error message there two of each, one for SQL and one for PL/SQL.

ORA-19011: character string buffer too small

Cause : the result of the chain asked is too big to go back

Action : get the result like a lob instead

ORA-01704: string literal too long

Cause : the string literal is longer than 4000 characters.

Action : use a string literal of more than 4,000 characters. Longer values can only be entered using bind variables.

PLS-01905: character string buffer too small

Cause : an error occurred while moving a string from a source to a destination. This error occurs if, for example, an attempt is made to move an a string of 10 characters into a buffer of 1 character. The cause of this error may not always be obvious. For example, the following will cause this error: a varchar2 (1); b the number; b: = 10; a: = b; An error occurs because an implicit conversion causes the number 10 to become the string '10', which does not fit in memory buffer of characters of 1 assigned to the variable.

Action : first, look for the character string assignment statements where the size of the buffer is incompatible. If there is none found, then consider the case of an implicit conversion shown in the example above.

PLS-00172: string literal too long

Cause : the string literal is longer than 32767octets.

Action : use a string literal of at most 32767octets.

Tags: Database

Similar Questions

  • not able to seeds and release - error report: 06502: PL/SQL: digital or value error: character string buffer too small.

    Hello

    After an upgrade of 4.2.4 5.0.0 we aren't able to seeds and publish the translation.

    There is report error: ORA-06502: PL/SQL: digital or value error: character string buffer too small.

    DB version is 11.2.0.3.0.

    Main language 'fr', translation 'sk '.

    APEX day language is "en".

    Any thoughts?

    Hello

    Fortunately, we have solved the problem.

    After upgrading a default sort to the report was to 'language '.

    If report error, that is fair enough to click on a prompt different orders of the report to change the sorting of the report.

    (the blank report is displayed at the bottom of the page, and you can see the guests)

    After the click the report updates and looks OK.

    Good day.

  • GATHER_TABLE_STATS and character buffer too small string error

    Hello

    I am trying to run stats gather on a partition of a table. It gives me the error below.
    There is no trigger or whatever it is on the table. Can you please help...

    BEGIN
    DBMS_STATS. GATHER_TABLE_STATS (ownname = > 'AB', tabname = > 'SAMPLE_TABLE_NAME_FRTEST',)
    estimate_percent = > DBMS_STATS. AUTO_SAMPLE_SIZE,
    partName = > 'SAMPLE_TABLE_NAME_FRTEST_201011');
    END;

    ORA-06502: PL/SQL: digital or value error: character string buffer too small
    ORA-06512: at "SYS." DBMS_STATS", line 13437
    ORA-06512: at "SYS." DBMS_STATS", line 13457
    ORA-06512: at line 2

    Here are the details of the version:
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
    PL/SQL Release 10.2.0.4.0 - Production

    Thank you.

    Published by: me * on 21/08/2011 17:10

    me * wrote:
    Hello

    I am trying to run stats gather on a partition of a table. It gives me the error below.
    There is no trigger or whatever it is on the table. Can you please help...

    BEGIN
    DBMS_STATS. GATHER_TABLE_STATS (ownname => 'AB', tabname => 'SAMPLE_TABLE_NAME_FRTEST',
    estimate_percent-online DBMS_STATS. AUTO_SAMPLE_SIZE,
    partName => 'SAMPLE_TABLE_NAME_FRTEST_201011');
    END;

    ORA-06502: PL/SQL: digital or value error: character string buffer too small
    ORA-06512: at "SYS." DBMS_STATS", line 13437
    ORA-06512: at "SYS." DBMS_STATS", line 13457
    ORA-06512: at line 2

    Here are the details of the version:
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
    PL/SQL Release 10.2.0.4.0 - Production

    Thank you.

    Published by: me * on 21/08/2011 17:10

    You get a maximum of 30 characters in the array, column, etc. names in Oracle.

    You have really a partition name exceeds?

    SAMPLE_TABLE_NAME_FRTEST_201011

    At more than 30 characters...

  • Select this OPTION to generate XML data from the table using XMLELEMENT, XMLAGG gives error ORA-19011 string buffer too small

    My select statement fails with the error:


    The ORA-19011 string buffer too small


    The select statement looks like:


    SELECT TO_CLOB)

    XMLELEMENT ("accounts",

    XMLELEMENT ("count",

    XMLATTRIBUTES)

    rownum AS "recordId."

    To_date('20130520','YYYYMMDD') AS "datestarted."

    123456 AS "previousBatchId."

    56789 AS 'previousRecordId '.

    ),

    ....

    .... .

    .....

    XMLFOREST)

    SIG_ROLE AS "SignatoryRole."

    To_char(TRANSFER_DATE,'YYYY-mm-DD') AS "TransferDate."

    NVL(Reason,0) AS 'reason '.

    ) AS the 'transfer '.

    )

    ()) AS CRDTRPT

    OF ANY_TABLE;

    • It looks like I can choose only 4000 characters using the SELECT statement (please, correct me if I'm wrong)

    I'd use the XMLGEN package. But the environment team says no mounted drives in the future with the arrival of the EXADATA.

    NO HARD DRIVE MOUNTED, NO ACCESS TO THE DATABASE DIRECTORIES

    No UTL_FILE

    I need to use the REEL spool the resulting XML data of the SELECT query.

    SQL is a standard in my org, but I can do with a PL/SQL solution also to load data into a table (cannot use a COIL with PL/SQL)

    What I do is:

    1. a column of type CLOB to a xml_report of the loading of the above SELECT query table
    2. Then using SELECT * FROM xml_report to SPOOL the data to a file report.xml

    No need of XMLTYPE data behind. Xml data stream is fine for me.

    In addition, I need to validate the XML file, also using XSD.

    Problem is that the resulting lines of the select query are supposed to be from 15000 to 20000 bytes long.

    Oracle database version: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production

    A Suggestion or a solution to this problem would be appreciated.

    (Sorry for the use of "BOLD", just to make it more readable and highlight the imp points)

    Bravo!

    Rahul

    It looks like I can choose only 4000 characters using the SELECT statement (please, correct me if I'm wrong)

    You use the right method.

    There is an implicit conversion from XMLType to the data type VARCHAR2 as expected by the function TO_CLOB, where the limitation, and the error.

    To serialize XMLType to CLOB, use the XMLSerialize function:

    SELECT XMLSerialize (DOCUMENT

    XMLELEMENT ("accounts",

    ...

    )

    )

    OF ANY_TABLE;

    For the rest of the requirement, I wish you good luck trying to spool the XML correctly.

    You may need to play around with the SET LONG and SET LONGCHUNKSIZE commands to operate.

  • I can longer open attached pdf files. I am able to preview the files, but they are too small for me to read.

    * Original title: attachments

    Help, please.

    I did something wrong (AGAIN!)

    I had no problem with access to attachments to my e-mails, but a problem occurred just.

    I can longer open attached pdf files.  I am able to preview the files, but they are too small for me to read.  When I click to open all the I get now is a kind of icon (in Microsoft Office Picture Manager) with which I can't do anything.

    It seems I should have arranged for Picture Manager automatically opens attachments to emails, but when this happens, I'm stuck as what I try, I can't do pdf files appear as they did.

    The help file does not really help.

    I hope it is something simple, even an old fool like me can do with your expert (and, I hope. friendly) help.

    My fingers are crossed.

    My apologies if I offended Protocol - this is my first venture.regards

    Octogenarian John

    PS My usual guru (aka grandson James) has acquired his first girlfriend, is not so disinclined to waste time me tutoring on the PC

    Create a file association.

    1. download and save the attachment to the office.
    2. right click on the saved file.
    3. Select: Open with on the shortcut menu.
    4. click on: choose [default] program.
    5. Select: (Whatever you have installed a PDF reader).
    6. check: always use the selected program to open this type of file.
    7. click on OK.

    This should allow you to open these attachments directly from email address now.

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

    Hello

    I am facing infinity listagg that 4000 bytes in listagg issue, so I created a defined user aggregate function suggested by asking tom team,

    https://asktom.Oracle.com/pls/Apex/f?p=100:11:0% 3A % 3A % 3A % 3aP11_QUESTION_ID: 2196162600402

    But I am facing the error as "digital or value error: character string buffer too small" in the Type on line 27 when questioning this way

    Select stragg (val) in the dummy_tab;

    My table has a column and the data type is varchar2 (50) and he has more than 300 documents,.

    can someone here help me to solve this problem.

    Thanks and greetings

    Guru

    Now if you followed this link, so I hope that you:

    (a) set the attribute of the object type to be a CLOB

    (b) sets the return value of your Mapper function to be a CLOB

    and not as in the example (which is the time before the existence of LISTAGG) as a Varchar2...

    HTH

  • "Character String Buffer too small" classic report Apex 3.2.1

    Hi all

    I know it's a very old version I mention here, but that's what we have in our environment, would be very grateful if anyone can help out.

    I have a classic report with the sub query in this, I have added a filter using an element from the selection list (P70_GROUP).

    SELECT VWS. ServerID AS Display_ID, vws. ServerID AS ID, vws. Host name, vws. ServerStatus, vws. SiteName AS Site vws. Customer, vws. CoreHours, vws. Patch_Notes, vws. PATCH_DEP, vws. Patch_Day, vws. PATCH_GROUPID, vws. PATCH_TIMEID AS VW_Live_Support FROM Time LEFT JOIN W_Patch_Groups wpg vws WE (vws. Patch_GroupID = wpg.ID) WHERE the vws. ID = ' no AND NVL (wpg. Ignore, 'n') = ' n AND ((: P70_GROUP > 1 AND vws.)) PATCH_GROUPID =: P70_GROUP) OR (: P70_GROUP = 1 AND vws.) (Patch_GroupID IS NULL) OR (NVL(:P70_GROUP,0) = 0)) AND (INSTR (UPPER (vws. Host name), SUPERIOR (NVL (: P70_SEARCH, vws.)) HostName))) > 0 OR INSTR (UPPER (vws. ServerStatus), SUPERIOR (NVL (: P70_SEARCH, vws.)) ServerStatus))) > 0 OR INSTR (UPPER (vws. SiteName), SUPERIOR (NVL (: P70_SEARCH, vws.)) SiteName))) > 0 OR INSTR (UPPER (vws. (Client), SUPERIOR (NVL (: P70_SEARCH, vws.)) Customer))) > 0 OR INSTR (UPPER (vws. CoreHours), SUPERIOR (NVL (: P70_SEARCH, vws.)) CoreHours))) > 0 OR INSTR (UPPER (vws. Patch_Notes), SUPERIOR (NVL (: P70_SEARCH, vws.)) (Patch_Notes))) > 0)

    This is when I select a group in the list, I get

    "error report:

    "ORA-06502: PL/SQL: digital or value error: character string buffer too small.

    an unusual thing, that I've noticed here is when I select "All groups", which returns the value 0, it is works well and return of 3700 lines but when I select any group that returns 10 to 20 lines I get the above error.

    does not include why it is, please help me.

    Kind regards

    Tauceef

    Hi all

    I am able to solve the problem by referring to the link below:

    Huge selection box fails...

    What I am able to solve without even changing the item type. Things are working fine now, but it would be really helpful if someone could give me their expert commentary on the solution above.

    Is this feasible? I'll be able to solve the problem forever, or it will cause problems again in the future?

    Kind regards

    Tauceef

  • Text editor enriched ORA-06502: PL/SQL: digital or value error: character string buffer too small

    Hello

    I have apex user 4.2.3 with enterprise database edition 11, I page include RICH TEXT EDITOR, when I add data to this text and save it will record successfully and when I try to view this information in another page I see all the data, as expected, the problem when I try to go to the same page as RICH TEXT EDITOR error message apper ORA-06502 : PL/SQL: digital or value error: buffer string too small, I see this link https://forums.oracle.com/thread/2461151?tstart=0 but I don't know how it solve it, the problem is made data at the point of the rich text editor.


    Any suggestion?


    Thank you

    Thanks for the reply,

    Its standard form with text rich field, my question she same as link above I added before

  • problem string buffer too small

    Hey, guys:

    I have a question may be stupid, I received the error "ORA-06502: PL/SQL: digital or value error: character string buffer too small" when I run a query. If I Uncomment ' and rox.status ='Active "" ' State, I do not have the error. I guess it's related to specific lines. I checked online, it looks like the length of a certain variable varchar2 is not enough, but I can't find cause. I also note that there could be an error on v_level in the function, I use number instead of type varchar2. but after I changed the type of v_level, the error is still there. I would be cautious, because this is a legacy system. Could someone help me on this problem?

    I have a query like this:
    select *
    from registration_offender_xref rox
    where SOR_OFFENDER_DETAILS.get_offender_level(rox.offender_ID)=3
    --and rox.status='Active'
    and rox.end_registration_date is not null;
    I get the error message like:

    ORA-06502: PL/SQL: digital or value error: character string buffer too small
    ORA-06512: at "get OUT. SOR_OFFENDER_DETAILS', line 124
    06502 00000 - "PL/SQL: digital error or the value of %s.

    SOR_OFFENDER_DETAILS.get_offender_level returns a numeric value from 1 to 3, or a null value. Here is the code
      function get_offender_level(p_offender_id IN NUMBER) return NUMBER as
      
          sex_offender_flag number;
          tier_level number;
          override_num number;
          
          v_status  varchar2(10);
         
          v_aggravated  varchar2(10); 
          v_habitual  varchar2(10); 
          v_level  varchar2(10); 
       
          
      
          cursor tierNum is  -- as May 22, 2008 per HKT of DOC (past portal code), Level/Tier is displayed for all offenders
                   select max(c.tier) 
          from sor_offense o, sor_offense_code c
                   where o.offender_id = p_offender_id
                   and o.OFFENSE_CODE = c.CODE_ID
          and upper(o.status) = 'ACTIVE';
        
      begin
      
          select count(*)
          into sex_offender_flag
          from registration_offender_xref rox
          where rox.offender_ID=p_offender_id
          and reg_type_ID=1;
      
          if sex_offender_flag>0 then 
          
              OPEN tierNum;
              FETCH tierNum INTO v_level;
                if tierNum%NOTFOUND then
                tier_level := null;
                end if;
              CLOSE tierNum;
              
              select tier_overRide into overRide_Num 
              from registration_offender_xref
              where offender_id = p_offender_id
              and reg_type_id = 1; 
              
              if overRide_Num is not null then
                v_level:=overRide_Num;
              end if;
              --dbms_output.put_line('overRide_Num:'||overRide_Num);    
              --dbms_output.put_line('after override:'||p_level);
     /*error line*/         
                select status,  decode(aggravated,'Y','Yes','No') aggravated, 
               decode(habitual,'Y','Yes','No') habitual
              into v_status,  v_aggravated, v_habitual
              from registration_offender_xref 
              where offender_id = p_offender_id
              and reg_type_id = 1;
              
                if upper(v_status) in ('COMPLETED', 'DECEASED', 'DELETED') then
                   v_level := null;
                end if;
               
               --dbms_output.put_line('before final:'||p_level);
               
                if v_aggravated = 'Yes' or v_habitual = 'Yes' or v_level = 3 then
                   v_level := 3;
                end if;
              
               --dbms_output.put_line('final:'||p_level);
              
                if override_num is not null then
                   v_level := overRide_Num;
                end if;    
              
                   else
          
                v_level:=null;
          
          end if;
          
          return v_level;
      
      end get_offender_level;
    Thank you very much!

    Sam

    Published by: lxiscas on May 23, 2013 08:38

    Published by: lxiscas on May 23, 2013 08:41

    Published by: lxiscas on May 23, 2013 09:01

    I do not pretend that it is your problem, but

    select status
    into v_status,
    from registration_offender_xref 
    

    But you said

          v_status  varchar2(10);
    

    Much better to say things like that

          v_status  registration_offender_xref.status%type;
    

    In this way, you know that your variable is declared with a good length, if the length of the column never changes, your code won't kaboom.

    See you soon,.

  • character string buffer too small error in table form

    Hi people,

    One of my tabular forms suddenly stopped working suddenly after 3 months of work perfectly. Then I ran into debugging and looks like something bad went my LOV like below:
         0.16968     0.00328     ...Execute Statement: begin begin SELECT TIME_DISPLAY D, TIME_RETURN R bulk collect into wwv_flow_utilities.g_display,wwv_flow_utilities.g_value FROM TS_HOURS ORDER BY 2; end; end;     4     
    8
         0.17292     0.03912     ...Execute Statement: begin begin select /*+ cardinality(t 10) */ disp, val bulk collect into wwv_flow_utilities.g_display,wwv_flow_utilities.g_value from table(wwv_flow_utilities.get_temp_lov_data(2)) t order by insert_order, disp; end; end;     4     
    100
         0.21211     0.00224     report error: ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    I have looked around and I saw a few others with the same problems but nothing that has like mine. Could someone please help me to find what is the problem? Thank you.

    I use Apex 4.1.1

    Hello

    the LOVs are displayed as a row okay? I wonder if it's some kind of a problem with the tabular forms?

    Concerning
    André

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

    Dear friends,

    We have a package customized for FTP PLSQL.
    I get ORA-06502: PL/SQL: digital or value error: character string buffer too small when the FTP service running.
    The FTP function call the HOST function that is in fact to launch the above mentioned error.
    Here is the code for FTP and HOST functions.
    FUNCTION HOST(text_in    IN VARCHAR2,
               result_out IN OUT VARCHAR2) RETURN BOOLEAN IS
    ret boolean;
    drun boolean;
    hid number;
    BEGIN
       dbms_output.put_line('host1 begin');
       ret := HOST(text_in,result_out,hid,drun,1);
       if not drun then
         dbms_output.put_line('not derun');
          return false;
       end if;
         dbms_output.put_line('after if');
       return ret;
    END HOST;
    FUNCTION GET_ENV(env IN VARCHAR2) RETURN VARCHAR2 IS
     res boolean;
     out varchar2(256);
    BEGIN
      res := HOST('echo '||env,out);
      return out;
    END GET_ENV;
    FUNCTION HOST(text_in      IN VARCHAR2,
              result_out IN OUT VARCHAR2,
              hostid     IN OUT NUMBER ,
              demrunning IN OUT boolean,
              maxlines   IN NUMBER DEFAULT NULL) RETURN BOOLEAN IS
      tempid      number;
      tempstat      varchar2(10);
      n           number;
      m           number;
      retry      number;
      mult           number;
      timestamp_date  date;
      lv_result_out varchar2(200);
    BEGIN
      --result_out := NULL; --fcxh76
      demrunning := true;
      dbms_output.put_line('host2 begin');
      select XXAR_SHELL_CMD_S.nextval
      into  tempid from dual;
      hostid := tempid;
    
      dbms_pipe.pack_message(tempid);
      n := dbms_pipe.send_message('CMD');
    
      dbms_pipe.pack_message(abs(maxlines));
      dbms_pipe.pack_message(rtrim(text_in));
      n := dbms_pipe.send_message ('CMD'||rtrim(to_char(tempid)),0);
    
      m := dbms_pipe.receive_message('CMDSTAT'||rtrim(to_char(tempid)),5);
      if m = 1 then
          demrunning := false;
          dbms_output.put_line('m=1');
          result_out := 'ERROR : GLCC0005 presumed not running';
          dbms_output.put_line('result_out - '||result_out);
          return FALSE;
      elsif m = 0 then
         dbms_pipe.unpack_message(tempstat);
      end if;
    
      if tempstat = 'ERROR' then
         dbms_output.put_line('tempstat = ERROR');
         result_out := NULL;
         dbms_output.put_line('after result out');
         return FALSE;
      end if;
    <<CHECK_AGAIN>>
         m := dbms_pipe.receive_message('RSLT'||rtrim(to_char(tempid)),0);
    
    if m <> 0 then
        goto CHECK_AGAIN;
    end if;
    
         if m = 0 then
                dbms_pipe.unpack_message(result_out);
                dbms_pipe.purge('RSLT'||rtrim(to_char(tempid)));
                return TRUE;
         else
             result_out := 'ERROR : Call to GLCC0006 failed';
             return FALSE;
         end if;
    END HOST;
    FUNCTION FTP (program_name in VARCHAR2,
               source_file in VARCHAR2,
               dest_file   in VARCHAR2 default NULL) RETURN BOOLEAN
    AS
    fd               utl_file.file_type;
    res            boolean;
    res1           boolean;
    out            varchar2(256);
    out1           varchar2(256);
    ftp_dnsname      varchar2(50);
    ftp_user         varchar2(50);
    ftp_pass         varchar2(50);
    ftp_pre_opt      varchar2(150);
    ftp_post_opt     varchar2(150);
    ftp_override     varchar2(150);
    destination_file varchar2(50);
    ftp_command      varchar2(2000);
    ftp_main         varchar2(2000);
    proc_id           varchar2(10);
    fderr             varchar2(100);
    rec           varchar2(1024);
    temp_buf      varchar2(100);
    base_source       varchar2(100);
    log_dir              varchar2(100) := get_env('$APPLCSF')||'/log';
    fndc_logfile_dir varchar2(100) := 'FNDC_LOGFILE_DIR';
    i            number ;
    ftp_tried        boolean;
    begin
     ftp_tried := false;
     dbms_output.put_line('begin');
    for ftp_rec in ( select  attribute1,
                       attribute2,
                       attribute3,
                       attribute4,
                       nvl(attribute5,' ') attribute5,
                       nvl(attribute6,' ') attribute6,
                       nvl(rtrim(attribute7),'put') attribute7
              from fnd_flex_values
              where  flex_value_set_id in
              (select flex_value_set_id
               from fnd_flex_value_sets
               where flex_value_set_name = 'CPC_FTPS'
              )
              and flex_value like program_name
              )
         LOOP
                 dbms_output.put_line('Looping');
               ftp_tried := true;
              ftp_dnsname      := ftp_rec.attribute1;
              ftp_user         := ftp_rec.attribute2;
              ftp_pass         := ftp_rec.attribute3;
              destination_file := ftp_rec.attribute4;
              if dest_file is not null then
                 destination_file := dest_file;
                    end if;
    
                                   if destination_file is null then
                    destination_file := base_name(source_file);
                end if;
                ftp_pre_opt      := ftp_rec.attribute5;
              ftp_post_opt     := ftp_rec.attribute6;
              ftp_override     := lower(ftp_rec.attribute7);
              dbms_output.put_line('host');
    
              res := HOST('echo $$',proc_id);
              dbms_output.put_line('proc_id - '||proc_id);
         dbms_output.put_line('after host');
         base_source := rtrim(base_name(source_file));
           dbms_output.put_line('host 1');
           res := HOST('>  '||log_dir||'/ftpcmd.'||proc_id ||
              ' ; chmod 777 '||log_dir||'/ftpcmd.'||proc_id,out1);
           dbms_output.put_line('host 2');
           res := HOST('>  '||log_dir||'/ftpmain.'||proc_id ||
              ' ; chmod 777 '||log_dir||'/ftpmain.'||proc_id,out1);
           dbms_output.put_line('host 3');
           res := HOST('>  '||log_dir||'/ftplog.'||proc_id ||
              ' ; chmod 777 '||log_dir||'/ftplog.'||proc_id,out1);
           dbms_output.put_line('host completed');
    ......
    ......
    ......
    Here is the PLSQL block that I will carry out and also the output on this block
    declare 
    lv_ftp_result boolean; 
    begin 
    lv_ftp_result := u.FTP('XXAR_REV_PA', ' ' || '/u07/app/qaoa083a/data/outgoing/xxar/PARECREV' || '/' || 'REVENUE_20120319014318.dat','REVENUE_20120319014318.dat');  
    IF lv_ftp_result THEN 
    dbms_output.put_line('True'); 
    ELSE 
    dbms_output.put_line('False'); 
    END IF; 
    exception 
    when others then 
    dbms_output.put_line('in exception - '||sqlerrm); 
    end;
    Output:
    host1 begin
    host2 begin
    m=1
    result_out - ERROR : GLCC0005 presumed not running
    not derun
    begin
    Looping
    host
    host1 begin
    host2 begin
    m=1
    in exception - ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    The flow of execution goes like this:
    1 FTP function called from PL/SQL block
    2 inside of the FTP service, the Sub statement calls the HOST function
    log_dir              varchar2(100) := get_env('$APPLCSF')||'/log';
    3. This HOST function in turn calls another function of overloaded HOST (code shown above).
    4. in the function overloaded with the HOST, the following statements are executed successfully, and FALSE is returned by the function
    dbms_output.put_line('m=1');
    result_out := 'ERROR : GLCC0005 presumed not running';
    dbms_output.put_line('result_out - '||result_out);
    5. the remaining code in the FTP service is running and the HOST function is called again using the Sub statement
    res := HOST('echo $$',proc_id);
    6.again, this HOST function in turn calls another function of overloaded HOST (code posted above).
    7. this time, in the function overloaded host, ORA-06502 is thrown when the following statement is executed and the execution stops here that this exception is unhandled.
    result_out := 'ERROR : GLCC0005 presumed not running';
    This statement is very successfully in the previous call to the function of HOST (step 4), but it fails now.

    Any idea on why this error occurs in this scenario? Because the issue of memory?

    DB Info:
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    PL/SQL Release 11.2.0.1.0 - Production
    Kind regards
    Anthony

    Published by: Anthony Alix on March 20, 2012 08:53

    Hello

    HOST (1) calls the function of MODERATOR (2) with his second parameter as result_out

    The first time you call the function of host (1) in the function get_env you use

    ...
     out varchar2(256);
    BEGIN
      res := HOST('echo '||env,out);
    ...
    

    out is big enough varchar2 (256)

    The second time you call (1) HOST of the FTP function as:

    ...
    ftp_main         varchar2(2000);
    proc_id           varchar2(10);
    fderr             varchar2(100);
    ...
    
    ...
              res := HOST('echo $$',proc_id);
              dbms_output.put_line('proc_id - '||proc_id);
    ...
    

    Here, use you proc_id which is varchar2 (10)

    And it's not big enough!

    Kind regards

    Peter

  • PL/SQL: digital error or value (string buffer of characters too small)

    Hi all

    Here is the procedure used to send notifications. It worked very well in the previous version of DB :-10.1.0.5.0 and it has been recently upgraded to 11.2.0.2.0.

    I respond very well, but when running it throws the error.
    PROCEDURE PROC_STATUS_MAIL_UNADJ IS
    
           K_BOUNDARY CONSTANT VARCHAR2(1000) := 'a1b2c3d4e3f2g1';
          l_analysis_report  VARCHAR2(32767); --empty_clob; --clob :=
          l_header VARCHAR2(1000);
          l_footer VARCHAR2(200);
          cnxn UTL_SMTP.connection;
    
          cursor cloc is select location_id from locations order by location_id asc;
    
          loc_id cloc%rowtype;
    
    BEGIN
    
      dbms_output.enable (1000000);
    
         FOR loc_id in  cloc
    
         loop
    
         l_analysis_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">Run Summary Report'
                    || TO_CHAR(SYSDATE, 'DD-MON-YYYY HH:MI AM') || '<br><br></font></b></center>'
                    || ' <div align="center"><table width="95%" border="1" cellspacing="0" cellpadding="1" </div>'
                    || '<span style="font-size: 10pt; font-family: Arial"> </span> '
                    || '<tr bgcolor=b4b4b4><td align="center"> <font size="3"> <b>'
                    || 'Analysis</b></td><td align="center"><font size="3"> <b>'
                    || 'Start Time</b></td><td align="center"><font size="3"> <b>'
                    || 'End Time</b></td><td align="center"><font size="3"> <b>'
                    || 'Run Duration (mins)</b></td><td align="center"><font size="3"> <b>'
                    || 'Status</b></font></td></tr> ' || UTL_TCP.CRLF;
    
    
                    FOR curr_refresh IN (SELECT AN.ANALYSIS_ID,AN.NAME ANALYSIS_NAME,TO_CHAR(ARH.RUN_START_TIME,'DD/MM/YYYY HH:MI:SS') START_TIME,
                                         TO_CHAR(ARH.RUN_END_TIME,'DD/MM/YYYY HH:MI:SS')END_TIME,
                                         ROUND(((ARH.RUN_END_TIME-ARH.RUN_START_TIME)*24*60),2) RUN_TIME_SECS,ARH.JOB_STATUS STATUS
                                         FROM
                                         RUN_HISTORY ARH,ANALYSES AN
                                         WHERE
                                         AN.ANALYSIS_ID=ARH.ANALYSIS_ID
                                         AND AN.CYCLE_IND_ID IN (1,3)
                                         AND ARH.RUN_START_TIME>TO_DATE(SYSDATE-30)
                                         AND ARH.JOB_NAME LIKE 'RHS_QU%'                                   
                                         AND AN.LOCATION_ID = loc_id.location_id
                                         AND ARH.JOB_STATUS='Completed'
                                         ORDER BY ARH.RUN_START_TIME DESC)
    
                           LOOP
    
                       l_analysis_report  := l_analysis_report ||'<tr><td align="center">'|| curr_refresh.analysis_name
                          || '</td><td align="center">' || curr_refresh.start_time || '</td><td align="center">'
                          || curr_refresh.end_time || '</td><td align="center">'|| curr_refresh.RUN_TIME_SECS ||
                          '</td><td align="center">'|| curr_refresh.status ||
                          '</td> </tr>' || UTL_TCP.CRLF;
                      exit when length (l_analysis_report) > 32500;
    
    
                   END LOOP;
    
                  l_analysis_report := l_analysis_report || '</table><br><br>';
                   l_footer := UTL_TCP.CRLF ||'<b> Note: This is an auto generated email. Please do not reply to it. Contact the IT team for any further information.</b>'||  UTL_TCP.CRLF;
    
    
                   FOR curr_email IN (SELECT GLOBAL_NAME INSTANCE_NAME,
                                      EU.EMAIL_USER_LAST_NAME last_name, EU.EMAIL_USER_FIRST_NAME ACNAME,
                                      EU.EMAIL_USER_EMAIL_ID,loc.LOCATION_NAME LOC_NAME,
                                      '[email protected]' MAIL_FROM
                                      FROM
                                      RHS_EMAIL_USER EU,LOCATIONS LOC,GLOBAL_NAME
                                      WHERE EU.LOCATION_ID=LOC.LOCATION_ID
                                      AND EU.LOCATION_ID=loc_id.location_id
                                  ) LOOP
    
                cnxn := UTL_SMTP.open_connection('smtprelay.inc.com', 25);
                UTL_SMTP.helo(cnxn, 'smtprelay.inc.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: Un-Adjusted Analysis Report for ' || curr_email.loc_name || ' Location from' || 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_analysis_report || l_footer);
                UTL_SMTP.quit(cnxn);
    
                
                END LOOP;
    
                END LOOP;
    
    END PROC_STATUS_MAIL_UNADJ;
    
    
    Error :- 
    
    ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    ORA-06512: at "SYS.UTL_SMTP", line 591
    ORA-06512: at "SYS.UTL_SMTP", line 497
    ORA-06512: at "SYS.UTL_SMTP", line 503
    ORA-06512: at "RISK_HISTORY.PKG_RHS_EMAIL_NOTIFY", line 206
    ORA-06512: at "RISK_HISTORY.PKG_RHS_EMAIL_NOTIFY", line 414
    ORA-06512: at line 2
    Can it please let me know if there is no problem with the code or upgrade questions?

    Kind regards
    Sunny

    Published by: k_17 on October 13, 2011 12:07

    You must move the thread {forum: id = 75}.

  • Concat XML - ORA-19011: character string buffer too small

    SQL > desc send_file
    Name Null? Type
    ----------------------------------------- -------- ------------
    THE APPLICATION NUMBER
    SYS XML_DOC. XMLTYPE


    insert into SEND_file (XML_DOC, REQUEST)
    SELECT
    XMLElement ("value",
    XMLElement ("id",
    XMLElement ("application")
    , XMLElement ("project", "A")
    , XMLElement ("Report", to_char (sysdate,'YYYY-MM-DD HH24:MI:SS'))))
    , XMLElement ("recordCount", count (REQUEST))
    ),
    XMLAgg)
    XMLElement ('count',
    XMLElement ("Name", "Name")
    , case when 'cCode' is not null then
    XMLElement ("cCode", "cCode") end
    XMLElement ("lNumber", "lNumber")
    XMLElement ("boxes", "boxes")
    )
    )
    -- )
    ), ASK
    Test_data_table GROUP on request
    /


    It works fine,
    but I want to add/concat ' <? XML version = "1.0" encoding = "UTF-8"? > ' this text to the above query

    as select ' <? XML version = "1.0" encoding = "UTF-8"? > ' | XMLElement ("value",
    XMLElement ("id",
    XMLElement ("request", ASK)... the rest of the query, and then

    I get this error message
    ORA-19011: too small character string buffer

    could you please let me know how can I cancat the value, as I have said that I have no problem same length is more than 4000, but now certain that the limits of XML type

    Thank you

    Try xmlroot

    select xmlroot(xmlelement("HI", 'hi'),version '1.0" encoding="UTF-8') from dual
    

    or

    select xmltype(''||xmlelement("HI", 'hi')) from dual
    

    Published by: Edward on July 12, 2011 11:58

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

    Dear gurus, I'm generation mail format html from oracle 10 g database.

    Display the data in html format message body are superior to more than 32 k.

    can you please guide me how to handle this error?

    ORA-06502: PL/SQL: digital or value error: character string too small buffer


    I use the long data type for message body data.

    http://asktom.Oracle.com/pls/asktom/f?p=100:11:4325516854017254:P11_QUESTION_ID:1739411218448

    see you soon

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

    Hi guys,.
    My version of the APEX is 3.0.1.00.08, my application run on my test environment, but on the PROD environment, she raised the error:
    error report:
    ORA-06502: PL/SQL: digital or value error: character string buffer too small

    On this page, on the left is a tree, the right side is a tabular presentation, when I click on a tree node, it will pass the id of the current node to the form and the form shows data from children. When I click on a tree node, it triggers the ORA-06502 error, but when click on some other nodes, it is correct. I don't know why. And on my test environment, it does not have this error, the test environment has same version with the prod environment, has only less data in the database. Could you help me?
    I searched in the forum, someone said it's LOV problem, if there is problem LOV, all nodes must have the error, why click on some nodes are ok?

    Thank you!

    Jessica

    I don't know, but why do you need a semicolon at the end of the SQL?

    Denes Kubicek
    -------------------------------------------------------------------
    http://deneskubicek.blogspot.com/
    http://www.Opal-consulting.de/training
    http://Apex.Oracle.com/pls/OTN/f?p=31517:1
    -------------------------------------------------------------------

Maybe you are looking for