并发程序报错: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
本文解析了ORA-01007错误的原因及解决方案,指出当使用动态指针时,若记录中定义的变量与SQL指针变量不一致,则会触发此错误。并提供了具体的检查和修正步骤。
&spm=1001.2101.3001.5002&articleId=82516813&d=1&t=3&u=67ed563c0f804868bdba1efb7be0baf5)
2849

被折叠的 条评论
为什么被折叠?



