Solved

Datarow lock in Oracle

Posted on 2004-10-16
3
1,380 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
3 Comments
 
LVL 8

Expert Comment

by:sapnam
Comment Utility
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
Comment Utility
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 34

Expert Comment

by:Mark Geerlings
Comment Utility
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

728 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now