Re: [SQL] Returning a bool on DELETE in a proc.

2005-01-19 Thread Michael Fuhr
On Wed, Jan 19, 2005 at 06:09:16PM +0100, KÖPFERL Robert wrote: > > > > Why SQL instead of PL/pgSQL if the former doesn't do what you need > > and the latter does? > > I have the feeling that even complicated and boxed queries are faster or can > be optimized by the planer than any PLpgsql. Isn't t

Re: [SQL] Returning a bool on DELETE in a proc.

2005-01-19 Thread KÖPFERL Robert
TED] > Sent: Mittwoch, 19. Jänner 2005 18:02 > To: KÖPFERL Robert > Cc: pgsql-sql@postgresql.org > Subject: Re: [SQL] Returning a bool on DELETE in a proc. > > > On Wed, Jan 19, 2005 at 11:24:26AM +0100, KÖPFERL Robert wrote: > > > Seems that I forgot to mention that th

Re: [SQL] Returning a bool on DELETE in a proc.

2005-01-19 Thread Michael Fuhr
On Wed, Jan 19, 2005 at 11:24:26AM +0100, KÖPFERL Robert wrote: > Seems that I forgot to mention that this function is intended to be written > in SQL, not in PL/SQL. Why SQL instead of PL/pgSQL if the former doesn't do what you need and the latter does? -- Michael Fuhr http://www.fuhr.org/~mfu

Re: [SQL] Returning a bool on DELETE in a proc.

2005-01-19 Thread Karsten Hilbert
> >So what variable/function is the correct SQL-equivalent to ROW_COUNT and > >can it be used in the following statement ? > >like DELETE...; SELECT (ROW_COUNT<>0); to return a bool value? > > SQL doesn't support that (although I suppose it could be made to with > some pg_rows_affected() functio

Re: [SQL] Returning a bool on DELETE in a proc.

2005-01-19 Thread Richard Huxton
KÖPFERL Robert wrote: Thanks, but that was not what I was looking for. Seems that I forgot to mention that this function is intended to be written in SQL, not in PL/SQL. For the second one I already picked it off the fascinating* doc (as Keith did) that GET DIAGONSTIC is the right thing. So what va

Re: [SQL] Returning a bool on DELETE in a proc.

2005-01-19 Thread KÖPFERL Robert
ubject: Re: [SQL] Returning a bool on DELETE in a proc. > > > On Tue, Jan 18, 2005 at 05:04:58PM +0100, KÖPFERL Robert wrote: > > > I'm currently writing a function which encapsulates a > delete and should > > return a bool as indicator for success. > > H

Re: [SQL] Returning a bool on DELETE in a proc.

2005-01-18 Thread Michael Fuhr
On Tue, Jan 18, 2005 at 05:04:58PM +0100, KÖPFERL Robert wrote: > I'm currently writing a function which encapsulates a delete and should > return a bool as indicator for success. How do you define success? When the delete affects one or more rows? > DELETE FROM "TariffDetails" WHERE "Tari

Re: [SQL] Returning a bool on DELETE in a proc.

2005-01-18 Thread Keith Worthington
> Hi, > > I'm currently writing a function which encapsulates a delete and should > return a bool as indicator for success. > > I tried: > > DELETE FROM "TariffDetails" WHERE "TariffId"=$1 and "BNumberPrefix"=$2; > SELECT TRUE; > > but this makes me not happy. > How can I distingruish

[SQL] Returning a bool on DELETE in a proc.

2005-01-18 Thread KÖPFERL Robert
Hi, I'm currently writing a function which encapsulates a delete and should return a bool as indicator for success. I tried: DELETE FROM "TariffDetails" WHERE "TariffId"=$1 and "BNumberPrefix"=$2; SELECT TRUE; but this makes me not happy. How can I distingruish wehter DELETE affected