X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A11915E46E7 for ; Mon, 16 Aug 2004 18:16:27 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 64028-01 for ; Mon, 16 Aug 2004 21:16:24 +0000 (GMT) Received: from ws.spps.com.br (ws.spps.com.br [200.248.176.2]) by svr1.postgresql.org (Postfix) with ESMTP id B26EC5E46E4 for ; Mon, 16 Aug 2004 18:16:19 -0300 (ADT) Received: from [127.0.0.1] (200-203-055-075.nhoce7002.e.brasiltelecom.net.br [200.203.55.75]) (authenticated) by ws.spps.com.br (8.11.6p2/8.12.6) with ESMTP id i7GLGDb32680 for ; Mon, 16 Aug 2004 18:16:13 -0300 Message-ID: <4121241C.6000300@nho.com.br> Date: Mon, 16 Aug 2004 18:16:12 -0300 From: =?ISO-8859-1?Q?Elieser_Le=E3o?= User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7) Gecko/20040616 X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Verifying data type Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-SPPS-MailScanner-Information: Contate a SPPS para maiores informacoes. +55 (51) 582-3666 X-SPPS-MailScanner: Found to be clean X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200408/151 X-Sequence-Number: 18648 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...