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: Vince <vinnyop_at_yahoo.com>
Date: 21 Nov 2006 08:04:47 -0800
Message-ID: <1164125087.599048.8640@m73g2000cwd.googlegroups.com>

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

Original text of this message

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