jwebster77
asked on
Error Creating View: ORA-00933: SQL command not properly ended
Hi all,
I have a view I am trying to create using TOAD, or SQL Plus for that matter. I get the error message: Error Creating View: ORA-00933: SQL command not properly ended If I just run the select statement, it works fine. Please help!!!
Here is the full code:
CREATE VIEW APPS.REPORTS_EMPLOYEECLOCK
AS
SELECT p2.full_name, p.full_name, sum(t.clock), sum(t.pay), sum(t.labor) from (select distinct person_id, full_name from hr.per_all_people_f where current_employee_flag = 'Y') p, hr.per_all_assignments_f a, (select distinct person_id, full_name, person_type_id from hr.per_all_people_f where current_employee_flag = 'Y') p2, (select c.person_id, c.time_in, nvl(c.total_hours,0) as clock, nvl(c.supervisor_hours,0) as pay, sum(nvl(l.break_adjusted_t ime_out - l.time_in,0)*24) as labor from ctl.timeclock_clock_card c, ctl.timeclock_labor_card l where c.person_id = l.person_id(+) and l.time_in(+) between c.time_in and c.time_out group by c.person_id, c.time_in, c.total_hours, c.supervisor_hours) t where t.person_id = p.person_id and t.person_id = a.person_id(+) and a.supervisor_id = p2.person_id(+) group by p2.full_name, p.full_name order by p2.full_name, p.full_name;
I have a view I am trying to create using TOAD, or SQL Plus for that matter. I get the error message: Error Creating View: ORA-00933: SQL command not properly ended If I just run the select statement, it works fine. Please help!!!
Here is the full code:
CREATE VIEW APPS.REPORTS_EMPLOYEECLOCK
AS
SELECT p2.full_name, p.full_name, sum(t.clock), sum(t.pay), sum(t.labor) from (select distinct person_id, full_name from hr.per_all_people_f where current_employee_flag = 'Y') p, hr.per_all_assignments_f a, (select distinct person_id, full_name, person_type_id from hr.per_all_people_f where current_employee_flag = 'Y') p2, (select c.person_id, c.time_in, nvl(c.total_hours,0) as clock, nvl(c.supervisor_hours,0) as pay, sum(nvl(l.break_adjusted_t
Does the DML work without the "APPS." prefix?
i.e.
CREATE VIEW REPORTS_EMPLOYEECLOCK
AS
SELECT p2.full_name
, p.full_name
, sum(t.clock)
, sum(t.pay)
, sum(t.labor)
from (select distinct person_id
, full_name
from hr.per_all_people_f
where current_employee_flag = 'Y') p
, hr.per_all_assignments_f a
, (select distinct person_id
, full_name
, person_type_id
from hr.per_all_people_f
where current_employee_flag = 'Y') p2
, (select c.person_id
, c.time_in
, nvl(c.total_hours,0) as clock
, nvl(c.supervisor_hours,0) as pay
, sum(nvl(l.break_adjusted_t ime_out - l.time_in,0)*24) as labor
from ctl.timeclock_clock_card c
, ctl.timeclock_labor_card l
where c.person_id = l.person_id(+)
and l.time_in(+) between c.time_in and c.time_out
group by c.person_id, c.time_in, c.total_hours, c.supervisor_hours) t
where t.person_id = p.person_id
and t.person_id = a.person_id(+)
and a.supervisor_id = p2.person_id(+)
group by p2.full_name, p.full_name
order by p2.full_name, p.full_name;
i.e.
CREATE VIEW REPORTS_EMPLOYEECLOCK
AS
SELECT p2.full_name
, p.full_name
, sum(t.clock)
, sum(t.pay)
, sum(t.labor)
from (select distinct person_id
, full_name
from hr.per_all_people_f
where current_employee_flag = 'Y') p
, hr.per_all_assignments_f a
, (select distinct person_id
, full_name
, person_type_id
from hr.per_all_people_f
where current_employee_flag = 'Y') p2
, (select c.person_id
, c.time_in
, nvl(c.total_hours,0) as clock
, nvl(c.supervisor_hours,0) as pay
, sum(nvl(l.break_adjusted_t
from ctl.timeclock_clock_card c
, ctl.timeclock_labor_card l
where c.person_id = l.person_id(+)
and l.time_in(+) between c.time_in and c.time_out
group by c.person_id, c.time_in, c.total_hours, c.supervisor_hours) t
where t.person_id = p.person_id
and t.person_id = a.person_id(+)
and a.supervisor_id = p2.person_id(+)
group by p2.full_name, p.full_name
order by p2.full_name, p.full_name;
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See the following as my interpretation of what you're trying to do and see if it's the wrong idea:
Open in new window