Verifying data type
| От | Elieser Leão | 
|---|---|
| Тема | Verifying data type | 
| Дата | |
| Msg-id | 4121241C.6000300@nho.com.br обсуждение исходный текст | 
| Ответы | Re: Verifying data type | 
| Список | pgsql-sql | 
Hello guys,
I have a function like this
CREATE OR REPLACE FUNCTION "public"."f_tipo_campo" (varchar) RETURNS 
numeric AS
'declare p_valor ALIAS FOR $1; v_resultado varchar;
begin  v_resultado := 1;
<>   return v_resultado;
<>end;
<><>' LANGUAGE 'plpgsql'
<>
<>
I need to verify if the data in p_valor is just number or it is a string.
What is the best way to do this?
Here is the original function in Oracle PL/SQL
create or replace function f_tipo_campo (p_valor varchar) return number is
  v_resultado number;
  v_number    number;
begin
  begin
     select p_valor
       into v_number from dual;
     v_resultado := 0;
  exception
     when others then
        v_resultado := 1;
  end;
  return v_resultado;
end;
/
show err
--
Elieser Leão
Sorry for my bad english...
		
	В списке pgsql-sql по дате отправления: