I cannot execute this query SQL

Show how to define the view student grades (ID, GPA) giving the grade-point average of each student; recall that we used a relation grade_points (grade, points) to get the numeric points associated with a letter grade. Make sure your view definition correctly handles the case of null values for the grade attribute of the takes relation.

create view student_grades(ID, GPA) as 
select ID, credit_ points / decode(credit sum, 0, NULL, credit_sum) 
from ((select ID, sum(decode(grade, NULL, 0, credits)) as credit_sum, 
sum(decode(grade, NULL, 0, credits*points)) as credit_points 
from(takes natural join course) natural left outer join grade points group by ID) 
union 
select ID, NULL 
from student 
where ID not in (select ID from takes));

Can someone please correct this code?