X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id DC5579DCC48 for ; Fri, 10 Mar 2006 16:57:58 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 51054-05 for ; Fri, 10 Mar 2006 16:57:59 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from lerami.lerctr.org (lerami.lerctr.org [192.147.25.11]) by postgresql.org (Postfix) with ESMTP id 904BE9DCADA for ; Fri, 10 Mar 2006 16:57:56 -0400 (AST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=lerami; d=lerctr.org; b=xWc+Jx2v8/4Mgl0Fjw8ju8MZgC+qxSorANonZe4+KizGYk9TdZ4t26Dgz9NA6zwC/NbkibKLB/56Chuvw9vj21MRKLDlfbnwvB9n+f0c47R/m9xOw6O631as1WGgNQQs1fOgePKYQFaw7c1+48xVLamKS7Rm0yZAyo0AHnhliQU=; Received: from 64-132-13-2.gen.twtelecom.net ([64.132.13.2]:45423 helo=LROSENMAC8010P) by lerami.lerctr.org with esmtpsa (TLSv1:RC4-MD5:128) (Exim 4.60) (envelope-from ) id 1FHogJ-00028R-Rq; Fri, 10 Mar 2006 14:57:55 -0600 From: "Larry Rosenman" To: "'Flavio Suguimoto'" , Subject: Re: Locking row Date: Fri, 10 Mar 2006 14:57:51 -0600 Message-ID: <023e01c64485$4be7f630$0a0a0a0a@aus.pervasive.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670 Thread-Index: AcZEhFNEV/RojOffTHWWY1KTTjC7hwAAOz4w In-Reply-To: X-LERCTR-Spam-Score: -4.4 (----) X-LERCTR-Spam-Report: (-4.4 points, 5.0 required) ALL_TRUSTED=-1.8 BAYES_00=-2.599 DK_POLICY_SIGNALL=0.001 DomainKey-Status: no signature X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.072 required=5 tests=[AWL=0.072] X-Spam-Score: 0.072 X-Spam-Level: X-Archive-Number: 200603/153 X-Sequence-Number: 24499 Flavio Suguimoto wrote: > Hi all, > > I need to mark a row with a value in a column, but first i need to > select the first row without this mark. But in some concurrents cases > i mark the row twice. How can i lock the row to avoid others session > get it? > > TABLE TICKET > TICKET_NUMBER | MARK > 00001 | 1 > 00002 | 0 > > I need to select the first row with 0 in MARK column and then mark it > with 1. look at the FOR UPDATE in the select docs. -- Larry Rosenman http://www.lerctr.org/~ler Phone: +1 512-248-2683 E-Mail: ler@lerctr.org US Mail: 430 Valona Loop, Round Rock, TX 78681-3893