쿼리1를 실행시키면 ( )안에 있는 a.col01을 인식하지 못하는 에러가 발생합니다.
하지만 "(select..." 앞에 "table(select..." 라고 쓰면 a.col01 을 인식하며 에러가 발생하지 않습니다.
table 은 table(snapshot_tab_cfg('',-2)) 같은 경우나 table(values(1),(2),(3),...) t(a) 와 같은 경우에 사용하는것은 많이 보았으나 위와 같은 기능이 존재하는지는 몰랐습니다.
어떠한 이유에서 가능한지 알수 있을까요?
<쿼리1 에러내용>
SQL0204N "A.COL01" is an undefined name. SQLSTATE=42704
쿼리1) 에러발생
db2 "select *
from tab01 a
inner join (select col01, col02, col03
from tab02 b
where a.col01 = b.col01
) as c
on a.col01 = c.col01
with ur"
쿼리2) 에러없음
db2 "select a.*
from tab01 a
inner join table(select col01, col02, col03
from tab02 b
where a.col01 = b.col01
) as c
on a.col01 = c.col01
with ur" |