Home > Mobile >  Equivalent of SELECT without FROM in Oracle
Equivalent of SELECT without FROM in Oracle

Time:10-13

I have the following query in SQL Server :

Select -1 AS DeptSK, 0 AS DeptID, "Undefined" AS DeptName

It represents a dummy record in my Department dimension. I try to do the same in Oracle but I get this error :

FROM Keyword not found where expected

CodePudding user response:

In Oracle, the SELECT statement must have a FROM clause. However, some queries don’t require any table like the example you provided. You can use the DUAL table which is a special table that belongs to the schema of the user SYS but it is accessible to all users.

The DUAL table has one column named DUMMY whose data type is VARCHAR2() and contains one row with a value X.:

Select -1 AS DeptSK, 0 AS DeptID, "Undefined" AS DeptName
FROM dual
  • Related