Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> How to get maximum allowed length when using %type for varchar?

How to get maximum allowed length when using %type for varchar?

From: Arjan van Bentem <avbentem_at_DONT-YOU-DAREdds.nl>
Date: Sun, 4 Oct 1998 15:44:30 +0200
Message-ID: <6v7u3v$51a$1@pascal.a2000.nl>


Quite often I need to know the length of the string I am allowed to assign to my_var, when my_var is declared using %type. For example, when I have defined

    create my_table( my_varchar2_col varchar2(10) );     declare
      my_var my_table.my_varchar2_col%type;     begin
      my_var := substr( 'A large string, that exceeds the size of my_var...'

, 1
, max_length

                      );

    end;

then I need to know the value for max_length.

I know it can be found in all_tab_columns or user_tab_columns. Is there an easier way to get this value? Or another function instead of substr(..) ?

Thanks,
Arjan. Received on Sun Oct 04 1998 - 08:44:30 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US