[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Datarow lock in Oracle

Posted on 2004-10-16
3
Medium Priority
?
1,437 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
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 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

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…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.
Suggested Courses
Course of the Month19 days, 7 hours left to enroll

873 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