这是确定 Oracle 日期是否在周末的最佳方法吗?
Is this the best way to determine if an Oracle date is on a weekend?
select * from mytable
where
TO_CHAR (my_date, 'DY', 'NLS_DATE_LANGUAGE=ENGLISH') IN ('SAT', 'SUN');
从 Oracle 11g 开始,是的.我见过的唯一可行的区域不可知替代方案如下:
As of Oracle 11g, yes. The only viable region agnostic alternative that I've seen is as follows:
SELECT *
FROM mytable
WHERE MOD(TO_CHAR(my_date, 'J'), 7) + 1 IN (6, 7);
这篇关于确定 Oracle 日期是否在周末?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!