Home >Database >Mysql Tutorial >Oracle PL/SQL之令人不解的提示(nls_date_format)

Oracle PL/SQL之令人不解的提示(nls_date_format)

WBOY
WBOYOriginal
2016-06-07 16:46:10918browse

Oracle在使用dbms_output.put_line或fnd_file.put_line等内置程序输出日期型参数时,会自动套用nls_date_format定义的日期格式,

刚刚测试了一段程序,,报错了,说是数据没有找到:

l_date1 != l_date2
l_date1=26-MAY-11, l_date2=26-MAY-11

……

查来查去原来是nls_date_format惹得祸。

Oracle在使用dbms_output.put_line或fnd_file.put_line等内置程序输出日期型参数时,会自动套用nls_date_format定义的日期格式,恰巧当前数据库中nls_date_format定义的日期格式为DD-MON-RR,没有时分秒,而参与比较的这两个日期却是带时分秒的,并且差异就在时分秒上:

输出:

linux

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn