Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2003
    Posts
    7

    Unanswered: in oracle,how to tell the charater is a letter or digit in a string?

    how to tell the charater is a letter or digit in a string?
    i mean in sql statement using sql function.
    thanks a million

  2. #2
    Join Date
    Jul 2003
    Posts
    2,296
    more detail would be nice.

    do you mean is it an integer or not or for each character if it is an integer?

    1234352
    OR
    1ab45
    - The_Duck
    you can lead someone to something but they will never learn anything ...

  3. #3
    Join Date
    Aug 2003
    Posts
    3

    Re: in oracle,how to tell the charater is a letter or digit in a string?

    One common method is along the lines of

    function isNumber(p_num in number) return boolean is
    n number;
    begin
    n := to_number(p_num);
    return true;
    exception
    when others then
    return false;
    end;

    This is a skeleton. You may want to modify this. This may not run as is since it is simply typed in here. Also, if you want to use this function in sql (not pl/sql) you need to return a sql datatype (not boolean), such as char or number.

    Ben

  4. #4
    Join Date
    Aug 2003
    Posts
    7

    sorry not to make it clear

    Originally posted by The_Duck
    more detail would be nice.

    do you mean is it an integer or not or for each character if it is an integer?

    1234352
    OR
    1ab45

    thanks guys!
    the former is solved by ben!
    so i wonder how to tell each charater if it is an integer or letter(like you said 1ab45)
    any clue will be appreciated!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •