그동안 도외시했던 몇 몇 게시판을 간만에 돌아다녔봤더니
질문내용중에 9i에서 제가 써보지도 않은 거에 관련된 질문이 있더군요........
거참..왜 난 모르고 있는 것인지...
그래서 내용 좀 찾다가 Technical Bulletins 에서 좋은 글이 있어서 올립니다.


http://211.106.111.2:8880/bulletin/list.jsp?seq=12155&pg=90&sort_by=subject&keyfield=&keyword=





No. 12155

ORACLE 9I에서 추가,변경된 기능 (I)-SQL
=====================================


1. insert,update 문에서 default 값을 줄수 있다.

Explanation
-----------
insert 문장에서는 명시적으로 default를 주지 않아도 됨
update 문장에서 default를 명시하지 않으면 null 값이 assign 됨

Example
-------
SQL>alter table emp modify deptno default 20;

SQL> insert into emp (empno,deptno) values (222,default);
1 row created.

SQL> insert into emp (empno) values (22);
1 row created.

SQL> select empno,deptno from emp where empno=222;
EMPNO DEPTNO
----------
222 20

SQL> select empno,deptno from emp where empno=22;
EMPNO DEPTNO
----------
22 20


2. Constraint

Explanation
-----------
primary key와 unique key의 index 사용
index가 없는 foreign key의 shared lock 방지
(즉 .. 직접 update 하는 key 이외의 값은 dml 작업 가능)

Example
-------
CREATE TABLE smlee
( employee_id NUMBER PRIMARY KEY USING INDEX
(CREATE INDEX employees_id_idx ON
employees(employee_id)),
first_name VARCHAR2(15),
last_name VARCHAR2(15)) ;

ALTER TABLE smlee
DISABLE CONSTRAINT SYS_C002419
CASCADE DROP INDEX;

ALTER TABLE employees
DROP PRIMARY KEY KEEP INDEX;

CREATE TABLE smlee2 ( employee_id NUMBER PRIMARY KEY USING INDEX(CREATE unique INDEX
employees_id_idx ON
smlee2(employee_id)),first_name VARCHAR2(15),
last_name VARCHAR2(15));


3.Function based index

Explanation
-----------
oracle 8i부터 사용 가능
null column 도 function based index 가능

Example
-------
create index in_test on emp(sal*100+30);


4. FOR UPDATE WAIT 에 대한 기능 추가

Explanation
-----------
SELECT... FOR UPDATE 사용시 select 된 row 가 긴시간 lock 걸려 있을 경우 해당 record를 다루는 다른 user는
무한정 기다려야 한다.
이경우 얼마나 기다려야 하는지 시간을 줄수도 있고 바로 error 가 나게 option을 사용할수 있다.

Example
-------
session1
SQL> update smlee set first_name="ttt" where employee_id=2;
1 row updated.

Session2
SQL> select * from smlee where employee_id =2 for update nowait;
select * from smlee where employee_id =2 for update nowait
*
ERROR at line 1:
ORA-00054: resource busy and acquire with NOWAIT specified

->sql문 수행과 동시에 error 발생

session1
SQL> update smlee set first_name="ttt" where employee_id=2;
1 row updated.

Session2
SQL> select * from smlee where employee_id =2 for update wait 20;
select * from smlee where employee_id =2 for update wait 20
*
ERROR at line 1:
ORA-30006: resource busy; acquire with WAIT timeout expired