Re: [SQL] plpgsql related question: intervals and variables

2003-10-21 Thread Stephan Szabo
On Tue, 21 Oct 2003, Josh Berkus wrote: > >heute := ''today''; > > Select Into vk ourcolumn From table where other = foo; > >If vk > 0 Then > > vk_txt := ''Vorkuehlung notwendig''; > > ez := heute + interval ''vk days''; > > PL/pgSQL handles variable like SQL, not like PHP or Perl

Re: [SQL] function problem

2003-10-21 Thread Tom Lane
"geraldo" <[EMAIL PROTECTED]> writes: > Can anybody tell me why the following code when activated > by a select only affects the first line of the table??? > create or replace function increase(integer) > returns void as 'update tab set price=price*(1+$1/100.0)' > language sql; Works fine here.

Re: [SQL] [GENERAL] Alias-Error

2003-10-21 Thread Richard Huxton
On Tuesday 21 October 2003 08:17, Jost Richstein wrote: > Ok. The exact error message is as follows: > > SQLException Time : Mon Oct 20 13:15:25 CEST 2003 > SQLException ErrorCode : 0 > SQLException SQLState : null > SQLException Message : ERROR: Relation "c2" does not exist > SQLException

Re: [SQL] Writing the SQL queries inside Functions and operators

2003-10-21 Thread Richard Huxton
On Tuesday 21 October 2003 08:34, Dharan wrote: > Hi Friends, > > > What is the use of user defined operators, as functions also perform > the same job as an operator Easier to write. Compare: 'hello ' || ' there ' || 'everyone' with text_concat('hello', text_concat('there', text_concat('every

Re: [SQL] how to create a multi columns return function ?

2003-10-21 Thread Richard Huxton
On Tuesday 21 October 2003 14:08, [EMAIL PROTECTED] wrote: > Hi > > I'm moving databases from sybase to postgres. > But I have difficulties in creating a postgres equivalent to the sybase > stored procedures... > > Apparently, Postgres functions should work, but the syb stored procedures > get only

Re: [SQL] plpgsql related question: intervals and variables

2003-10-21 Thread Richard Huxton
On Tuesday 21 October 2003 14:58, Wilhelm Graiss wrote: >heute := ''today''; > Select Into vk ourcolumn From table where other = foo; >If vk > 0 Then > vk_txt := ''Vorkuehlung notwendig''; > ez := heute + interval ''vk days''; > The variable 'heute' is declared as timestamp,

Re: [SQL] plpgsql related question: intervals and variables

2003-10-21 Thread Josh Berkus
Willhelm, > Begin > >heute := ''today''; > Select Into vk ourcolumn From table where other = foo; >If vk > 0 Then > vk_txt := ''Vorkuehlung notwendig''; > ez := heute + interval ''vk days''; PL/pgSQL handles variable like SQL, not like PHP or Perl. You can't do

Re: [SQL] how to create a multi columns return function ?

2003-10-21 Thread Adam Witney
Take a look at the section on 'SQL Functions Returning Sets' http://www.postgresql.org/docs/7.3/static/xfunc-sql.html#AEN31304 > Hi > > I'm moving databases from sybase to postgres. > But I have difficulties in creating a postgres equivalent to the sybase stored > procedures... > > Appare

Re: [SQL] [GENERAL] Alias-Error

2003-10-21 Thread Jost Richstein
Ok. The exact error message is as follows: SQLException Time : Mon Oct 20 13:15:25 CEST 2003 SQLException ErrorCode : 0 SQLException SQLState : null SQLException Message : ERROR: Relation "c2" does not exist SQLException Connection: 4878867 The query is something like this: SELECT DISTI

[SQL] Writing the SQL queries inside Functions and operators

2003-10-21 Thread Dharan
Hi Friends, What is the use of user defined operators, as functions also perform the same job as an operator thanks in advance ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster

[SQL] function problem

2003-10-21 Thread geraldo
Can anybody tell me why the following code when activated by a select only affects the first line of the table??? create or replace function increase(integer) returns void as 'update tab set price=price*(1+$1/100.0)' language sql; Thanks. ---(end of broadcast)

[SQL] plpgsql related question: intervals and variables

2003-10-21 Thread Wilhelm Graiss
Hello out there, We have a problem in plpgsql: We want to add variable periods (result of a query) to a timestamp. Our Code looks like this: Begin heute := ''today''; Select Into vk ourcolumn From table where other = foo; If vk > 0 Then vk_txt := ''Vorkuehlung notwendig'';

[SQL] how to create a multi columns return function ?

2003-10-21 Thread jclaudio
Hi I'm moving databases from sybase to postgres. But I have difficulties in creating a postgres equivalent to the sybase stored procedures... Apparently, Postgres functions should work, but the syb stored procedures get only one parameter and return several colums Here's the code I wrote in pos

[SQL] [postgres] Re: Deutsche PostgreSQL-Mailingliste unter postgresql.org

2003-10-21 Thread Peter Eisentraut
OK, da sich eine Pluralität dafür ausgesprochen hat, und Marc die Liste sowieso schon angelegt hatte, ist [EMAIL PROTECTED] hiermit eröffnet. (Ja, der Name klingt vielleicht ein bisschen blöd, aber so bleibt das alles einheitlich.) Zum Eintragen ist es dann glaub ich "subscribe" an [EMAIL PROTECT

Re: Fw: [SQL] Max input parameter for a function

2003-10-21 Thread Josh Berkus
Kumar, > While trying to allocate about 36 input parameters, I got an error saying > that the max input parameter for a function is only 32. > > Is it right? How to overcome this? Because I wanna insert records into a > table of 55 columns with a lot of NULL able columns. First off, if your table

Re: [SQL] date_trunc for 5 minutes intervals

2003-10-21 Thread email lists
Hi, Thanks for the several replies both on and off the list. To be more specific, I am wanting to aggregate data to a 5/10/15 min interval. Currently, I am aggregating data that falls in hour / day / month / year periods for both count() and sum(). The sql I am currently using is: SELECT count(