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...




---------------------------(end of broadcast)--------------------------- TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Reply via email to