动态内容区域无法在Oracle Apex页面项中读取。

huangapple go评论47阅读模式
英文:

Dynamic Content Region not able to read in page item in Oracle Apex

问题

我在APEX中有一个动态内容部分。

declare
    l_result                clob;
    l_email_id              number;
    l_email_subject         VARCHAR2(200);
    l_file_name             VARCHAR2(200);
    l_url                   VARCHAR2(400);
    l_app                   number := v('APP_ID');
    l_session               number := v('APP_SESSION');
    l_attachment_id         number := v('P1_ID');
begin
    sys.dbms_output.enable;
    sys.dbms_output.put_line('some data'); 
    sys.dbms_output.put_line('other data'); 
    sys.DBMS_OUTPUT.PUT_LINE('DBMS --> P1_ID: ' || l_attachment_id);
    sys.DBMS_OUTPUT.PUT_LINE('DBMS --> l_app: ' || l_app);
    sys.DBMS_OUTPUT.PUT_LINE('DBMS --> l_session: ' || l_session);
    apex_debug.log_dbms_output; 
end;

在我的调试日志中,APP_ID和SESSION返回有效值,但我的页面项'P1_ID'被解析为'&P1_ID.'而不是页面项的值'15'。

问题出在这一行:

l_attachment_id         number := v('P1_ID');

使用绑定语法':P1_ID'也不起作用。

我肯定可以在动态内容组件的PL/SQL块中读取页面项吧?

为什么:

v('P1_ID')

返回:

&P1_ID.

而不是会话状态中页面项的值15?

我正在使用APEX 23.1。

英文:

I have a Dynamic Content section in APEX.

declare
    l_result                clob;
    l_email_id              number;
    l_email_subject         VARCHAR2(200);
    l_file_name             VARCHAR2(200);
    l_url                   VARCHAR2(400);
    l_app                   number := v('APP_ID');
    l_session               number := v('APP_SESSION');
    l_attachment_id         number := v('P1_ID');

    
begin

    sys.dbms_output.enable;
    sys.dbms_output.put_line('some data'); 
    sys.dbms_output.put_line('other data'); 
    sys.DBMS_OUTPUT.PUT_LINE('DBMS --> P1_ID: ' || l_attachment_id);
    sys.DBMS_OUTPUT.PUT_LINE('DBMS --> l_app: ' || l_app);
    sys.DBMS_OUTPUT.PUT_LINE('DBMS --> l_session: ' || l_session);
    apex_debug.log_dbms_output; 

end;

While my debug logs return valid values for the APP_ID and the SESSION, my page item 'P1_ID' is being resolved to '&P1_ID.' rather than '15' which is the value of the page item.

So this is the issue:

 l_attachment_id         number := v('P1_ID');

So I am getting "invalid number" type errors.

Neither does using bind syntax work ':P1_ID'.

Surely I can read in a page item in a PL\SQL block in a Dynamic Content component?

Why is:

v('P1_ID')

returning:

&P1_ID.

And not 15, the value of the page item in session state?

I am using APEX 23.1.

答案1

得分: 1

动态内容区域在几个版本前发生了变化。在旧版本中(现在称为PL/SQL动态内容[遗留]),语法如下:

htp.p(:P104_ITEM1);
htp.p(:APP_PAGE_ID);

新版本称为动态内容,是一个返回CLOB的PL/SQL函数:

declare
    l_result                clob;
begin
    l_result := :P104_ITEM1;
    l_result := l_result ||'<br>'||:APP_PAGE_ID;
    return l_result;
end;

我建议不要在应用程序中使用"V-syntax" V('P104_ITEM1')。这比只使用绑定变量语法:P104_ITEM要慢得多。V-syntax应该用于其他对象中以便它们能够编译(例如包、视图、触发器)。

我还认为使用htp过程优于使用dbms_output。

英文:

The dynamic content region changed a couple of versions ago. In the old version (now called PL/SQL Dynamic Content [legacy]) the syntax is:

htp.p(:P104_ITEM1);
htp.p(:APP_PAGE_ID);

The new one called Dynamic Content is a pl/sql function returning a CLOB

declare
    l_result                clob;
begin
    l_result := :P104_ITEM1;
    l_result := l_result ||&#39;&lt;br&gt;&#39;||:APP_PAGE_ID;
    return l_result;
end;

I'd refrain from using the "V-syntax" V('P104_ITEM1') within the app. It is a lot slower than just using bind variable syntax :P104_ITEM. The V-syntax is meant to be used in other objects to make them compile (packages, views, triggers).

I also think the use of the htp procedures is preferred over using dbms_output.

答案2

得分: 0

P1_ID查询参数缺失!

英文:

P1_ID query parameter was missing.!

huangapple
  • 本文由 发表于 2023年7月20日 17:47:17
  • 转载请务必保留本文链接:https://go.coder-hub.com/76728627.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定