VARCHAR2 limit

I am using the JDBC thin driver (class12.zip).
I have a field with VARCHAR2(4000), and when I wrote to this
field from my java code with a string longer than 2000
characters, oracle complained. It seems oracle only accepts up
to 2000 characters.
When I tried to update the field from DBArtisan directly, I
could write to the field upto 4000 characters.
Is this something related to Java or the JDBC driver? How do I
solve this problem?
Thanks.
[email protected]

helooo Wang what is ur oracle Version?
Now from oracle8.x on words the varchar2 size is increased from
2000 to 4000.
thanks
keesara
[email protected]

Similar Messages

  • VARCHAR2 limit problem

    I am using the JDBC thin driver (class12.zip).
    I have a field with VARCHAR2(4000), and when I wrote to this
    field from my java code with a string longer than 2000
    characters, oracle complained. It seems oracle only accepts up
    to 2000 characters.
    When I tried to update the field from DBArtisan directly, I
    could write to the field upto 4000 characters.
    Is this something related to Java or the JDBC driver? How do I
    solve this problem?
    Thanks.
    [email protected]

    Apparently your project is about reinventing the wheel, as dbms_sql is already capable of parsing a statement bigger than 32k, and describing all the columns of that statement.
    Please refer to the dbms_sql documentation for your unnamed version (Oracle never changes, and never releases new versions).\
    Alternatively: did you ever hear of CLOBs?
    Sybrand Bakker
    Senior Oracle DBA

  • Overcoming VARCHAR2 size limitation

    Hi,
    We have a VARCHAR2 column in a table to store text information. At present the size is 4000. We want to increase the size to 7000.
    Can anyone help me giving your suggessions?
    Oneway is we can change the datatype to LONG (as you know the max size is 4000 for VARCHAR2) . But this will not solve the purpose as I need to apply functions on this column (like SUBSTR,etc).
    Thanks.

    You can use dbms_lob functions to access CLOBS, so changing the datatype may not be as problematic as you think.
    Also, in PL/SQL the VARCHAR2 limit is 32767, not 4000, so if you're accessing the table via a stored procedure you can change the column datatype to CLOB. Provided the data is less than 32767 in length you can use a PL/SQL variable to manipulate it.
    Incidentally, use CLOB not LONG for future compatibility.

  • Return value from function within package

    Hi,
    There is a function within a pl/sql package that I am trying to get data from. The problem is that the data returned can be up to 32,767 chars (varchar2 limit).
    It accepts 3 input parameters and returns on varchar2.
    The only way I can get it to work is using this syntax:
    ==================================
    variable hold varchar2(4000);
    call TrigCodeGenerator.GenerateCode(VALUE1', 'VALUE2','VALUE3') into :hold;
    print hold;
    =====================================
    However, if the data returned is greater than 4000 then I get this error:
    ERROR at line 1:
    ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    ORA-06512: at line 1
    I can't increase the size of the variable (hold) as there seems to be a limitation on this type of variable.
    Also, I am running this in sql plus worksheet. Will it limit the display of the data (assuming, that someone can get the whole 32,767 chars displayed back) ?
    Thanks in advance,
    Ned

    Never mind,
    I declared the variable hold as clob and set the long and longchunksize parameters to 100,000 and it seems to work.

  • PL/SQL CLOB and comma seperated list

    Hi,
    i´am beginner!
    I have a table with a clob field with a comma separeted list. The content can be '', '44' or '44,55...' as an example.
    So how can i get the values in clob and search another table?
    Something like...
    select clob from table1
    each clob
    select * from table2
    where table2.id = (clob value)
    ... do somtheing further
    Thank you,
    Jochen

    Ok... it depends...
    If you know your CLOB is going to hold a list of values that are less than 4000 characters, you can simply treat the CLOB as a VARCHAR2 and perform one of the many techniques for splitting that string to give a varying IN list...
    e.g.
    SQL> ed
    Wrote file afiedt.buf
      1  select *
      2  from emp
      3  where ename in (
      4    with t as (select '&input_string' as txt from dual)
      5    select REGEXP_SUBSTR (txt, '[^,]+', 1, level)
      6    from t
      7    connect by level <= length(regexp_replace(txt,'[^,]*'))+1
      8*   )
    SQL> /
    Enter value for input_string: SCOTT,JAMES
    old   4:   with t as (select '&input_string' as txt from dual)
    new   4:   with t as (select 'SCOTT,JAMES' as txt from dual)
         EMPNO ENAME      JOB              MGR HIREDATE                   SAL       COMM     DEPTNO
          7788 SCOTT      ANALYST         7566 19-04-1987 00:00:00       3000                    20
          7900 JAMES      CLERK           7698 03-12-1981 00:00:00        950                    30
    SQL>(or alternatively read here: http://tkyte.blogspot.com/2006/06/varying-in-lists.html)
    If it's going to exceed the SQL VARCHAR2 limit of 4000 characters then you would most likely need to create a Pipelined function to split your CLOB into it's component values and return each one, thus allowing you to treat the results as a table of their own... e.g.
    Note: this example is for a pipelined function that splits a varchar2 string, but you could adapt it to use the DBMS_LOB package to split a CLOB in the same manner...
    SQL> CREATE OR REPLACE TYPE split_tbl IS TABLE OF VARCHAR2(4000);
      2  /
    Type created.
    SQL> CREATE OR REPLACE FUNCTION split (p_list VARCHAR2, p_delim VARCHAR2:=' ') RETURN SPLIT_TBL PIPELINED IS
      2      l_idx    PLS_INTEGER;
      3      l_list   VARCHAR2(4000) := p_list;
      4      l_value  VARCHAR2(4000);
      5    BEGIN
      6      LOOP
      7        l_idx := INSTR(l_list, p_delim);
      8        IF l_idx > 0 THEN
      9          PIPE ROW(SUBSTR(l_list, 1, l_idx-1));
    10          l_list := SUBSTR(l_list, l_idx+LENGTH(p_delim));
    11        ELSE
    12          PIPE ROW(l_list);
    13          EXIT;
    14        END IF;
    15      END LOOP;
    16      RETURN;
    17    END SPLIT;
    18  /
    Function created.
    SQL> SELECT column_value
      2  FROM TABLE(split('FRED,JIM,BOB,TED,MARK',','));
    COLUMN_VALUE
    FRED
    JIM
    BOB
    TED
    MARK
    SQL> create table mytable (val VARCHAR2(20));
    Table created.
    SQL> insert into mytable
      2  select column_value
      3  from TABLE(split('FRED,JIM,BOB,TED,MARK',','));
    5 rows created.
    SQL> select * from mytable;
    VAL
    FRED
    JIM
    BOB
    TED
    MARK
    SQL>... and once you can treat the values like a table it's just a case of using it like you would any table of values i.e. join on it or use it in an IN statment with a subselect etc.

  • Limitations in using a function within a select statement

    I have a function which retrieves various data elements from the
    database and formats it accordingly. The data (varchar2)
    returned could be in excess of 2,000 characters length.
    I need to use the returned data as part of a view. I am able to
    use the function in a "select" statement, but when I use it with
    returned data in excess of 2,000 chars, I get the following
    error:
    ORA-06502: PL/SQL: numeric or value error
    This error is occurring whenever the returned data is in excess
    of 2,000 characters.
    Is there an alternative method to what I am proposing, I have
    tried alternative data types but if I am able to use it in a
    "select" statement, I get the above error when the returned
    length exceeds 2,000 chars.
    Thanks
    Peter

    are u using oracle 7. varchar2 limit in 8 is 4000.

  • Converting CLOB to BLOB at once

    Hello all!
    I have to convert CLOB to BLOB in my application. My CLOB contains XML document built with dbms_xmldom, an I need to put it into column of type BLOB. Knowing several ways to do it, I'm searching for the best one. So I considered the folowing:
    - Size of XML data can be more then 4000 bytes.
    - I can convert it "piecewise", copying through varchar2 and raw buffers by chunks. But this is not efficient for me.
    - I can write CLOB to file, then read it into BLOB. But it is not efficient too.
    - I can not change column type to CLOB since it may contain other BLOB data, not XML.
    Actually, I need a way to "cast" CLOB data as binary data when inserting into table. I believe Oracle must have it, but where?
    I'll be very grateful for help from anyone.
    P.S. Using Oracle 9.2

    You could use UTL_RAW.CAST_TO_RAWhttp://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96612/u_raw2.htm#998330
    The XML data can be 32k (the varchar2 limit in PLSQL is 32k, not 4000 bytes)
    If your documents exceeds 32k you need process chunks

  • Unexpected "numeric or value error" when using CAST COLLECT

    I am having trouble with string aggregation using CAST / COLLECT and the to_string function described on various sites around the net including AskTom and http://www.oracle-developer.net/display.php?id=306.
    I am getting "numeric or value error: character string buffer too small" but cannot see which limit I am exceeding.
    I have put together a simple test case to highlight this problem which I have pasted below.
    The error does not seem to be coming from the to_string function itself (else I expect we would see "TO_STRING raised an exception" in the returned error message).
    Any thoughts much appreciated,
    Thanks, Andy
    SQL*Plus: Release 10.1.0.4.2 - Production on Tue Jun 15 09:56:53 2010
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    SQL> CREATE TYPE table_of_varchar2 AS TABLE OF VARCHAR2(32000);
      2  /
    Type created.
    SQL> CREATE OR REPLACE FUNCTION to_string (
      2              nt_in IN   table_of_varchar2
      3      ,       delimiter_in    IN VARCHAR2 DEFAULT ',')
      4      RETURN VARCHAR2
      5      IS
      6          l_idx   PLS_INTEGER;
      7          l_str   VARCHAR2(32767);
      8          l_dlm   VARCHAR2(10);
      9
    10      BEGIN
    11
    12          l_idx := nt_in.FIRST;
    13          WHILE l_idx IS NOT NULL LOOP
    14              l_str := l_str || l_dlm || nt_in(l_idx);
    15              l_dlm := delimiter_in;
    16              l_idx := nt_in.NEXT(l_idx);
    17          END LOOP;
    18
    19          RETURN l_str;
    20      EXCEPTION
    21          WHEN OTHERS THEN
    22              raise_application_error(-20000
    23                                  ,   'TO_STRING raised an exception. '||
    24                                      'The reported error was: '||sqlerrm);
    25     END to_string;
    26  /
    Function created.
    SQL> DECLARE
      2      l_longstring varchar2(32000);
      3  BEGIN
      4      SELECT  to_string(CAST( COLLECT( substr(object_name,1,1) ) AS table_of_varchar2 ) )
      5      INTO    l_longstring
      6      FROM    all_objects
      7      WHERE   rownum < 2001;
      8
      9  EXCEPTION
    10      WHEN OTHERS THEN
    11          raise_application_error(-20001
    12                ,   'The anonymous block raised an exception: '||
    13                    sqlerrm||'. '||DBMS_UTILITY.format_error_backtrace);
    14  END;
    15  /
    PL/SQL procedure successfully completed.
    SQL> DECLARE
      2      l_longstring varchar2(32000);
      3  BEGIN
      4      SELECT  to_string(CAST( COLLECT( substr(object_name,1,1) ) AS table_of_varchar2 ) )
      5      INTO    l_longstring
      6      FROM    all_objects
      7      WHERE   rownum < 2002;
      8
      9  EXCEPTION
    10      WHEN OTHERS THEN
    11          raise_application_error(-20001
    12                ,   'The anonymous block raised an exception: '||
    13                    sqlerrm||'. '||DBMS_UTILITY.format_error_backtrace);
    14  END;
    15  /
    DECLARE
    ERROR at line 1:
    ORA-20001: The anonymous block raised an exception: ORA-06502: PL/SQL: numeric
    or value error: character string buffer too small
    ORA-06512: at line 1. ORA-06512: at line 1
    ORA-06512: at line 4
    ORA-06512: at line 11

    Aha, of course.
    I was aware of the 4000 character SQL VARCHAR2 limit but didn't think it would apply here since we are calling a PLSQL function and trying to assign the value it returns into a PLSQL varchar2(32000) variable. BUT... we are of course doing this via a SELECT statement and hence via SQL. Therefore the SQL 4000 limit applies.
    With this in mind, I changed the RETURN type of the to_string function to be CLOB. This solved the problem.
    Thank you,
    Andy

  • PL/SQL COMWRAP.SQL COM Automation in Windows

    Hello All,
    Mike here. I'm not sure which forum this should go in so I put it here.
    I'm writing a pl/sql procedure that calls ordcom (create by comwrap.sql) which uses orawpcom11.dll to work with com automation objects on windows. It appears that there is a limit on the amount of data that can be passed back to Oracle (approx. 34kb stored as a file). My best guess is that comwrap.sql doesn't provide for returned text steams that are larger than that provided by varchar2 in pl/sql. I tried adding to the comwrap.sql to have clob as a return type but that does not work.
    I am attempting to get back XML from a Windows component (SDK to Quickbooks) that I can then store in an XMLType table. This works when all of the returned XML (from the SDK com object) stays under 34kb (stored as a file). If I remember correctly, 33950 characters are returned at the maximum. Of course, when the XML should be longer, I can't store it because it is not correctly formed XML (incomplete).
    Does anyone know what is occuring and a way to get around this? Any help is appreciated.
    Thanks,
    Mike

    The actual size is 32767 bytes Mike. And I'm not sure what happened to the last byte to make it 32768 and exactly 32KB. ;-)
    You cannot change a varchar2 data type for a clob data type. These two types are quite different when it comes to memory allocation and management of variables of that type. These methods are incompatible. Essentially a clob variable is a "locator variable" (aka lob locator). Just another word for a pointer.
    Declaring a clob variable is simply defining a pointer variable that, as yet, points to nothing. The clob needs to be created, memory allocated, and the point/locator must be set to this chunk of clob memory allocated.
    Declaring a varchar2 variable results in the compiler doing the actual work at compilation time - reserving space for that variable and setting that variable's address to this preallocated space.
    In terms of client-server, this a tad more complex. The data sits in the client. The data must be passed to the server. So there is a client variable. There is a server variable. And the content of one needs to be copied/pushed/transferred somehow from client variable to server variable.
    Windows supports a set of data types. Oracle supports a different set. Why? Despite Oracle on Windows, Oracle also runs on something like a 100 other operating systems too. There are endian issues. CPUs dealing differently with reals and floats and integers. Oracle has thus its own abstraction layer and implement is own consistent set of data types - across all platforms.
    So when pushing data from a client variable (like a COM object var) into a server variable (like a CLOB), it is not as simple as "copy-and-paste".
    PL/SQL "understand" basic Windows data types like zero terminated strings - which it can accept into varchar2 variables. But as PL/SQL has a 32KB (less one byte) varchar2 limit, it cannot accept a huge Windows string (or data stream). And getting that to work via a clob, very likeky requires changes in the interface between client and server that does this transfer of data.
    It requires more than just changing the server variable's data type from varchar2 into a clob, unfortunately. You will need to read up on Oracle's EXTPROC interface (I expect this is what is being used to interface with COM objects?) to see how to deal with LOB data types in this respect.

  • Overcoming file descriptor limitation?

    Hello,
    I am developing a server, which should be able to handle more than 65535 concurrent connections. I have it implemented in Java, but I see limit in file descriptors. Since there is no fork() call in Java, I can't find out what to do.
    The server is basically some kind of HTTP proxy and the connection often waits for upstream HTTP server to handle the connection (which can take some time, during which I need to leave the socket open). I made a simple hack, which helped me, I used LD_PRELOAD to catch bind() library call and set Linux socket option TCP_DEFER_ACCEPT
                    if (setsockopt(sockfd, IPPROTO_TCP, TCP_DEFER_ACCEPT, (char *)&val, sizeof(int)) < 0) ....This tells kernel to accept() connection only when there's some data there, which helps a little (sockets waiting for handshake and request to come don't have to consume file descriptor). Any other hints? Should I somehow convince java to fork()? Or should I switch to 64-bit kernel and 64-bit java implementation?
    I can quite easily switch to Solaris if that would help.
    Any pointers/solutions appreciated.
    Juraj.

    You can use dbms_lob functions to access CLOBS, so changing the datatype may not be as problematic as you think.
    Also, in PL/SQL the VARCHAR2 limit is 32767, not 4000, so if you're accessing the table via a stored procedure you can change the column datatype to CLOB. Provided the data is less than 32767 in length you can use a PL/SQL variable to manipulate it.
    Incidentally, use CLOB not LONG for future compatibility.

  • Concatenating clobs

    Hi
    I have a question on concatenating many small clobs into a large. DB = 11.2.0.1.
    The following is a sample set of data;
    create table t_bi001_payment
    (customer_number number
    ,payment clob
    begin
    for i in 1..1000 loop
    insert into t_bi001_payment (customer_number
                                ,payment)
    values  
    (1
    ,'200003783511655968                   000000000000100000320000000000100
    26Kalles Plåt AB
    27Storgatan 2                        12345
    28Storåker
    29005500001234
    210003783511                    898540000000000000500002200023000011100
    26Kalles Plåt AB
    27Storgatan 2                        12345
    28Storåker
    2900550000' || lpad(i, 4, '0'));
    end loop;
    commit;
    end;
    /There are thousands of such clobs, which have to be concatenated per customer into a single clob.
    Each clob should start on a new line.
    The first technique I used was connect by, which I picked up from; http://www.williamrobertson.net/
    create table abc (c clob)
    insert into abc (c)
    select ltrim(max(sys_connect_by_path(payment,',')) keep (dense_rank last order by curr),',') as clob_val
    from   (select customer_number
                  ,payment
                  ,row_number() over (partition by customer_number order by customer_number) AS curr,
                   row_number() over (partition by customer_number order by customer_number) -1 AS prev
            from   t_bi001_payment)
    group by customer_number
    connect by prev = prior curr and customer_number = prior customer_number
    start with curr = 1
    commit
    /The above statement returns error:
    ORA-01489: result of string concatenation is too long
    The following statement is an alternative method:
    insert into abc (c)
    select to_clob(concatenated)
    from
    select   xmlagg (xmlelement (c, payment || chr(13))).extract ('//text()') as concatenated
    from     t_bi001_payment
    group by customer_number
    commit
    /The above statement returns a similar error, but different message:
    ORA-19011: Character string buffer too small
    I realise that in both cases the SQL 4000 varchar2 limit has been reached.
    The question I have is how can I concatenate hundreds or possibly
    thousands of clobs (all relatively small, mostly around 1 or 2k)
    into a single larger clob using SQL without having to revert to PL/SQL ?
    thx
    Edited by: bluefrog on Mar 8, 2011 10:52 AM

    Oddly, I was just looking at the following example code in relation to another thread.
    This is a user defined aggregate function for concatenating clobs...
    create or replace
      type clobagg_type as object(
                                  text clob,
                                  static function ODCIAggregateInitialize(
                                                                          sctx in out clobagg_type
                                    return number,
                                  member function ODCIAggregateIterate(
                                                                       self  in out clobagg_type,
                                                                       value in     clob
                                    return number,
                                  member function ODCIAggregateTerminate(
                                                                         self        in     clobagg_type,
                                                                         returnvalue    out clob,
                                                                         flags       in     number
                                    return number,
                                  member function ODCIAggregateMerge(
                                                                     self in out clobagg_type,
                                                                     ctx2 in     clobagg_type
                                    return number
    create or replace
      type body clobagg_type
        is
          static function ODCIAggregateInitialize(
                                                  sctx in out clobagg_type
            return number
            is
            begin
                sctx := clobagg_type(null) ;
                return ODCIConst.Success ;
          end;
          member function ODCIAggregateIterate(
                                               self  in out clobagg_type,
                                               value in     clob
            return number
            is
            begin
                self.text := self.text || value ;
                return ODCIConst.Success;
          end;
          member function ODCIAggregateTerminate(
                                                 self        in     clobagg_type,
                                                 returnvalue    out clob,
                                                 flags       in     number
            return number
            is
            begin
                returnValue := self.text;
                return ODCIConst.Success;
            end;
          member function ODCIAggregateMerge(
                                             self in out clobagg_type ,
                                             ctx2 in     clobagg_type
            return number
            is
            begin
                self.text := self.text || ctx2.text;
                return ODCIConst.Success;
            end;
    end;
    create or replace
      function clobagg(
                       input clob
        return clob
        deterministic
        parallel_enable
        aggregate using clobagg_type;
    SQL> select trim(',' from clobagg(ename||',')) as enames from emp;
    ENAMES
    SMITH,ALLEN,WARD,JONES,MARTIN,BLAKE,CLARK,SCOTT,KING,TURNER,ADAMS,JAMES,FORD,MILLER
    SQL>Not my code, just one I've picked up from elsewhere over time.

  • CLOBs

    I guess this question have been raised a lot before but I really need fast access to information right now. I just want to ask for information, or maybe a link, about CLOBs. Mainly, information on what they do and how to use them, their limitations, and how to convert to and from strings. Thanks a lot for all the help.

    A CLOB could store upto 4GB (as of Oracle9i). Since a SQL VARCHAR2 limit is 4K, in order to store anything up and above 4K, you would have to use CLOB.
    Starting Oracle9i, for most practical purposes, a VARCHAR2 could be replaced where ever a CLOB is required (and vice-versa).
    For handling of CLOB data, you would typically use DBMS_LOB package. See documentation for more details on CLOB andDBMS_LOB package.

  • Procedure varchar2 parameter size limit? ORA-6502 Numeric or value error

    Hi ALL,
    I am trying to create out parameters in a Procedure. This procedure will be called by 4 other Procedures.
    PROCEDURE create_serv_conf_attn_cc_email
    ( v_pdf_or_text varchar2,
    v_trip_number number ,
    v_display_attn_for_allmodes out varchar2,
    v_display_cc_for_allmodes out varchar2,
    v_multi_email_addresses out varchar2,
    v_multi_copy_email_addresses out varchar2
    When I call that procedure in another Procedure I am getting following error, which is caused by one of the out parameter being more than 255 characters.
    I found that out via dbms_output.put_line(ing) one of the out parameter as I increased its size.
    ORA-06502: PL/SQL: numeric or value error
    I thought there was no size limit on any parameters passed to a Procedure.
    Any one know of this limit of 255 characters on varchar2 Procedure parameters? Is there a work around keeping the same logic?
    If not I will have to take those parameters out and resort to some global varchar2s which I do not like.
    Thanks,
    Suresh Bhat

    I assume one of the variables you have declared is not large enough for it's assignment.
    Here's an example.
    ME_XE?create or replace procedure test_size(plarge in out varchar2 )
      2  is
      3  begin
      4     plarge := rpad('a', 32000, 'a');
      5  end;
      6  /
    SP2-0804: Procedure created with compilation warnings
    Elapsed: 00:00:00.03
    ME_XE?
    ME_XE?declare
      2     my_var   varchar2(32767);
      3  begin
      4     test_size(my_var);
      5     dbms_output.put_line(length(my_var));
      6  end;
      7  /
    32000
    PL/SQL procedure successfully completed.
    --NOTE here how the declared variable is 500 characters, but the procedure will try to assign it over 32,000 characters...no dice
    Elapsed: 00:00:00.00
    ME_XE?
    ME_XE?declare
      2     my_var   varchar2(500);
      3  begin
      4     test_size(my_var);
      5     dbms_output.put_line(length(my_var));
      6  end;
      7  /
    declare
    ERROR at line 1:
    ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    ORA-06512: at "TUBBY.TEST_SIZE", line 4
    ORA-06512: at line 4
    Elapsed: 00:00:00.04Edited by: Tubby on Oct 22, 2008 12:47 PM

  • Query related to MAX limit of VARCHAR2

    Hello,
    I have run the below PL/SQL block and it gives out the o/p as follows:
    DECLARE
      LEN1  NUMBER;
    BEGIN
      SELECT LENGTH(RPAD('*', 32760, '*')) INTO LEN1 FROM DUAL;
      DBMS_OUTPUT.PUT_LINE('LEN1: '||LEN1);
    END; Output--> LEN1: 4000
    But why is it that when i run the same PL/SQL block by assigning the 32K character string to a variable it throws an error -
    DECLARE
      LEN1  NUMBER;
      STR   VARCHAR2(32767);
    BEGIN
      STR := RPAD('*', 32760, '*');
      SELECT LENGTH(STR) INTO LEN1 FROM DUAL;
      DBMS_OUTPUT.PUT_LINE('LEN1: '||LEN1);
    END;  Output-->
    ORA-01460: unimplemented or unreasonable conversion requested
    ORA-06512: at line 8
    I understand that VARCHAR2 has a limit of 4000 chars in SQL and 32767 chars in PL/SQL. If so, why not the second block atleast return 4000 going with this limitation?
    Regards,
    Sujana

    Hi,
    Maximum size for VARCHAR2 is 4000. So you cant add 32767 characters to a variable which you have defined with VARCHAR2 datatype.
    Below will work
    DECLARE
      LEN1  NUMBER;
      STR   VARCHAR2(32767);
    BEGIN
      STR := RPAD('*', 4000, '*');
      SELECT LENGTH(STR) INTO LEN1 FROM DUAL;
      DBMS_OUTPUT.PUT_LINE('LEN1: '||LEN1);
    END;Thanks,
    Suri
    Edited by: Suri on Aug 8, 2012 1:50 PM
    Edited by: Suri on Aug 8, 2012 1:52 PM

  • Impdp error number of bytes exceeds limit of varchar2

    Hi,
    I have a problem migration data from one database with western Europe character set to a new database with UTF-8 charter set. I know that this has to do with some characters using more then one byte in UTF character database. But as I have one column varchar2 is configured with 4000 byte as limit and imp reports error as some rows exceeds 4000 and actual requirement is 4009 byte which is not possible as limit of varchar2 is 4000 byte.
    I need to identify the rows that exceed 4000 byte.
    Changing datatype is not an option.
    Anyone have any ideas on how to identify the rows that exceeds 4000 bytes or anyone have a query that makes it possible to query existing environment with all rows above 3980 byte in this one column?
    Regards
    933746

    JohnWatson wrote:
    The csscan Character Set Scanner utility will report all the rows that will be damaged by the character set change (though you'll have to fix them yourself), it is described in the Globalization Support Guide.Thanks I'll look into it.
    I haven't run csscan on this database but ofc on all others :)

Maybe you are looking for