Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Column length question.
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