Whether String is numerical

Dúvidas, dicas e truques de SQL, Select, Update, Delete, cláusulas, operações com joins, Funções em SQLs, etc
  

Poston Wed, 27 Feb 2008 1:53 pm

How can I find out if a string is ONLY composed of numerical characters?

Thanks for the help.

God bless you all.
rickab7
Location: campo grande

stephany henrique de almeida batista

Poston Wed, 27 Feb 2008 2:00 pm

Good afternoon.

Must have N forms (including with REGEXP_LIKE, 10 g) but, I did this example below to give you an idea:
Code: Select all
DECLARE
  v_string  VARCHAR2(10) := 'abc798';
BEGIN

  v_string := TO_NUMBER(v_string);
  dbms_output.put_line('É numérica. ');
EXCEPTION
  WHEN OTHERS THEN
     dbms_output.put_line('É alfanumérica. ');
END;   
you can treat a specific error in exception, if desired, but, if you add characters in the string, he accuses alphanumeric.

qualquer thing, says ai.
Trevisolli
Location: Araraquara - SP

Abraço,

Trevisolli
OCA Oracle PL/SQL Developer Certified Associate
OCP Oracle Forms Developer Certified Professional
Araraquara-SP



Return to SQL

Who is online

Users browsing this forum: No registered users and 3 guests