Re: [SQL] Using UNION inside a cursor

2003-11-04 Thread Paul Ganainm
[EMAIL PROTECTED] says... > (SELECT * FROM history WHERE obs_type = \'AA\' ) > UNION > (SELECT * FROM history WHERE obs_type = \'TA\'); Maybe I'm just confused here, but what's to stop you using SELECT * FROM History WHERE (Obs_Type = \'AA\' AND Obs_Type = \'TA\') ? Or have I mi

Re: [SQL] Using UNION inside a cursor

2003-10-30 Thread Kumar
uot; <[EMAIL PROTECTED]> Cc: ""Kumar"" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Thursday, October 30, 2003 8:50 PM Subject: Re: [SQL] Using UNION inside a cursor > Christoph Haller <[EMAIL PROTECTED]> writes: > >> OPEN ref FOR > >>

Re: [SQL] Using UNION inside a cursor

2003-10-30 Thread Tom Lane
Christoph Haller <[EMAIL PROTECTED]> writes: >> OPEN ref FOR >> (SELECT * FROM history WHERE obs_type =3D \'AA\' ) >> UNION >> (SELECT * FROM history WHERE obs_type =3D \'TA\'); > My suspicion is the plpgsql parser doesn't accept the opening > parenthesis. Yeah. Looking at the plpgsql gr

Re: [SQL] Using UNION inside a cursor

2003-10-30 Thread Kumar
Hi Christoph Haller, Thanks you very much. It worked. - Original Message - From: "Christoph Haller" <[EMAIL PROTECTED]> To: ""Kumar"" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Thursday, October 30, 2003 3:56 PM Subject: Re:

Re: [SQL] Using UNION inside a cursor

2003-10-30 Thread Christoph Haller
> > Dear Friends, > > I am working on Postgresql 7.3.4 on RH Linux Server 7.3.=20 > > I have problem in executing the following procedure > > CREATE OR REPLACE FUNCTION list_history() > RETURNS refcursor AS > 'DECLARE > ref REFCURSOR; > BEGIN > OPEN ref FOR > (SELECT * FROM history WHE

[SQL] Using UNION inside a cursor

2003-10-30 Thread Kumar
Dear Friends,   I am working on Postgresql 7.3.4 on RH Linux Server 7.3.   I have problem in executing the following procedure   CREATE OR REPLACE FUNCTION list_history()  RETURNS refcursor AS'DECLARE ref   REFCURSOR;BEGIN OPEN ref FOR (SELECT  * FROM history  WHERE obs_type = \'AA\' ) UN