blackwindow
blackwindow

Reputation: 437

Cannot create View

I have the following query:

SELECT C.company_name,
       C.JOB_TITLE, 
       E.date_joined,
       E.date_left,
       A.first_name || ' ' || A.last_name AS NAME
  FROM COMPANY C, ALUMNUS A, EMPLOYMENT_HISTORY E
 where E.alumnus_id = A.alumnus_id
   and E.company_id = C.company_id
   and E.employee_id = C.employee_id 
 order by date_joined;

but when I used the above code to create a view not able to do that with the following error message

 Error report -
 SQL Error: ORA-00907: missing right parenthesis
 00907. 00000 -  "missing right parenthesis"
 *Cause:    
 *Action:

I used the following code to create the view

CREATE VIEW VIEW AS (
SELECT C.company_name,
       C.JOB_TITLE, 
       E.date_joined,
       E.date_left,
       A.first_name || ' ' || A.last_name AS NAME
 FROM COMPANY C, ALUMNUS A, EMPLOYMENT_HISTORY E
 where E.alumnus_id = A.alumnus_id
   and E.company_id = C.company_id
   and E.employee_id = C.employee_id 
 order by date_joined);

Please help.

Upvotes: 1

Views: 190

Answers (1)

davegreen100
davegreen100

Reputation: 2115

you don't need the brackets you have in your code

CREATE VIEW VIEWE AS
SELECT C.company_name, C.JOB_TITLE, E.date_joined, E.date_left, A.first_name || ' ' || A.last_name AS NAME
FROM COMPANY C, ALUMNUS A, EMPLOYMENT_HISTORY E
where E.alumnus_id=A.alumnus_id 
and E.company_id=C.company_id 
and E.employee_id =C.employee_id 
order by date_joined;

Upvotes: 1

Related Questions