Venzi's Tech-Blog

16 July 2008

Quiz

Filed under: Oracle — Venzi @ 17:00

Because I’m off now for the next 4 days (I’m back on Monday) I decided to leave you a little Oracle quiz. You’ll get the answer then next week. So here we go:

You’ve two sessions: SessionA and SessionB. Both of them perform a insert on the same table (insert into data…) without a commit.
The question now is: Can one insert block the other one?

Just post your thoughts as comment!

Cheers!

5 Comments »

  1. Yes it can if there is RI violation.

    Comment by mdinh — 16 July 2008 @ 19:04 | Reply

  2. A lack of available ITL slots could cause a wait/block such that sessionB is waiting for sessionA (or some other session) to commit and release its ITL slot.

    Comment by Dan Norris — 16 July 2008 @ 19:48 | Reply

  3. if both inserts are triggering an update statement which affects the same row

    Comment by Jens Petersen — 16 July 2008 @ 20:48 | Reply

  4. Even easier. Two INSERTs trying the same primary key or unique key (constraint must be enabled and not deferred). The second waits until the first is committed before reporting the key violation (or it succeeds if the first is rolled back instead).

    Comment by Gary — 17 July 2008 @ 01:36 | Reply

  5. To answer the question correctly I think we need more information.

    Assuming there are no constraints in place, my answer would be:

    “No way, both inserts will be successful.”

    If there are constraints like PK or UK then check out Gary’s reply (right above mine).

    Comment by Asif Momen — 17 July 2008 @ 11:04 | Reply


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: