Re: [SQL] Help on Procedure running external function

2005-07-05 Thread Din Adrian
I am sorry but: the table is TEMPORARY ... I don't need to do any lock on it (eventualy I should do a lock on the table where I want to insert the documents - the MagMaxNrBon is only a temp table used for storing the max document nr for each user's setings in this transaction - I did that

Re: [SQL] Help on Procedure running external function

2005-07-05 Thread Bruno Wolff III
On Tue, Jul 05, 2005 at 13:47:24 +0200, Zac <[EMAIL PROTECTED]> wrote: > I think you should use 'FOR UPDATE' clause in your first "select": > > select into vnrBon maxnrbon+1 from MagMaxNrBon where magazie = > dsgroup.magazie_implicita_lansare FOR UPDATE; > > In this way you lock the rows event

Re: [SQL] Help on Procedure running external function

2005-07-05 Thread Din Adrian
I 'solved' my 'relation with OID # does not exist' problem using only execute on temp table ... Is no need for me to 'lock'(for update) the temp table - is temporary (lock at 'create temp table MagMaxNrBon')- everybody has his own copy Your right I should change the get_number proce

Re: [SQL] Help on Procedure running external function

2005-07-05 Thread Zac
I think you should use 'FOR UPDATE' clause in your first "select": select into vnrBon maxnrbon+1 from MagMaxNrBon where magazie = dsgroup.magazie_implicita_lansare FOR UPDATE; In this way you lock the rows eventually returned and no one can update them (or select them "for update") until your

Re: [SQL] Help on Procedure running external function

2005-07-05 Thread Din Adrian
1. the function get_me_next_number is runing from this procedure (same trans) but it's an external one ... 2. the second solution I'am using now (using temp a table to store each maxnrdoc value - but the temp table give me sometimes a relation with OID # does not exist - problem that I ca

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
l-sql@postgresql.org |Subject: Re: [SQL] Help on Procedure running external function | | | |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,

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] 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