ORACLE·sql

temp Long

administrators 2009. 12. 11. 15:43

오라클에서 LONG type의 함수는 to_lob만 있는것으로 알고 있다.

그러나 LONG의 글자수를 알아 내야하는 경우가 있다.

그래서 임시 clob테이블을 생성하여 집어넣고 사용하는 방법을 생각했다.

(다른 방법이 있으면 알려주세요;;;)

 

create global temporary table t_long_temp
(text_temp clob);

insert into t_long_temp
select to_lob(contents) from table_name;

select length(text_temp)
from t_long_temp
order by length(text_temp) desc

drop table t_long_temp

 

 

- write by 꼬마갱이 2009.12.11 -