Is Oracle's CURRENT_TIMESTAMP function really a function?
I was under the impression that functions without arguments can be called with empty parentheses after the function name, that is, as some other databases allow:
current_timestamp()
While in Oracle I have to write
current_timestamp
This rule does not apply with custom functions (in 11g). I can write both
my_function
my_function()
My question is: Is the CURRENT_TIMESTAMP
function really a true function or should I think of it in the construct / pseudo-column language of the Oracle SQL dialect (SQL standard compliant)? Is there any formal definition of when I can (optionally, by mandate) add ()
and when I should omit them?
Background information:
-
SQL 1992 defines:
<current timestamp value function> ::= CURRENT_TIMESTAMP [ <left paren> <timestamp precision> <right paren> ]
-
Derby, HSQLDB, Ingres, Postgres, SQLite, SQL Server behave like Oracle with no parentheses for
CURRENT_TIMESTAMP
- Sybase SQL Anywhere knows the function
CURRENT TIMESTAMP
(no parentheses, no underscore) - CUBRID, MySQL, Sybase ASE allow you to use
CURRENT_TIMESTAMP()
source to share
SQL standards since 1992 refer to CURRENT_TIMESTAMP as both a "time-varying system variable" and a "datetime value function". See, for example, SQL Database Language .
But AFAIK the standards always use CURRENT_TIMESTAMP, never CURRENT_TIMESTAMP (). Using CURRENT_TIMESTAMP () on compatible dbms should fail with a syntax error.
I'm not sure what the standards have to say about custom functions.
source to share