From pk_rehan@yahoo.com Tue Mar 13 18:25:55 2012 Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id 109327768F2 for ; Tue, 13 Mar 2012 15:25:55 -0300 (ADT) Received: from nm25-vm2.bullet.mail.ne1.yahoo.com ([98.138.91.213]) by magus.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1S7WPw-0004LB-3L for pgsql-sql@postgresql.org; Tue, 13 Mar 2012 18:25:54 +0000 Received: from [98.138.90.53] by nm25.bullet.mail.ne1.yahoo.com with NNFMP; 13 Mar 2012 18:25:38 -0000 Received: from [98.138.226.165] by tm6.bullet.mail.ne1.yahoo.com with NNFMP; 13 Mar 2012 18:25:38 -0000 Received: from [127.0.0.1] by omp1066.mail.ne1.yahoo.com with NNFMP; 13 Mar 2012 18:25:38 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 160146.94258.bm@omp1066.mail.ne1.yahoo.com Received: (qmail 50511 invoked by uid 60001); 13 Mar 2012 18:25:38 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1331663138; bh=d8P8yoUFBUfULYC3ZwjFM87dbBbqEK8m6IL6UHGO+nk=; h=X-YMail-OSG:Received:X-Mailer:Message-ID:Date:From:Reply-To:Subject:To:MIME-Version:Content-Type; b=c6yhN+vu69osbbuc4bBbYd9dBW8TlMaWmxCbuGBZUkg8Rm/gHDr4cphn9+9KOV6bnfuAVOCn/0DUhfDho0cJdB5lH3LyvBAJagKMg9/zs1/NJofu+S1WDgCXrQ58pJcGJKCNIGOCaRfy5xoQZx1Pv9rgjtKdIHN4S2wTiJIyfjQ= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:X-Mailer:Message-ID:Date:From:Reply-To:Subject:To:MIME-Version:Content-Type; b=Ugaqa81vAYvwtDU1uZcPedSA3mPS5HIiVGAxy0sxi0R/iNI/3ldd2XwpLbFPC5FoPEGsEGgDVIWum7wjFFGD8k32diFwlXEzvZ84RkLf9x0jwiwYdvFxuhlI4M2nM9zfw+JjaCCPHEV3MglACYELgUF8Djb28B8oA5oghjorvIA=; X-YMail-OSG: 2Nwt5rkVM1nS72YYWbfG_S9sRSgiuaxhe2SjVIRlunmIHzh sxwrYHcEmFFyfqysFb7RrIyTuAzv1sLESpexkjudmfn9oy0JG8YOO8z_Mfih r.E6zrhUQ36gAiVHJBRWZeJlA9mWxR0yQZt3eJ12avcev34cbfaOctb9TP56 EPAWu5gVV6BK..2gnHPPF.4qww1CrmmlkKhUP8CQkP5HBSmpLgU2hLO9k7AD 8e93hNhO4vidaZwr5XkTvVWkl03lSjTxG7ltrtKCeRMQERhMHxhyPFLDFRcs IsW1l8RQP2lR9K2XmI63gCWXHYDqlCS8wIcZPtXxE7vaRmrx85Pi1CwdXBI2 fC.Hgsg8cDu1o7DdXnOrW43jcLOMmFa_Fx6gRLevMc2tMsjRaf.YxwgamkJN 1ipRT0QW8Tj9ufyWkTVvd0GTOV9DB.Eq1vvf45lS.5TBDjLDlbimprcHrFZT 8RtF78g-- Received: from [182.177.213.198] by web121606.mail.ne1.yahoo.com via HTTP; Tue, 13 Mar 2012 11:25:38 PDT X-Mailer: YahooMailWebService/0.8.116.338427 Message-ID: <1331663138.21401.YahooMailNeo@web121606.mail.ne1.yahoo.com> Date: Tue, 13 Mar 2012 11:25:38 -0700 (PDT) From: Rehan Saleem Reply-To: Rehan Saleem Subject: Invalid syntax for integer To: "pgsql-sql@postgresql.org" MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="1458340343-1763631112-1331663138=:21401" X-Pg-Spam-Score: -0.6 (/) X-Archive-Number: 201203/41 X-Sequence-Number: 36436 --1458340343-1763631112-1331663138=:21401 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable hi ,=0A=0Awhat is wrong with this if statement in this function=0Aif distan= ce =3D'' THEN=0A=A0=A0=A0 distance :=3D 1;=0A=A0=A0 =A0end if;=0Ahere dista= nce variable is of type integer , this function has been created successful= ly but when i execute this function it gives me this error ,=0A=0AERROR:=A0= invalid input syntax for integer: ""=0ALINE 1: SELECT distance =3D''=0A=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 ^=0AQUERY:=A0 SELECT distance =3D''=0ACONTEXT:=A0 PL/pgSQL = function "getsitesbytfid" line 6 at IF=0A=0A********** Error **********=0A= =0AERROR: invalid input syntax for integer: ""=0ASQL state: 22P02=0AContext= : PL/pgSQL function "getsitesbytfid" line 6 at IF --1458340343-1763631112-1331663138=:21401 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable
hi ,
<= br>
what is wrong with this if statement in this function

if distance =3D'' THEN
    distance :=3D 1;<= br>    end if;
here distance variable is of type integer= , this function has been created successfully but when i execute this func= tion it gives me this error ,

ERROR:  invalid= input syntax for integer: ""
LINE 1: SELECT distance =3D''
 &nb= sp;            =             &nb= sp;     ^
QUERY:  SELECT distance =3D''
CONT= EXT:  PL/pgSQL function "getsitesbytfid" line 6 at IF

*********= * Error **********

ERROR: invalid input syntax for integer: ""
SQ= L state: 22P02
Context: PL/pgSQL function "getsitesbytfid" line 6 at IF

--1458340343-1763631112-1331663138=:21401-- From polobo@yahoo.com Tue Mar 13 18:35:23 2012 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.