Re: What this parser mean?

From: "David Witham" <davidw(at)unidial(dot)com(dot)au>
To: <wahab(at)mimos(dot)my>, <pgsql-sql(at)postgresql(dot)org>
Subject: Re: What this parser mean?
Date: 2003-03-21 02:52:56
Message-ID: CFA248776934FD43847E740E43C346D1379686@ozimelb03.ozicom.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi Abdul,

You may have lost the '' around the date specification in the to_char function when forming the string in Java. Before submitting the query, check the contents of the query string to make sure you still have the '' marks.

Regards,
David Witham

-----Original Message-----
From: Abdul Wahab Dahalan [mailto:wahab(at)mimos(dot)my]
Sent: Friday, 21 March 2003 13:47
To: pgsql-sql(at)postgresql(dot)org
Subject: [SQL] What this parser mean?

I wrote a java program to query a data from 4 tables and the string
query is like:

querydata ="select
bizfavorite.bizid,bizprofile.bizname,bizprofile.bizphone,bizprofile.bizfax,bizfavorite.searchtype,"

+ "bizfavorite.keyword,to_char(bizfavorite.listdate,'DD-MM-YYYY') as
listdate,bizfavorite.offerid,offer.otype,offer.bizid as obizid,"
+ "to_char(offer.oposted_date,'DD-MM-YYYY') as
oposted_date,to_char(offer.oexpiry_date,'DD-MM-YYYY') as oexpiry_date,"
+ "userprofile.username,userprofile.ufullname,userprofile.uemail"
+ " from bizfavorite join bizprofile using(bizid) join userprofile
using(bizid) left join offer using(offerid)"
+ " where bizfavorite.username= ? and urole='1' order by listdate desc"

+ " limit " + recordPerpage + "," + beginRecord;

When I run this query, I got this message : Message: ERROR: parser:
parse error at or near "-"

but when I ran this query from psql command prompt its ok.I got what I
want.
b2bscm=> select
bizprofile.bizname,bizprofile.bizphone,bizprofile.bizfax,bizfavorite.searchtype,bizfavorite.keyword,to_char(bizfavorite.listdate,'DD-MM-YYYY')
as listdate,bizfavorite.offerid,offer.otype,offer.bizid as
obizid,to_char(offer.oposted_date,'DD-MM-YYYY') as
date,to_char(offer.oexpiry_date,'DD-MM-YYYY') as
oexpiry_date,userprofile.username,userprofile.ufullname,userprofile.uemail
from bizfavorite join bizprofile using(bizid) join userprofile
using(bizid) left join offer using(offerid) where bizfavorite.username=
'faiz' and urole='1' order by listdate desc limit 8,0;

Any help, very much appreciated..Thanks

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Browse pgsql-sql by date

  From Date Subject
Next Message Sethi Tarun-ETS017 2003-03-21 03:16:44 newline character in SQL
Previous Message Abdul Wahab Dahalan 2003-03-21 02:47:14 What this parser mean?