PL / SQL将参数作为隐藏输入传递给另一个过程

时间:2014-08-20 15:22:05

标签: oracle plsql

我是PL / SQL的新手。

我有一个HTML表单,它是由PL / SQL程序生成的,类似于:

CREATE OR REPLACE PROCEDURE SAMPLE_P 
(I_CUSTOMER_ID in varchar2,
I_PRODUCT_CODE in varchar2)

AS
--var declarations here...
 htp.p('html head body tags here...');

 htp.p('<form action="SAMPLE_B" method="post" name="sample_form" enctype="text/plain">');

 htp.p('<input type="hidden" value="'||i_customer_id||'" name="i_customer_id">
        <input type="hidden" value="'||i_product_code||'" name="i_product_code">');

 htp.p('submit button and all the ending html tags here');

我的sample_b程序看起来类似于:

 create or replace PROCEDURE SAMPLE_B(
 i_customer_id in varchar2,
 i_product_code IN VARCHAR2)
 AS

 BEGIN
 htp.p('<html><head></head><body><h1>cust id = '||i_customer_id||'</h1><br><h1>product 
 ='||i_product_code||'</h1> <br> </body><html>');

 END SAMPLE_B;

此代码的问题在于,当我单击“提交”按钮时,我会收到一个错误页面,指出表单中不存在i_product_code。当我在sample_b中将i_product_code默认设置为null时,我没有收到任何错误,但在我新生成的页面中,cust id等于customer ID值,后跟产品代码值,产品代码为null。看起来而不是单个值我得到了第一个变量中的所有值,并且没有通过第二个变量发送任何值。我在这里缺少什么?

1 个答案:

答案 0 :(得分:0)

事实证明问题是表单属性enctype,当删除它时问题就消失了。