--字符值和日期值区分大小写 SELECT * FROM AMS_SCTY_USER2 WHERE USER_ID='DSNH'; SELECT * FROM AMS_SCTY_USER2 WHERE USER_ID='dsnh'; --TO_CHAR 格式, FM/fm主要作用就是去除空格的影响。 --无空格 SELECT TO_CHAR(2020041,'FM09999999') FROM DUAL; SELECT TO_CHAR(2020041,'fm09999999') FROM DUAL; SELECT TO_CHAR(2020041,'fm00000000') FROM DUAL; SELECT TO_CHAR(1,'fm00000000') FROM DUAL; --有空格 SELECT TO_CHAR(2020041,'09999999') FROM DUAL; --起始非0,不补0 SELECT TO_CHAR(2020041,'FM99999999') FROM DUAL; --日期格式 SELECT TO_CHAR(date '2020-04-10','fmDD Month YYYY') FROM DUAL; --日期普通格式 SELECT to_char(sysdate,'yyyy-mm-dd') FROM DUAL; --日期精简格式 SELECT to_char(sysdate,'FMyyyy-mm-dd') FROM DUAL; --FM去空格对比 select '|'||to_char(5,'000')||'|' from dual; select '|'||to_char(5,'FM000')||'|' from dual;