如果页面刷新,请避免运行该过程

发布于 2025-02-09 09:25:04 字数 953 浏览 0 评论 0原文

我有点混淆如何实现这一目标。

我有一个页面,该页面为交互式报告和一个称为trucate的按钮。

Interactive Report - > 选定的表:'员工' 我选择了操作为:在按钮上提交页面

,因此单击按钮 - > 截断 - >该表被截断,交互式报告没有显示任何细节。它可以按预期工作。

现在问题是当我再次刷新页面时,pl/sql代码可以运行!!!需要在刷新时避免这种情况,它不应

在按钮上再次执行 - >我已经设置了属性 - > 提交页面 创建了处理 - >流程 - > PL/SQL代码

pl/sql代码

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;

需要您提供帮助

I am bit confuse how to achieve this not getting.

I have a page which as interactive report and one button called trucate.

In interactive report -> selected table : 'employee'
I Selected action as : submit page on button

So when click on button -> truncate -> The table gets truncated and interactive report does not show any details. It works as expected.

Now the problem is when I refresh again page the PL/SQL code gets run !!!. Need to avoid this on refresh it should not execute again

On button -> I have set the property -> submit page
Created the processing -> process -> PL/SQL code

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;

Need you help on this

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

甜嗑 2025-02-16 09:25:04

在PL/SQL进程上设置“当按钮”的服务器侧条件。这应确保仅在单击按钮时运行。但是,在提交页面后,成功消息将成为URL的一部分。因此,当您随后重新加载页面时,将再次显示成功消息。
发生的是以下

  1. 渲染页(第一次)
  2. 单击按钮以在处理点“过程”中提交页面
  3. 运行PL/SQL。在这一点上,成功消息将
  4. 重定向页面(同一页码 - 只是一个重新加载)。由于这是一个重定向,因此页面需求在实际URL中的所有信息。其中包括(3)中生成的成功消息。

因此,(4)之后,页面的URL是在URL本身中具有成功消息的页面URL。如果页面刷新,则该消息将再次显示。但是该过程不会重新运行(因为页面未重新提交)

Set a server side condition of "When Button Pressed" on the pl/sql process. That should ensure it only runs when the button is clicked. However, the success message will be part of the url when after the page is submitted. So when you reload the page afterwards, the success message will be shown again.
What happens is the following

  1. Render Page (first time)
  2. Click Button to submit page
  3. Run pl/sql in processing point "process". At this point the success message is set
  4. Redirect the page (to same page number - it's just a reload). Since this is a redirect, all the information the page needs is in the actual url. That includes the success message generated in (3).

So... after (4) the url of the page is the page url that has the success message in the url itself. If the page is refreshed, then the message will be shown again. But the process will not re-run (since page is not re-submitted)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文