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