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: length function

Re: length function

From: <karsten_schmidt8891_at_my-deja.com>
Date: Tue, 09 Nov 1999 16:11:12 GMT
Message-ID: <809h2s$30m$1@nnrp1.deja.com>


Hi,

 lenght is a character function.
 when applied to a number field (or variable), oracle implicitly  converts that number to varchar2 (stripping leading zeros).  either use character fields, or do an explicit conversion (specifying  a format model that preserves leading zeros.

 as in length(to_char(home_three,'0999')

 note that your model would only work in us/canada/australia.  other countries may (and do!) have different conventions on phone  numbers - such as
 varying length area-codes / phone numbers.

Karsten

In article <6pMV3.14299$Ph7.98972_at_insync>,   "Joet Singh" <jsingh_at_bigfoot.com> wrote:
> Hi All,
> I am trying to do a check to make sure that when a person fills out a
phone
> number field that the it contains correct number of digits. I have
a check
> to do this but it keeps running into a problem. The check is in the
form of
> a if statement:
> If length(home_area)=3 and length(home_three)=3 and length(home_four)
=4 then
> *do Something*
> else *Do something*
> Now if the value being inserted in the home_area field is 123 this is
ok
> then length of this string is 3 but is the value is 012 the length of
this
> string is 2. Now how do I tell the program that the string is really
3
> digits long and the "0" value is not a null value? Any ideas?
Thanks in
> advance
>
>

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Tue Nov 09 1999 - 10:11:12 CST

Original text of this message

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