我的 friend 问我是否有办法使用 1 个查询来选择日期时间并将其用于任何数据库。
Atm 他对 Oracle 使用此查询:
SELECT vt_sysdate() FROM dual;
我知道双表仅适用于 Oracle。但他也想对其他数据库(例如 PostgreSQL)使用相同的查询。
那么有没有办法让这个查询在每个数据库上运行(也许通过为每个数据库创建一个双表)。或者是否有查询来获取适用于任何数据库的系统日期时间?
谢谢你的帮助。
最佳答案
不,我不这么认为,因为 Oracle 坚持要怪异,而 MS SQL 似乎根本不支持标准的 current_date
。
MySQL accepts SELECT current_date;
, doesn't understand VALUES
.
PostgreSQL accepts SELECT current_date;
or VALUES
.
MS SQL doesn't seem to understand current_date
at all .
Oracle understands current_date
but not scalar queries without FROM
.
关于sql - 查询以获取每个数据库的日期时间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22650251/