[SQL] Is there a type like a growable array, similar Vector at Java language in postgreSQL?

2005-07-22 Thread Dongsoo Yoon
In Oracle, there is a type like a growable array, similar Vector at Java language.   In postgreSQL, is there any type like bellow type?   -CREATE OR REPLACE PROCEDURE te

Re: [SQL] Error when using array variable

2005-07-22 Thread Tom Lane
Michael Fuhr <[EMAIL PROTECTED]> writes: > On Fri, Jul 22, 2005 at 03:07:04PM +0530, Gnanavel S wrote: >> You need to initialse the array, Otherwise any value added to the array will >> be null. > This isn't necessary in 8.0, which we can infer is being used because > of the dollar quotes. Howeve

Re: [SQL] Error when using array variable

2005-07-22 Thread Michael Fuhr
On Fri, Jul 22, 2005 at 03:07:04PM +0530, Gnanavel S wrote: > On 7/22/05, Dongsoo Yoon <[EMAIL PROTECTED]> wrote: > > CREATE OR REPLACE FUNCTION arr_test() > > RETURNS NUMERIC[] AS $BODY$ > > DECLARE > > v_count NUMERIC default 0; > > v_dayIndex NUMERIC default 0; > > t_modifiedTimes NUMER

Re: [SQL] Tigger

2005-07-22 Thread David Hofmann
It didn't error out, however the function didn't work. Specificly the if statement. I took out the if statement and it started updating, I put it back in and it fails to update. Not sure why. I've confirmed that the program not attempting to update the stamp_lastupdate field. Here what I end

Re: [SQL] Tigger

2005-07-22 Thread Bricklen Anderson
Jaime Casanova wrote: > This seems bad to me also: > >>>CREATE FUNCTION session_update() RETURNS trigger AS $session_update$ >>>[..function body..] >>>$session_update$ LANGUAGE plpgsql; > > > I think it should be: > CREATE FUNCTION session_update() RETURNS trigger AS $$ > [..function body..] > $

Re: [SQL] Tigger

2005-07-22 Thread Jaime Casanova
David Hofmann wrote: > > I've look throught the docs and from what I can see the bellow code > > should work, however I keep getting the error: > > > > ERROR: parser: parse error at or near "$" at character 53 > > > > CREATE FUNCTION session_update() RETURNS trigger AS $session_update$ > > BEGIN

Re: [SQL] Tigger

2005-07-22 Thread David Hofmann
I'm using 7.3. From: Bricklen Anderson <[EMAIL PROTECTED]> To: David Hofmann <[EMAIL PROTECTED]> CC: pgsql-sql@postgresql.org Subject: Re: [SQL] Tigger Date: Fri, 22 Jul 2005 12:17:41 -0700 David Hofmann wrote: > I've look throught the docs and from what I can see the bellow code > should work,

Re: [SQL] Tigger

2005-07-22 Thread Bricklen Anderson
David Hofmann wrote: > I'm using 7.3. > >> From: Bricklen Anderson <[EMAIL PROTECTED]> >> To: David Hofmann <[EMAIL PROTECTED]> >> CC: pgsql-sql@postgresql.org >> Subject: Re: [SQL] Tigger >> Date: Fri, 22 Jul 2005 12:17:41 -0700 >> >> David Hofmann wrote: >> > I've look throught the docs and from

Re: [SQL] Tigger

2005-07-22 Thread Bricklen Anderson
David Hofmann wrote: > I've look throught the docs and from what I can see the bellow code > should work, however I keep getting the error: > > ERROR: parser: parse error at or near "$" at character 53 > > CREATE FUNCTION session_update() RETURNS trigger AS $session_update$ > BEGIN > -- Chec

[SQL] Tigger

2005-07-22 Thread David Hofmann
I've look throught the docs and from what I can see the bellow code should work, however I keep getting the error: ERROR: parser: parse error at or near "$" at character 53 CREATE FUNCTION session_update() RETURNS trigger AS $session_update$ BEGIN -- Check date exists IF NEW.st

Re: [SQL] Multi-column returns from pgsql

