What `x` means in this Oracle SQL statement:` select * from dual where x = 1 or 1 = 1`

I accidentally discovered that in Oracle SQL, you can follow these instructions select * from dual where x=1 or 1=1.

  • Column in dualhas a name dummy, not x.
  • If I select from any other table, it still works, returning all rows.
  • select * from dual where y=1 or 1=1 also works.
  • select * from dual where z=1 or 1=1doesn't work giving ORA-00904: z: invalid identifier.
  • select * from dual where x=1doesn't work giving ORA-06553: PLS-306: wrong number or types of arguments in call to 'OGC_X'.

What do xu mean y?

+4
source share
1 answer

This is similar to the fact that on some versions of Oracle DB there are synonyms with the names X and Y:

select owner, synonym_name, table_owner, table_name from dba_synonyms where synonym_name in ('X', 'Y');

OWNER                          SYNONYM_NAME                   TABLE_OWNER                    TABLE_NAME
------------------------------ ------------------------------ ------------------------------ ----------
PUBLIC                         X                              MDSYS                          OGC_X
PUBLIC                         Y                              MDSYS                          OGC_Y
+2
source

All Articles