My friend asking me if there a way to use 1 query to select datetime and use it for any database.
Atm he using this query for Oracle :
SELECT vt_sysdate() FROM dual;
I know dual table is for Oracle only. But he want to use this same query for other database, for example PostgreSQL, as well.
So is there a way to make this query run on every database (Maybe by create a dual table for every database). Or is there a query to get system datetime that work on any database ?
Thank you for you help.
No, I don't think so, because Oracle insists on being weird, and MS SQL doesn't seem to support the standard current_date at all.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With