10g와 11g의 merge문 차이점?? 0 4 3,560

by 람짱 [SQL Query] [2011.05.23 16:59:55]



안녕하세요..

merge into (select * from a)  a
...........

라는 merge문이 있습니다.

헌데.. 11g에서는 into 구문에 select절이 와도 에러없이 잘 실행되구요..

10g에서는 ora-00903 :테이블을 찾을 수 없다.
라고 에러를 뱉네요..

10g에서는 into절에 select절을 쓸 수 없는 것인가요?
11g부터 쓸 수 있는건가요??

원래 안되는게 맞는건가요??
11g에서 되는게 이상한건가요??

아악.. 궁굼합니다!! ^^V
by 웅 [2011.05.24 00:06:14]
10g에서도 잘되네요.
------------------------------------
select * from v$version;
->Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - Prod

drop table testt;

create table testt(
key1 number,
col1 number );

insert into testt(key1, col1)
select rownum key1
, TO_NUMBER(NULL) col1
from dual
connect by level <= 100;

commit;

select * from testt;

merge into (select * from testt) a
using (select rownum key1
, 100 col1
from dual
connect by level <= 1000) b
on (a.key1 = b.key1)
when matched then
update set col1 = b.col1
when not matched then
insert values(b.key1, b.col1);

commit;

select * from testt;

by 람짱 [2011.05.24 09:25:03]
흠.. 역시나 전 into절에 select절이 오면 안되네요.ㅎ

Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bi

음.. .5와 .3의 차이인가요?? 에잇!

by Ejql [2011.05.24 13:47:50]
웅님께 샘플로 해봐도 안되나요?

by 람짱 [2011.05.24 16:50:55]
넵!! 안됩니다!!

버전차이인가보네요.. ㅎ

참고로 웅님쿼리에서

merge into testt a
.....
로 하면 잘 되구요.ㅎ

명확해졌네요~
댓글등록
SQL문을 포맷에 맞게(깔끔하게) 등록하려면 code() 버튼을 클릭하여 작성 하시면 됩니다.
로그인 사용자만 댓글을 작성 할 수 있습니다. 로그인, 회원가입