TO_NUMBER函數是Oracle SQL中用于將字符型數據轉換為數字型數據的函數。下面是TO_NUMBER函數的一些靈活運用技巧:
SELECT TO_NUMBER('12345') FROM dual;
SELECT TO_NUMBER('1,234.56', '999G999D99') FROM dual;
SELECT TO_NUMBER('$1,234.56', 'L999G999D99') FROM dual;
SELECT TO_NUMBER(NULLIF('12345', ''), '99999') FROM dual;
SELECT TO_NUMBER('1.23456E+4', '9.99999EEEE') FROM dual;
SELECT TO_NUMBER('123.456', '999.999') FROM dual;
SELECT CASE WHEN TO_NUMBER('12345') > 10000 THEN '大于10000' ELSE '小于等于10000' END FROM dual;
這些技巧可以幫助你更靈活地使用TO_NUMBER函數在Oracle SQL中進行數據類型轉換。