ITPub博客

首页 > 数据库 > Oracle > 关于参数FIXED_DATE的使用

关于参数FIXED_DATE的使用

原创 Oracle 作者:litterbaby 时间:2007-04-01 19:01:32 0 删除 编辑
关于参数FIXED_DATE的使用[@more@]

关于参数FIXED_DATE的使用

Parameter type

String

Syntax

FIXED_DATE = YYYY-MM-DD-HH24:MI:SS (or the default Oracle date format)

Default value

There is no default value.

Parameter class

Dynamic: ALTER SYSTEM

FIXED_DATE enables you to set a constant date that SYSDATE will always return instead of the current date. This parameter is useful primarily for testing. The value can be in the format shown above or in the default Oracle date format, without a time.

这是Oracle文档给出的解释,意思是设置这个参数能够固定SYSDATE的数值,将这个SYSDATE数值固定到一个自己想要的一个时间点上,这个参数的功能主要是用在测试上,但是这个参数只是能够影响SYSDATE的值,而不能够影响SYSTIMESTAMP的值。

SQL> show parameter fixed_date

NAME TYPE VALUE

------------------------------------ ----------- ------------------------------

fixed_date string

SQL> alter session set nls_date_format='yyyy-mm-dd hh24:mi:ss';

会话已更改。

SQL> select sysdate from dual;

SYSDATE

-------------------

2006-08-18 09:30:51

SQL> alter system set fixed_date='2006-02-02 02:02:02';

系统已更改。

SQL> select sysdate from dual;

SYSDATE

-------------------

2006-02-02 02:02:02

SQL> select systimestamp from dual;

SYSTIMESTAMP

---------------------------------------------------------------------------

18-8月 -06 09.31.47.000000 上午 +08:00

SQL> select sysdate from dual;

SYSDATE

-------------------

2006-02-02 02:02:02

SQL> select systimestamp from dual;

SYSTIMESTAMP

---------------------------------------------------------------------------

18-8月 -06 09.32.13.937000 上午 +08:00

SQL>

从上面的实验可以看到上述的结论。在oracle的错误中有一个错误是和这个参数有关:

ORA-00065: initialization of FIXED_DATE failed

Cause: The FIXED_DATE string was not in date format yyyy-mm-dd hh24:mi:ss.

Action: Make sure the initialization parameter is in the correct date format.

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/222350/viewspace-908005/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
  • 博文量
    131
  • 访问量
    465730