개발자/Oracle

oracle Date Format

김진리 2013. 1. 26. 13:13

oracle에서 현재 날짜,시간 나타내기

SELECT sysdate from dual;    현재 시간은 sysdate 이고  dual 은 oracle에서 제공하는 빈 테이블.


to_char  number 형을 char형으로 변형 , date 형을 char형으로 변형  

                                       select to_char (sysdate) from dual;

to_date char형을 date형으로 변형                                               

  select to_date( to_char (sysdate))from dual;


to_number char형을 number로 변형                                            

                                              select to_number ( to_char (sysdate))from dual;


sysdate 를 format 변형하여 출력 


SELECT to_char(sysdate,'RR/MM/DD') FROM dual;      현재 날짜를 년/월/일 형태로 출력.