Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我的数据库中有一个 DATE 类型的字段。我想存储日期和时间或仅存储日期。问题是如何测试我的 DATE 列是否包含日期和时间或仅包含日期。
v_date 日期; v_date := to_date('01-01-2013', 'DD-MM-YYYY'); v_text := to_char(v_date, 'HH24:Mi');
仅日期的 to_char('HH24:Mi') 返回 '00:00',而不是 null。 有什么方法可以测试日期列是否包含日期和时间或仅包含日期。
DATE 数据类型总是包含日期和时间。
单独存储时间和日期只是一个坏主意。您可以对您的 DATE 列进行任何您想要的关于时间部分的测试。
例如,要测试列是否在午夜,您可以使用:
if trunc(your_column) = your_column then blabla; end if;
并使用<>而不是=其他。
<>
=
My website is used to get RSS news (for example). Users of website can format the output of results by using template syntax like mustache and can set time to receive email what hot news in a da