Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help converting SQL statement to Oracle

Status
Not open for further replies.

WildWest

Programmer
Apr 2, 2002
111
US
I have Oracle 8 and I need help. Can someone help me convert the following SQL to Oracle. I need help with the FROM clause (I think). Thanks in advance!

SELECT DEPT.DESCRIPTION AS deptname,
EMPLOYEE.CC, EMPLOYEE.NAME,
EMPLOYEE.EMP_NUM,
view_Employees.TOT_HRS,
view_Employees.SUBMITTED_BY,
view_Employees.SUBMIT_DATE,
view_Employees.APPROVED_BY,
view_Employees.APPROVE_DATE,
C_EMPADD.USER_NAME
FROM DEPT INNER JOIN
EMPLOYEE ON DEPT.DEPARTMENT = EMPLOYEE.DEPT
INNER JOIN
C_EMPADD ON EMPLOYEE.EMP_NUM = C_EMPADD.EMP_NUM
LEFT OUTER JOIN
view_Employees ON EMPLOYEE.EMP_NUM = view_Employees.EMP_NUM
WHERE (EMPLOYEE.CC <> '1') AND
(EMPLOYEE.SHIFT = '1')
ORDER BY DEPT.DESCRIPTION,
EMPLOYEE.CC, EMPLOYEE.NAME
 
I suppose that your syntax is valid on 9i. For 8i it should be something like:

SELECT DEPT.DESCRIPTION AS deptname,
EMPLOYEE.CC, EMPLOYEE.NAME,
EMPLOYEE.EMP_NUM,
view_Employees.TOT_HRS,
view_Employees.SUBMITTED_BY,
view_Employees.SUBMIT_DATE,
view_Employees.APPROVED_BY,
view_Employees.APPROVE_DATE,
C_EMPADD.USER_NAME
FROM DEPT, EMPLOYEE,
C_EMPADD,view_Employees
WHERE EMPLOYEE.CC <> '1' AND
EMPLOYEE.SHIFT = '1'
AND DEPT.DEPARTMENT = EMPLOYEE.DEPT
AND EMPLOYEE.EMP_NUM = C_EMPADD.EMP_NUM
AND EMPLOYEE.EMP_NUM = view_Employees.EMP_NUM(+)
ORDER BY DEPT.DESCRIPTION,
EMPLOYEE.CC, EMPLOYEE.NAME

Regards, Dima
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top