As keyword in oracle example

“AS” and “Alias” keyword in oracle:

“As” or “Alias” is not allowed in oracle for table names and it is used only for columns

Table not allowing “As” and “Alias” in oracle:

Query without As for table (works fine)

SELECT empIdName.empName,es.empSalary FROM empIdName INNER JOIN empIdSalary P1 ON P1.empId = empIdName.empId INNER JOIN empCodeSalary es ON es.empCode = p1.empsalary

Query with As for table (throws error)

SELECT empIdName.empName,es.empSalary FROM empIdName INNER JOIN empIdSalary as P1 ON P1.empId = empIdName.empId INNER JOIN empCodeSalary as es ON es.empCode =

p1.empsalary

ORA-00905: missing keyword
00905. 00000 – “missing keyword”
*Cause:
*Action:
Error at Line: 100 Column: 76

Columns allowing “AS” and “Alias” in oracle:

SELECT empIdName.empName as “employee name”,es.empSalary as “employee salary” FROM empIdName INNER JOIN empIdSalary P1 ON P1.empId = empIdName.empId INNER JOIN¬†empCodeSalary es ON es.empCode = p1.empsalary

Columns works fine for both the scenarios (with As/Alias or without As/Alias).

 

Recommed Oracle Books:

400 total views, 1 views today

Leave a Reply

Your email address will not be published. Required fields are marked *