Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: I've now, officially, seen it all...
Andreas Sheriff wrote:
> Of course, the subject of this post is completely fictitious, so don't flame
> me. :-D
>
> Does anyone have any idea why someone in their right mind would need a SQL
> statement such as the following:
>
> SELECT NULL FROM DUAL FOR UPDATE NOWAIT
>
> Does this make sense? Did I actually loose it?
>
> Andreas
A little test:
Session 1:
SQL> SELECT NULL FROM DUAL FOR UPDATE NOWAIT;
N
-
Session 2:
SQL> SELECT
2 *
3 FROM
4 V$LOCKED_OBJECT;
XIDUSN XIDSLOT XIDSQN OBJECT_ID SESSION_ID ORACLE_USERNAME
OS_USER_NAME PROCESS LOCKED_MODE
6 18 14870 258 193 SYS hooper 804:212 3
SQL> UPDATE DUAL SET DUMMY='A'; Session 2 hangs waiting for session 1 to commit or rollback.
Session 1:
SQL> ROLLBACK;
Rollback complete.
Session 2:
1 row updated.
SQL> ROLLBACK;
Rollback complete.
This is obviously an attempt to allow only one session at a time to update the DUAL table. :-)
Charles Hooper
PC Support Specialist
K&M Machine-Fabricating, Inc.
Received on Thu Jan 11 2007 - 18:35:49 CST