ORA-01007: variable not in select list(选择列表中没有变量)

并发程序报错:ORA-01007: variable not in select list(选择列表中没有变量) 以及相关动态指针写法

 

 网上的解决方法:

Cause:A reference was made to a variable not listed in the SELECT clause. In OCI, this can occur if the number passed for the position parameter is less than one or greater than the number of variables in the SELECT clause in any of the following calls: DESCRIBE, NAME, or DEFINE. In SQL*Forms or SQL*Report, specifying more variables in an INTO clause than in the SELECT clause also causes this error.
Action:Determine which of the problems listed caused the problem and take appropriate action.

select语句本身没有问题,错误原因是:在构造游标时数据个数不一致。比如,一个表TA有3个域A,B,C。我们构造查询语句为:SELECT A FROM TA WHERE B='12' AND C='12'。但是在构造游标时,使用了EXEC SQL FETCH table_cursor INTO :A,:B,:C;,而不是EXEC SQL FETCH table_cursor INTO :A;。这样变量数目就不一致,会导致错误。

 

实际的问题:在使用动态指针的时候,将资料指到对应的SQL  并且fetch into  相对应的 record 类型,但是此记录定义的变量与SQL指针的变量不一致导致的。

 

转自:http://www.cnblogs.com/toowang/archive/2012/04/19/2456803.html

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值