Problem with the order by clause and Views
535608Nov 5 2006 — edited Nov 5 2006I am aware that we cannot use order by while creating views. But I had a problem with order by while retreiving data using views.
I have created a view to list the last names,department names, salaries, salgrades of all the employees with the following syntax:
I have used the following tables: EMPLOYEES, DEPARTMENTS,SALARIES,SALGRADE
CREATE OR REPLACE VIEW salary_vu
AS
SELECT e.last_name "Employee", d.department_name "Department",
e.salary "Salary", s.grade "Grades"
FROM employees e, departments d, salgrade s
WHERE e.department_id = d.department_id
AND e.salary BETWEEN s.losal AND s.hisal;
When I am trying to retreive the data using the following query
select * from salary_vu;
Its working fine.
How can I use order by while retreiving data using views?
for ex: select * from salary_vu order by Employee;
The above stmt gives error, I want to know the correct syntax
Thanks
null