Hi,
What is the Oracle equivalent of "Dual" table in SqlServer?
Thanks in advance.
Regards, BI DWH BALA
Hi,
What is the Oracle equivalent of "Dual" table in SqlServer?
Thanks in advance.
Regards, BI DWH BALA
There is no equivalent.
DUAL is introduced to be SQL standard conform. In sql server you can leave the table if there is none in select statement.
Oracle
SELECT sysdate FROM DUAL;
SQL server
SELECT getdate();
The two statements above to select the current date show the different usage.
It doesn't exist but... you could create one if you wanted to be able to code consistently across different platforms.
create table dual (dual int)
go
insert values (1)
go
select getdate() from dual
-- returns 2009-12-03
You'd probably want to add a default of 1, add a constraint that it must be 1 and a PK. And maybe a trigger that prevents deleting the record. I'm not sure if there are any other conditions to look out for and defend against. If the table contained 0 or more than 1 rows, you wouldn't get just one date value returned.
IBM DB2 has a similar table which I believe is called sysibm.sysdummy.
No one has followed this question yet.