DBAsupport.com Forums - Powered by vBulletin
Results 1 to 5 of 5

Thread: the max length of the varchar2 parameter in oracle stored function

Hybrid View

  1. #1
    Join Date
    Sep 2001
    Posts
    99
    I created a stored function. The function has a parameter. The parameter type is varchar2. I used jdbc called the stored function. The parameter in java is string. I want to know the max length of the varchar2 parameter in oracle. Would you tell me?
    please help.
    thanks
    ocean

  2. #2
    Join Date
    Nov 2000
    Location
    Israel
    Posts
    268
    Hi,
    The maximum length of VARCHAR2 data is 4000 bytes when creating a table with VARCHAR2 columns,
    but when using stored procedures/functions the maximum if VARCHAR2 data is 32767.


    create table T1 (a varchar2(4001));
    will succeed.
    create table T1 (a varchar2(4001));
    will fail.

    declare
    str varchar2(32767);
    begin
    null;
    end;
    /
    will work

    declare
    str varchar2(32768);
    begin
    null;
    end;
    /
    will fail

    regards,
    dbaora



  3. #3
    Join Date
    Nov 2000
    Location
    Israel
    Posts
    268

    mistake :(

    I wanted to write:
    create table T1 (a varchar2(4000));
    will succeed.
    create table T1 (a varchar2(4001));
    will fail.

    regards.

  4. #4
    Join Date
    Sep 2001
    Posts
    99

    thanks very much

    thanks
    ocean

  5. #5
    Join Date
    May 2001
    Location
    San Francisco, California
    Posts
    511
    If the database varchar2 column is 4k. In PL/SQL, you can define a varchar2 variable up to 32K. Note that if you want to insert this variable into a database column you have to trim it to 4k.

    [Edited by kris109 on 03-05-2002 at 02:43 PM]
    Remember the Golden Rule - He who has the gold makes the rules!
    ===================
    Kris109
    Ph.D., OCP 8i, 9i, 10g, 11g DBA

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width