PLSQL 并非所有变量都绑定
我不断收到以下错误,“ORA-01008:并非所有变量都绑定”,我猜测它 全部基于我的 pPostcode 参数,但我不确定。 我是整个 PLSQL 领域的初学者,如果有任何帮助,我将不胜感激,
这是我的过程:
procedure all_customer_postcode(pPostcode in carer.postcode%type
,pReport out SYS_REFCURSOR) is
begin
open pReport for
select c.id, c.forename, c.surname,c.address_1,c.address_2,
c.address_3,c.address_4, c.postcode, c.date_of_birth, cf.id
from customer c, customer_friend cf,customer_friend_for cff
where c.id = cff.customer_id AND cff.id = cff.customer_friend_id
AND c.postcode = pPostcode;
end;
谢谢乔恩
i keep getting the following errror, 'ORA-01008: not all variables bound', im guessign its
all based on my pPostcode param but im not sure.
I am a beginner the the whole PLSQL secne and any help would be greatly apriciated
here is my procedure:
procedure all_customer_postcode(pPostcode in carer.postcode%type
,pReport out SYS_REFCURSOR) is
begin
open pReport for
select c.id, c.forename, c.surname,c.address_1,c.address_2,
c.address_3,c.address_4, c.postcode, c.date_of_birth, cf.id
from customer c, customer_friend cf,customer_friend_for cff
where c.id = cff.customer_id AND cff.id = cff.customer_friend_id
AND c.postcode = pPostcode;
end;
Thanks Jon
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我稍微修改了你的过程,因为你发布的 WHERE 子句对我来说没有意义...
在 SQL*Plus 中使用变量调用它是可行的...
那么,我们怎样才能让它抛出 ORA-1008 呢?通过将查询转换为字符串并更改参数的声明方式...
所以让我们修复这个问题...
所以我成功地重新创建了一个 ORA-1008;我不确定它是否符合您的ORA-1008情况。您的直觉是正确的,这与 pPostcode 中的值如何传递给查询有关。只是您发布的代码实际上正确执行了操作,因此不会失败。
I have amended your procedure slight, as the WHERE clause you published didn't make sense to me...
Calling it in SQL*Plus with variables works ...
So, how can we get it to hurl an ORA-1008? By turning the query into a string and changing the way the parameter is declared...
so let's fix that ...
So I have managed to recreate an ORA-1008; I'm not sure whether it matches your ORA-1008 situation. Your intuition is right, it is something to do with how the value in
pPostcode
is passed to the query. It is just that the code you posted actually does it correctly and so doesn't fail.