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 -> Re: Column length question.

Re: Column length question.

From: Mark D Powell <Mark.Powell_at_eds.com>
Date: 21 Nov 2006 07:47:43 -0800
Message-ID: <1164124063.327195.41160@f16g2000cwb.googlegroups.com>

On Nov 21, 10:14 am, Serguei.Goumeni..._at_cibc.ca wrote:
> Dear Experts,
> As I know it is possible to use in stored procedures a column type
> definition for a variable declaration like the following:
>
> myVariable tableName.columnName%TYPE;
>
> Is it possible (and how) to use a column size definition? Something
> like:
>
> IF (length(myVariable) > tableName.columnName%SIZE) THEN
> .... do something ....
> END IF;
>
> Regards,
> Serguei.

If you want to test the length of a variable against the definition of the variable then look in the rdbms dictionary. The dba_tab_columns view and its relatives contain the column datatype length.

Otherwise you can compare the length(variable_a) against the length(variable_b) or use substr to limit the number of bytes copied to the length of the receiver: variable_a := substr(variable_b,1,20).

HTH -- Mark D Powell -- Received on Tue Nov 21 2006 - 09:47:43 CST

Original text of this message

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