Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id 9187C7768F2 for ; Tue, 13 Mar 2012 15:35:23 -0300 (ADT) Received: from smtp106.prem.mail.ac4.yahoo.com ([76.13.13.45]) by magus.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1S7WZ6-0004WG-Gu for pgsql-sql@postgresql.org; Tue, 13 Mar 2012 18:35:22 +0000 Received: (qmail 41146 invoked from network); 13 Mar 2012 18:35:06 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=DKIM-Signature:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Received:From:To:References:In-Reply-To:Subject:Date:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:X-Mailer:thread-index:Content-Language; b=I1P3nEHRnd1k9Wxn4EGynFX/NSJ3B+G2noFaPp6EdGxUoMqa36VU1GRjCRdELBEQsu6/oB4q0r8DRihviC5xRzRC/g1rVzRJ/oziglXIP19TU4CXWl+tFZMWK4ugtnYLBCD1yPm6aHh5wUiYMb8/Pd9uWknS2g9qi3uX30ef/Iw= ; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1331663706; bh=XHdjyyWK7kx6qLyPxulTvlN8A1Rq/uTxuKLEFbcJnj4=; h=X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Received:From:To:References:In-Reply-To:Subject:Date:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:X-Mailer:thread-index:Content-Language; b=VRnfFeGJ8oo69jpiZQNtIoULEaWbLf2Yc6UBC828SbcWn1LaNywQDPTUWpfhf5NR6grtlGiJ3AsefNAgR+SYircA1+z8fX/MnITXKeczxMFaIlIIJQPwXOgXeQ0rXG0i3NwIVsEm/DxHqu7tqqsgZtjuGR82wlUGZNgo/aIyN+c= X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: IumP_qwVM1lIIivRrSU0Uqq2kzaGtxPpnq9JZ.bTXnP9uR1 BaF6AyTwvZHLgwkTQTY7YZaLHCPtZ6ex_4pCeMwkPi.LKoR5yZ.nnHlaEPy4 viAnBZI0HXtfJ2GTrT10uRdbgmfnh3BdVKVSq4.YlJACUk4H6pC4pKi73Wwf C5smeeyjYCj7nY_1FAXlppE1W0HDD495hJsApQXpxtxwVvUNWvSQGtJG10Bf X5y9s136E.BEIA_koW0BOgEVXOz9kIPh7u_7m_TBIboaSJdSpjrUHnueI8B4 0I8u0n9HcOW9auaaDl1BXsHUMZMOxT925ZWYc3HajKiS7NO8Z9CmklFlOAqM WvC4Fg8XYq82sAJokz0JPmPCzOCPHTpS1H0ZNLxrDVPZQvjWGz0CfGEHuYab 38hHlAlJL4DKZM5O7JUNP X-Yahoo-SMTP: mpGJl6eswBD2IBufoVEg0Pa8gg-- Received: from WolfDog (polobo@24.93.23.188 with login) by smtp106.prem.mail.ac4.yahoo.com with SMTP; 13 Mar 2012 11:35:06 -0700 PDT From: "David Johnston" To: "'Rehan Saleem'" , References: <1331663138.21401.YahooMailNeo@web121606.mail.ne1.yahoo.com> In-Reply-To: <1331663138.21401.YahooMailNeo@web121606.mail.ne1.yahoo.com> Subject: Re: Invalid syntax for integer Date: Tue, 13 Mar 2012 14:34:57 -0400 Message-ID: <00bb01cd0148$011419a0$033c4ce0$@yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 14.0 thread-index: AQDX4PIsPgEO5J9eRpJK834goFDOMphSzNlA Content-Language: en-us X-Pg-Spam-Score: -0.1 (/) X-Archive-Number: 201203/42 X-Sequence-Number: 36437 >>>>>>>> From: pgsql-sql-owner@postgresql.org [mailto:pgsql-sql-owner@postgresql.org] On Behalf Of Rehan Saleem Sent: Tuesday, March 13, 2012 2:26 PM To: pgsql-sql@postgresql.org Subject: [SQL] Invalid syntax for integer hi , what is wrong with this if statement in this function if distance =3D'' THEN =A0=A0=A0 distance :=3D 1; =A0=A0 =A0end if; here distance variable is of type integer , this function has been = created successfully but when i execute this function it gives me this error , ERROR:=A0 invalid input syntax for integer: "" LINE 1: SELECT distance =3D'' =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0 ^ QUERY:=A0 SELECT distance =3D'' CONTEXT:=A0 PL/pgSQL function "getsitesbytfid" line 6 at IF ********** Error ********** ERROR: invalid input syntax for integer: "" SQL state: 22P02 Context: PL/pgSQL function "getsitesbytfid" line 6 at IF =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D The empty-string is not a valid syntax for an integer. =20 You probably want: =93IF (distance IS NULL) =85=94. David J.