Encountered the Symbol 'Select' when expecting one of the following
Hi,
I have created a PL/SQL Program Unit in Oracle Reports to return the Deduction elements to be displayed on a report. This program Unit uses the below cursor,
CURSOR deduction_cur IS
SELECT DISTINCT dp1.employee_number, print_sequence, dp1.time_period_id,
dp1.element_name,
(SELECT SUM (dp2.pay_value)
FROM dp_payslip_elements dp2
WHERE dp1.element_name = dp2.element_name
AND dp1.employee_number = dp2.employee_number
AND dp1.time_period_id = dp2.time_period_id) AS pay_value
FROM dp_payslip_elements dp1
WHERE element_classification = 'D'
AND employee_number = :employee_number
AND time_period_id = :time_period_id
AND pay_value <> 0
ORDER BY employee_number, print_sequence, element_name;
The query works correctly in TOAD, but when I try and compile this with Oracle Reports I get this error message:
Encountered the Symbol 'Select' when expecting one of the following:
and then lists lots of key words.
Is there a way in Oracle reports to get round this issue, because I need this Sum value for each element?
Many Thanks
Martin