Syntax error in Execute statement

From: Emil Rachovsky <zsevgymko(at)yahoo(dot)com>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Cc: "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org>
Subject: Syntax error in Execute statement
Date: 2006-03-06 15:21:58
Message-ID: 20060306152158.81224.qmail@web54312.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

Hello,

I created a function "coalescec" which behaves the
same as coalesce, but uses an integer and a string.
Now I'm getting an error in the folowing statements :

query := 'select "UID" from S_Users_To_Connection
where ConnID = ' || coalescec(conn_id,'null');
execute query into nUID;

ERROR: syntax error at or near "$2" at character 20
QUERY: SELECT $1 into $2

I have put UID in quotes because it seems to be a
keyword.

Here is the table script:

create TEMP table S_Users_To_Connection(
UID integer NOT NULL
,ConnID integer NOT NULL
,LoginID integer NOT NULL
);

Any suggestions ?

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bricklen Anderson 2006-03-06 16:00:39 Re: Syntax error, but where?
Previous Message Bruce Momjian 2006-03-06 15:15:06 Re: ECPG and COPY

Browse pgsql-sql by date

  From Date Subject
Next Message Greg Stark 2006-03-06 15:55:31 Re: Help with "missing FROM clause" needed
Previous Message A. Kretschmer 2006-03-06 14:51:38 Re: Help with "missing FROM clause" needed