Skip site navigation (1) Skip section navigation (2)

Invalid syntax for integer

From: Rehan Saleem <pk_rehan(at)yahoo(dot)com>
To: "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org>
Subject: Invalid syntax for integer
Date: 2012-03-13 18:25:38
Message-ID: 1331663138.21401.YahooMailNeo@web121606.mail.ne1.yahoo.com (view raw or flat)
Thread:
Lists: pgsql-sql
hi ,

what is wrong with this if statement in this function
if distance ='' THEN
    distance := 1;
    end 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:  invalid input syntax for integer: ""
LINE 1: SELECT distance =''
                                ^
QUERY:  SELECT distance =''
CONTEXT:  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

Responses

pgsql-sql by date

Next:From: M. D.Date: 2012-03-13 18:29:10
Subject: help on a function with exception
Previous:From: Pavel StehuleDate: 2012-03-12 18:11:00
Subject: Re: crosstab

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group