How to avoid re running of my PL/SQL code on page refresh
I have a interactive report with one button
Interactive report -> I have set the table -> employee
Now on button -> I have set the property as -> submit page
On processing option -> under -> process -> written PL/SQL code
declare
m_count nnumber;
begin
select count(*) into m_count from employee;
if m_count > 0 then
execute immediate 'truncate table employee';
apex_application.g_print_success_message := 'truncated table !!!';
commit;
else
null;
end if ;
exception
when others
then
apex_error.add_error(p_message => 'unable to load',p_display_location => apex_error.c_line_in_notification);
end;
When I click on button -> my table gets truncated and in interactive report the details are vanished. It is expected one. It work like charm
Now after truncating and If I refresh page again shows me message : truncated table !!!
When my table does not have any records it should not show me any message -> return NULL ;
That is what I added in my code under else NULL. If count is zero. But again it goes into
apex_application.g_print_success_message := 'truncated table !!!';
On refresh I want to avoid executing my code again