在 PL SQL 过程中从外部源检索 POST 数据
编辑〜我已经在下面的编辑部分回答了我自己的问题,没有回答,因为如果我回答我自己的帖子而得到分数,我感觉不对=/
我正在尝试找到一种方法通过URL将参数传递给这个过程
create or replace procedure extinput(KEY in varchar2 := 'KEY',NAME in varchar2 := 'NAME') is
l_apex_url varchar2(4000);
begin
htp.p('Hello extinput');
htp.p(KEY);
--htp.p('NAME');
htp.p(NAME);
--l_apex_url:= 'http://myhost:myport/pls/apex/extinput;
--l_apex_url:= 'google.com';
--owa_util.redirect_url(l_apex_url);
end extinput;
如果我插入URL:
http://horizon.lcc.edu:7777/pls/apex/extinput
进入我的浏览器,然后页面显示:
Hello extinput KEY NAME
这对于确认我可以通过 url 调用该过程来说很好,但现在我正在努力将一些变量传递给它的参数。
我想知道是否必须将值放入 URL [GET] 中(真的不愿意),或者是否有办法从外部服务器上的表单中检索 [POST] 数据,如下所示:
<form Method="POST" action="http://horizon.lcc.edu:7777/pls/apex/extinput" name="form1">
<P><b>This form has three parameters, which matches the number of parameters the procedure view_http_post_fixed has.</b>
<table><tr><td>Session Id:</td>
<td><input type="text" name="SESSION_ID" value="9582274473829998340"> </td>
</tr>
<tr><td>Key:</td>
<td><input type="text" name="KEY" id="KEY" value="1109"></td>
</tr>
<tr><td>Name:</td>
<td> <input type="text" name="NAME" id="NAME" value="Jeff Eberhard"></td>
</tr></table>
<input value="Submit" type="submit">
</form>
任何帮助或“点在正确的方向”将非常感激 =)
$$ 编辑 $$
好吧,所以我已经成功地在我的 pl sql 过程中获得了传递的帖子数据
create or replace procedure extinput(KEY in varchar2 := 'KEY',NAME in varchar2 := 'NAME')
is
l_apex_url varchar2(4000);
begin
htp.p('Hello extinput');
htp.p(KEY);
htp.p(NAME);
insert into post_table (col2, col3 ) values(KEY, NAME);
end extinput;
得出这个结论让我觉得我让这个问题变得比需要的更复杂是。抱歉,如果是这样,但至少这个问题现在已经解决了。
抛出错误是因为我发送了 3 个参数,但只在过程中编码了两个。因此,要么从表单中删除输入,要么添加第三个参数区域。这是最终的表格:
<form Method="POST" action="http://horizon.lcc.edu:7777/pls/apex/extinput" name="form1">
<P><b>This form has three parameters, which matches the number of parameters the procedure view_http_post_fixed has.</b>
<table>
<tr><td>Key:</td>
<td><input type="text" name="KEY" id="KEY" value="1109"></td>
</tr>
<tr><td>Name:</td>
<td> <input type="text" name="NAME" id="NAME" value="Jeff Eberhard"></td>
</tr></table>
<input value="Submit" type="submit">
</form>
EDIT ~ I have answered my own question below in the EDIT section, not answering because i feel wrong if i get points for answering my own post =/
I am trying to find a way to pass parameters to this procedure via a URL
create or replace procedure extinput(KEY in varchar2 := 'KEY',NAME in varchar2 := 'NAME') is
l_apex_url varchar2(4000);
begin
htp.p('Hello extinput');
htp.p(KEY);
--htp.p('NAME');
htp.p(NAME);
--l_apex_url:= 'http://myhost:myport/pls/apex/extinput;
--l_apex_url:= 'google.com';
--owa_util.redirect_url(l_apex_url);
end extinput;
If i plug the URL:
http://horizon.lcc.edu:7777/pls/apex/extinput
into my browser then the page dispays:
Hello extinput KEY NAME
Which is fine for confirming that i can call the procedure via a url, but now im working on passing some variables to its parameters.
I want to know if I will have to put the values in the URL [GET] (really would rather not) or if there is a way to reteive the [POST] data from a form on an external server like so:
<form Method="POST" action="http://horizon.lcc.edu:7777/pls/apex/extinput" name="form1">
<P><b>This form has three parameters, which matches the number of parameters the procedure view_http_post_fixed has.</b>
<table><tr><td>Session Id:</td>
<td><input type="text" name="SESSION_ID" value="9582274473829998340"> </td>
</tr>
<tr><td>Key:</td>
<td><input type="text" name="KEY" id="KEY" value="1109"></td>
</tr>
<tr><td>Name:</td>
<td> <input type="text" name="NAME" id="NAME" value="Jeff Eberhard"></td>
</tr></table>
<input value="Submit" type="submit">
</form>
Any help or "point's in the right direction" will be GREATLY appreciated =)
$$ EDIT $$
Ok so i have successfully gotten passed post data in my pl sql procedure
create or replace procedure extinput(KEY in varchar2 := 'KEY',NAME in varchar2 := 'NAME')
is
l_apex_url varchar2(4000);
begin
htp.p('Hello extinput');
htp.p(KEY);
htp.p(NAME);
insert into post_table (col2, col3 ) values(KEY, NAME);
end extinput;
Coming to this conclusion makes me feel like i made this question more complicated then it needed to be. Sorry if that is so, but atleast this problem is now solved.
Errors were being thrown because i was sending 3 parameters but only coded two into the procedure. So either remove an input from the form, or add a third parameter area. here is the finalized form:
<form Method="POST" action="http://horizon.lcc.edu:7777/pls/apex/extinput" name="form1">
<P><b>This form has three parameters, which matches the number of parameters the procedure view_http_post_fixed has.</b>
<table>
<tr><td>Key:</td>
<td><input type="text" name="KEY" id="KEY" value="1109"></td>
</tr>
<tr><td>Name:</td>
<td> <input type="text" name="NAME" id="NAME" value="Jeff Eberhard"></td>
</tr></table>
<input value="Submit" type="submit">
</form>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
http:// /awads.net/wp/2005/11/30/http-post-from-inside-oracle/
另外,如果您希望在 Oracle 11 上使用它,请不要忘记访问控制列表。
There is a rather lengthy discussion on this at http://awads.net/wp/2005/11/30/http-post-from-inside-oracle/
Also, don't forget Access Control Lists if you are looking to use this on Oracle 11.
根据您的评论,我相信您可以通过使用分支来解决这个问题,因为您真正想做的就是在用户提交表单时重定向用户。或者甚至更好,不要分支,只需创建一个提交过程,并定义成功和失败消息 - 不需要单独的页面。
From your comment i believe you could solve this by using branches, since all you really want to do is redirect the user when he submits his form. Or even better, don't branch, and simply create an on submit process, and define a success and failure message - no seperate page required.
我认为演示位于
http://htmldb.oracle.com/pls/otn/f?p =9487:65可以回答您的问题。
I think the demo at
http://htmldb.oracle.com/pls/otn/f?p=9487:65 may answer your question.
好吧,我已经成功地在我的 pl sql 过程中获得了传递的帖子数据
得出这个结论让我觉得我让这个问题变得比它需要的更复杂。抱歉,如果是这样,但至少这个问题现在已经解决了。
抛出错误是因为我发送了 3 个参数,但只在过程中编码了两个。因此,要么从表单中删除输入,要么添加第三个参数区域。这是最终的表格:
Ok so i have successfully gotten passed post data in my pl sql procedure
Coming to this conclusion makes me feel like i made this question more complicated then it needed to be. Sorry if that is so, but atleast this problem is now solved.
Errors were being thrown because i was sending 3 parameters but only coded two into the procedure. So either remove an input from the form, or add a third parameter area. here is the finalized form: