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
Solved

Datarow lock in Oracle

Posted on 2004-10-16
3
1,391 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 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Queries 15 45
ODBC in excel 2016 in Windows 10 via VBA 16 134
Oracle collections 15 26
Create file system directory from Oracle 10g 4 24
Article by: Swadhin
From the Oracle SQL Reference (http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/queries006.htm) we are told that a join is a query that combines rows from two or more tables, views, or materialized views. This article provides a glimps…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

766 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