Solved

Datarow lock in Oracle

Posted on 2004-10-16
3
1,402 Views
Last Modified: 2012-05-05
Hello,
I would like to create a table with datarows as the default lock, how am I about to do it?
To be more specific, in Sybase I know something like the following

create table myTable (xxxxx) lock datarows
# as I understand, this sql statement will create a table with datarows locking is the chosen locking protocol.

The question is: can I have something similar to that in Oracle? What is the SQL statement?
Thanks,
Do
0
Comment
Question by:dttai
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 8

Expert Comment

by:sapnam
ID: 12331691
As far as I know, there is no need to specify anything while creating the table.  Locking concepts change from database to database.  In Oracle, the locking is done by Oracle as needed.  In case you want to specifically lock a record, you can do that by using SELECT FOR UPDATE statements
0
 
LVL 23

Accepted Solution

by:
seazodiac earned 500 total points
ID: 12333387
dttai:

THere is no such thing in oracle, to your amazement, this is what Oracle is heads and shoulders above other RDBMS including sybase.

the default locking is the row-level locking in oracle.

but there are RS, RSX and X (exclusive) locking on the row level.
and there are the same on the table level.

but Oracle usually take care of this for you during your transaction, yes, transparent to users and developers.

all you need to do is read the manual and understand how oracle does this differently from other dbs.
0
 
LVL 35

Expert Comment

by:Mark Geerlings
ID: 12338333
Do not assume that Oracle does things the same way that SQL Server does.  In addition to the differences with record-locking (which Oracle does much better than SQL Server), some other things that are significantly different between SQL Server and Oracle are:
1. how nulls are handled and/or referenced
2. how dates are handled (Oracle dates can include the time)
3. "autonumber" columns - Oracle does not support them directly, but uses a sequence plus a trigger
4. whether stored procedures return result sets (arrays) or not

I wouldn't say that either the SQL Server way or the Oracle way is "better" or "worse"  for any of these, but be aware that they are different between the two systems, and if you are used to the way they work in SQL Server, you will have to learn some new ways of working with them in Oracle.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…
This video shows how to recover a database from a user managed backup

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question