2005-07-22 Thread Tony Wasson
On 7/22/05, Jim Buttafuoco <[EMAIL PROTECTED]> wrote: > Mark, > > Instead of RETURN NEXT rec.txt1; RETURN NEXT rec.txt2; just use RETURN NEXT > rec; > > then your select statement would be > select * from my_func() as (txt1 text,txt2 text); > > Jim Besides a simple RETURN NEXT, you'll need to

Re: [SQL] Convert numeric to money

2005-07-22 Thread Bruno Wolff III
On Fri, Jul 22, 2005 at 11:03:40 -0300, [EMAIL PROTECTED] wrote: > Hi. > I have searched in mailing-list archives about converting types, but I > couldn't > found a function or clause that convert a numeric type to money type. > How Can I convert this types? > > => select '1234'::money; >mo

Re: [SQL] Multi-column returns from pgsql

2005-07-22 Thread Jim Buttafuoco
Mark, Instead of RETURN NEXT rec.txt1; RETURN NEXT rec.txt2; just use RETURN NEXT rec; then your select statement would be select * from my_func() as (txt1 text,txt2 text); Jim -- Original Message --- From: "Mark R. Dingee" <[EMAIL PROTECTED]> To: pgsql-sql@postgresql.org

[SQL] Multi-column returns from pgsql

2005-07-22 Thread Mark R. Dingee
Hi Everyone, Does anyone know if/how it's possible to return multi-column sets from a pgsql function? Right now I'm using something like the following as a work around CREATE OR REPLACE FUNCTION my_func() returns SETOF TEXT AS ' DECLARE rec record; BEGIN FOR rec IN SELECT txt1, txt2 FRO

Re: [SQL] Error when using array variable

2005-07-22 Thread Gnanavel S
On 7/22/05, Dongsoo Yoon <[EMAIL PROTECTED]> wrote: I use a function using array variable as following.   The function returns array type.   When array variable is allocated with any value,allocating is not done.   I can't find why it is.   --

[SQL] Convert numeric to money

2005-07-22 Thread lucas
Hi. I have searched in mailing-list archives about converting types, but I couldn't found a function or clause that convert a numeric type to money type. How Can I convert this types? => select '1234'::money; money R$1.234,00 => select '1234'::numeric::money; ERROR: cannot cast

Re: [SQL] Error when using array variable

2005-07-22 Thread Michael Fuhr
On Fri, Jul 22, 2005 at 06:24:03PM +0900, Dongsoo Yoon wrote: > > When array variable is allocated with any value, > allocating is not done. It's not clear what this means -- what are you expecting to happen, and what actually is happening? > v_testval := t_modifiedTimes[v_dayIndex ] ;

Re: [SQL] Using subselects as joins in POstgeSQL (possible?, examples)

2005-07-22 Thread Pascual De Ruvo
On 7/22/05, frank church <[EMAIL PROTECTED]> wrote: Is it possible to use subselects as joins in PostgreSQL. Absolutely.  select * from (select * from table1) as a, (select * from table2) as b where a.a = b.b

Re: [SQL] Are long term never commited SELECT statements are a pr

2005-07-22 Thread KÖPFERL Robert
You may get problems. At least we did. Having a long term transaction which seemingly just was one Begin with nothing, we encountered a siginifficant decrease of performance after some days (70 tx/sec) During that the pg_subtrans dir filled up with files and the IO-reads of the disk as well. After

[SQL] Using subselects as joins in POstgeSQL (possible?, examples)

2005-07-22 Thread frank church
Is it possible to use subselects as joins in PostgreSQL. eg. select a.a, a.b, a.c, b.a, b.b. b.c from (first subsselect) a (second subselect) b where (in table criteria) and a.a = b.a or select a.a, a.b, a.c, b.a, b.b. b.c from (first subsselect) a join (second subselect) b on a.a = b.a wher

[SQL] Error when using array variable

2005-07-22 Thread Dongsoo Yoon
I use a function using array variable as following.   The function returns array type.   When array variable is allocated with any value,allocating is not done.   I can't find why it is.   ---   CREATE OR REPLACE FUNCTION arr_tes

[SQL] Error when using array variable

2005-07-22 Thread Dongsoo Yoon
  I use a function using array variable as following.   The function returns array type.   When array variable is allocated with any value,allocating is not done.   I can't find why it is.   ---   CREATE OR REPLACE FUNCTION arr_