ORA-00904 scn_to_timestamp

Source: Internet
Author: User

ORA-00904 scn_to_timestamp

In Oracle, the scn and time can be converted to each other, and the friend's database is 10.2.0.5. Previously, it was normal to convert the scn to the corresponding time through scn_to_timestamp, but an error was reported during the execution today.
SQL> select to_char (scn_to_timestamp (3111823), 'yyyy-mm-dd hh24: mi: ss') from dual;
Select to_char (scn_to_timestamp (3111823), 'yyyy-mm-dd hh24: mi: ss') from dual;
*
ERROR at line 1:
ORA-00904: "SCN_TO_TIMESTAMP": invalid identifier

It is strange that the status of the scn_to_timestamp function is queried through the following query statement.
SQL> select owner, object_name, object_type, last_ddl_time, status from dba_objects where object_name = 'scn _ TO_TIMESTAMP ';

OWNER OBJECT_NAME OBJECT_TYPE LAST_DDL_TIME STATUS
------------------------------------------------------------------------
SYS SCN_TO_TIMESTAMP FUNCTION 2014/11/26 12 VALID
PUBLIC SCN_TO_TIMESTAMP SYNONYM 2014/11/26 12 VALID


Then I re-run the create statement of the scn_to_timestamp function.
Create or replace function scn_to_timestamp (query_scn in number)
Return TIMESTAMP
IS EXTERNAL
NAME "ktfexscntot"
WITH CONTEXT
PARAMETERS (context,
Query_scn OCINUMBER,
RETURN)
LIBRARY DBMS_TRAN_LIB;


After execution, execute the query for the scn_to_timestamp function.
SQL> select to_char (scn_to_timestamp (3111823), 'yyyy-mm-dd hh24: mi: ss') from dual;

TO_CHAR (SCN_TO_TIMESTAMP (31118
------------------------------
16:26:27


However, a newly created scn_to_timestamp function does not replace the original
SQL> select owner, object_name, object_type, last_ddl_time, status from dba_objects where object_name = 'scn _ TO_TIMESTAMP ';

OWNER OBJECT_NAME OBJECT_TYPE LAST_DDL_TIME STATUS
--------------------------------------------------------------------------
SYS SCN_TO_TIMESTAMP FUNCTION 2014/11/26 12 VALID
PUBLIC SCN_TO_TIMESTAMP SYNONYM 2014/11/26 12 VALID
SYS SCN_TO_TIMESTAMP FUNCTION VALID


The cause is not found yet. It may be an oracle bug because after I re-create the scn_to_timestamp function in oracle 10.2.0.4, the generated scn_to_timestamp function is not displayed when I query dba_objects.
Connected to Oracle Database 10g Enterprise Edition Release 10.2.0.4.0
Connected as SYS

SQL>
SQL> create or replace function scn_to_timestamp (query_scn IN NUMBER)
2 return TIMESTAMP
3 IS EXTERNAL
4 NAME "ktfexscntot"
5 WITH CONTEXT
6 PARAMETERS (context,
7 query_scn OCINUMBER,
8 RETURN)
9 LIBRARY DBMS_TRAN_LIB;
10/

Function created

SQL> select owner, object_name, object_type, last_ddl_time, status from dba_objects where object_name = 'scn _ TO_TIMESTAMP ';

OWNER OBJECT_NAME OBJECT_TYPE LAST_DDL_TIME STATUS
-------------------------------------------------------------------------
SYS SCN_TO_TIMESTAMP FUNCTION VALID
PUBLIC SCN_TO_TIMESTAMP SYNONYM 2008/4/23 12: INVALID

In addition, after the scn_to_timestamp function is rebuilt in 10.2.0.4, the corresponding synonym becomes invalid. This is correct. After the scn_to_timestamp function is rebuilt in 10.2.0.5, a new object with the same name is generated, the corresponding synonym is still valid.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.