Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Column length question.
Serguei.Goumeniouk_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.
Serguei, you are going to generate an exception if the length is too long at the time you assign the value to the variable, by virtue of the way you declared myVariable. You could create an exception handler for it:
DECLARE myVariable tableName.columnName%TYPE;
BEGIN myVariable := someValue;
EXCEPTION
WHEN VALUE_ERROR THEN
do something
END; Received on Tue Nov 21 2006 - 10:04:47 CST
![]() |
![]() |