Re: pl/sql function

From: James Lorenzen <james_lorenzen_at_allianzlife.com>
Date: Thu, 12 Aug 1999 14:10:23 GMT
Message-ID: <7oukk4$555$1_at_nnrp1.deja.com>


This might be simpler:
 FUNCTION is_integer(i_val IN VARCHAR2) RETURN BOOLEAN  AS
  chkint NUMBER ;
 BEGIN
  chkint := TRUNC(TO_NUMBER(i_val),0) ;
  IF TO_NUMBER(i_val) = chkint THEN
    RETURN TRUE ;
  END IF ;
  RETURN FALSE ;
 EXCEPTION
 WHEN OTHERS THEN
  RETURN FALSE ;
 END is_integer ;

Just check the boolean response, TRUE is returned for an integer, FALSE for any other entry.

HTH
    James
In article <Pine.SOL.4.05.9908101157240.16554-100000_at_rigel.oac.uci.edu>,   DooHee Kim~ <4658291d_at_rigel.oac.uci.edu> wrote:
> Is there a function to check if a given string is iteger or not?
>
>

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't. Received on Thu Aug 12 1999 - 16:10:23 CEST

Original text of this message