Oracle 중 tochar () 함수 의 용법
3135 단어 Oacle
날짜 변환:
to_char (date, '형식')
select to_date('2005-01-01 ','yyyy-MM-dd') from dual;
select to_char(sysdate,'yyyy-MM-dd HH24:mi:ss') from dual;
타임 스탬프 에 무 작위 수 를 더 하 다.
update tableName set TB_SAVETIME = TO_TIMESTAMP(to_char(TB_SAVETIME,'YYYY-MM-DD HH24:MI:SS')||to_char(dbms_random.value(0,5)/10000,'9.999999') , 'YYYY-MM-DD HH24:MI:SS.FF6') ;
처리 숫자:
to_char (number, '형식')
select to_char(88877) from dual;
select to_char(1234567890,'099999999999999') from dual;
select to_char(12345678,'999,999,999,999') from dual;
select to_char(123456,'99.999') from dual;
select to_char(1234567890,'999,999,999,999.9999') from dual;
to_char(salary,'$99,99')
select TO_CHAR(123,'$99,999.9') from dual;
진 변환 에 사용: 10 진 을 16 진 으로 변환
select to_char(4567,'xxxx') from dual;
select to_char(123,'xxx') from dual;
예:
1 //// to_char
2
3 to_char(now(),'Day, HH12:MI:SS') 'Tuesday , 05:39:18'
4 to_char(now(),'FMDay, HH12:MI:SS') 'Tuesday, 05:39:18'
5 to_char(-0.1,'99.99') ' -.10'
6 to_char(-0.1,'FM9.99') '-.1'
7 to_char(0.1,'0.9') ' 0.1'
8 to_char(12,'9990999.9') ' 0012.0'
9 to_char(12,'FM9990999.9') '0012'
10 to_char(485,'999') ' 485'
11 to_char(-485,'999') '-485'
12 to_char(485,'9 9 9') ' 4 8 5'
13 to_char(1485,'9,999') ' 1,485'
14 to_char(1485,'9G999') ' 1 485'
15 to_char(148.5,'999.999') ' 148.500'
16 to_char(148.5,'999D999') ' 148,500'
17 to_char(3148.5,'9G999D999') ' 3 148,500'
18 to_char(-485,'999S') '485-'
19 to_char(-485,'999MI') '485-'
20 to_char(485,'999MI') '485'
21 to_char(485,'PL999') '+485'
22 to_char(485,'SG999') '+485'
23 to_char(-485,'SG999') '-485'
24 to_char(-485,'9SG99') '4-85'
25 to_char(-485,'999PR') '<485>'
26 to_char(485,'L999') 'DM 485
27 to_char(485,'RN') ' CDLXXXV'
28 to_char(485,'FMRN') 'CDLXXXV'
29 to_char(5.2,'FMRN') V
30 to_char(482,'999th') ' 482nd'
31 to_char(485, '"Good number:"999') 'Good number: 485'
32 to_char(485.8,'"Pre-decimal:"999" Post-decimal:" .999') 'Pre-decimal: 485 Post-decimal: .800'
33 to_char(12,'99V999') ' 12000'
34 to_char(12.4,'99V999') ' 12400'
35 to_char(12.45, '99V9') ' 125'
전송 소스:http://blog.csdn.net/jiangnan2014/article/details/16908585
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
자바 작업 은 Clob 또는 NClob 데이터 형식의 저장 프로 세 스 인 스 턴 스 를 포함 합 니 다.텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.