I have the nexr SQL code:
Code Here:
select
'Total Referrals' as Details,
count(REFERRED) as Total
from
PD\_PATIENT\_DETAILS
where
REFERRED = 'Yes'
and EVENT_DATE between P26_EVENT_DATE and P26_EVENT_DATE_END;
This is to show stats(in this case the number of Referrals) from a table between 2 dates. So I created a page in Apex 5.1 and created 4 Page Items namely: Details(Display Only), Totals(Display Only), Event Date(Date Picker) and Event Date End(Date Picker). Then created a button, Submit, with the following criteria:
Action:
Defined by Dynamic Action.
Execute Validations:
Yes.
Under Dynamic Actions:
Refresh Region:
Event: Click
Selection Type: Button
Button: Submit
Then created under Refresh Region:
Execute PL/SQL code:
Action: Execute PL/SQL code
Settings: PL/SQL Code:
Code Here:
declare
Details varchar2(20);
Total number(18);
Begin
select
'Total Referrals' as Details,
count(REFERRED) as Total
INTO :Details, :Totals
from
PD\_PATIENT\_DETAILS
where
REFERRED = 'Yes'
and EVENT\_DATE between :P26\_EVENT\_DATE and :P26\_EVENT\_DATE\_END;
END;
Under Execute PL/SQL code I created an Action: Refresh
Action: Refresh
Affected Elements: Selection Type -> Items
Items -> P26\_DETAILS, P26\_TOTAL
Execution Options: Event: Refresh Region
When I run the report and click Submit I get the following error:
Ajax call returned server error ORA-20876: Stop APEX Engine for Execute PL/SQL Code.
I don't know why and can't figure it out. I am new to Apex and all of this so need all the help I can get, please?


