Re: how to lock multiple rows in oracle?

From: Date: Wed, 07 Dec 2005 14:31:33 +0000
Subject: Re: how to lock multiple rows in oracle?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-227045@lists.php.net to get a copy of this message
Rasim ÞEN wrote:
Hi friends , my code like this $sql="SELECT mid,substr(ROWID,0,100) as nROWID,MEMBER_ID, NAME, SURNAME, E_MAIL, SUBJECT, MAIL_BODY, to_char(DATE_CREATED,'DD.MM.YYYY HH24:MI:SS') as DATE_CREATED, RETRY, PRIORITY, E_MAIL_FROM, RECEIVER_MEMBER_ID, RECEIVER_NAME, RECEIVER_SURNAME, MAIL_TYPE, ATTACHMENT1, ATTACHMENT2, EMBEDDING1, EMBEDDING2 FROM MEMBERS_TO_MAIL_SEND_HTML where flag=0 and rownum<2000"; putenv("NLS_LANG=TURKISH_TURKEY.WE8ISO8859P9"); $baglanti = ocilogon(USERNAME,PASSWORD,DATABASE); $statement = ociparse ($baglanti, $sql); ociexecute ($statement); $i=0; while (ocifetchinto ($statement,$row, OCI_ASSOC)) {
    ........
    ........
I want to lock this 2000 rows, for this I make query like below: $sql=" .............. FROM MEMBERS_TO_MAIL_SEND_HTML where flag=0 and rownum<2000 FOR UPDATE";
    this time, it is updateting only one row.
I tried to use "LOCK TABLE table IN ROW SHARE MODE;LOCK TABLE table IN ROW SHARE MODE;"; but I don't know how to use in php. How can I lock all rows, any advice ?
I'm not an Oracle expert, but I would _think_ you just execute the query, like you would execute any other query in PHP. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 jnichel@dotcomholdingsofbuffalo.com

« previous php.general (#227045) next »