Re: [SQL] Recursive function

2005-07-04 Thread Nick Stone
Hi, Also you could take a look at the connectby function as this will do what you want with ease and it can be used to sort stuff at the same time, produce tree views of data etc. Nick -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Gnanavel Shanmugam S

Re: [SQL] Recursive function

2005-07-04 Thread Gnanavel Shanmugam
solved the problem. The modified function is CREATE or replace FUNCTION get_child_section_types(int) RETURNS setof int AS $$ declare v_section_type_id alias for $1; v_rec record; v_rec1 record; begi

[SQL] Recursive function

2005-07-04 Thread Gnanavel Shanmugam
Hi, I have a table with the following details. section_type_id | section_type_name | parent_section_type_id -+---+ 10 | Unit | 20 | Block | 10 30 | Prac

Re: [SQL] select values from interval

2005-07-04 Thread Bruno Wolff III
On Mon, Jul 04, 2005 at 14:00:57 +0200, Josep Sanmartí <[EMAIL PROTECTED]> wrote: > Hi, > > I've this table: am_conn(mac, user_ip, start_time, end_time). Each time > a user connects with a remote server a new row is added, when the user > is disconnected the end_time field is set. > > Now, I wa

Re: [SQL] Help on Procedure running external function

2005-07-04 Thread Bruno Wolff III
On Mon, Jul 04, 2005 at 16:10:03 -0700, Din Adrian <[EMAIL PROTECTED]> wrote: > > Yes , I know what sequence is, but our procedure for generating doc > numbers is v. big and has manny (4) parameters and we did'nt use sequence > in it for this reason Then use a sequence for part of the

Re: [SQL] Help on Procedure running external function

2005-07-04 Thread Zac
Din Adrian wrote: Yes , I know what sequence is, but our procedure for generating doc numbers is v. big and has manny (4) parameters and we did'nt use sequence in it for this reason any other advice ? I think there is no way to have any information about non committed transactions.

Re: [SQL] Help on Procedure running external function

2005-07-04 Thread KÖPFERL Robert
Maybe you're looking for the VOLATILE attribute of a function. For the query optimizer it depends on what type of function you have how often it is called. |-Original Message- |From: Din Adrian [mailto:[EMAIL PROTECTED] |Sent: Dienstag, 05. Juli 2005 01:10 |To: Zac; pgsql-sql@postgresql.o

Re: [SQL] Help on Procedure running external function

2005-07-04 Thread Din Adrian
Yes , I know what sequence is, but our procedure for generating doc numbers is v. big and has manny (4) parameters and we did'nt use sequence in it for this reason any other advice ? thak you, Adi On Mon, 04 Jul 2005 14:47:16 +0200, Zac <[EMAIL PROTECTED]> wrote: Din Adrian wrote:

Re: [SQL] Help on Procedure running external function

2005-07-04 Thread Zac
Din Adrian wrote: Hello, I have a 'big' problem: I am trying to run from a procedure a function witch generate a new document number (max from table +1 ) and after to insert a document with this number, but the function returns me the same number each time because the tranzaction is not fin

[SQL] select values from interval

2005-07-04 Thread Josep Sanmartí
Hi, I've this table: am_conn(mac, user_ip, start_time, end_time). Each time a user connects with a remote server a new row is added, when the user is disconnected the end_time field is set. Now, I want to know if there is a way (sql statement) to know how many connections are up during an interva

[SQL] Help on Procedure running external function

2005-07-04 Thread Din Adrian
Hello, I have a 'big' problem: I am trying to run from a procedure a function witch generate a new document number (max from table +1 ) and after to insert a document with this number, but the function returns me the same number each time because the tranzaction is not finished and the inser