我在SQLPLUS里面直接运行select a1,a2,a3,a4,a5,a6,a7,a8,a9 from (select t.*,rownum rn from table where a0=:a0and rownum<=to_number(:lastrow) ) where rn>=to_number(:firstrow);是正常的啊
我在SQLPLUS里面直接运行select a1,a2,a3,a4,a5,a6,a7,a8,a9 from (select t.*,rownum rn from table where a0=:a0and rownum<=to_number(:lastrow) ) where rn>=to_number(:firstrow);是正常的啊 t.*这不报错?你的table名字是t?
我在SQLPLUS里面直接运行select a1,a2,a3,a4,a5,a6,a7,a8,a9 from (select t.*,rownum rn from table where a0=:a0and rownum<=to_number(:lastrow) ) where rn>=to_number(:firstrow);是正常的啊 t.*这不报错?你的table名字是t?这里笔误: declare a_cur cursor for select a1,a2,a3,a4,a5,a6,a7,a8,a9 from (select t.*,rownum rn from table t where a0=:a0and rownum<=to_number(:lastrow) ) where rn>=to_number(:firstrow);
原始代码差不多就是这样啊,上面是变量声明,然后获取传入的变量值a0、firstrow和lastrow,然后就是这里了,声明游标,然后fetch,fetch就报错了 你的变量类型是不是不一致啊 数据库字段都是varchar2,程序变量都是char 还是你个数不匹配造成的,好好检查一下。以下是官方解释 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.
我在SQLPLUS里面直接运行select a1,a2,a3,a4,a5,a6,a7,a8,a9 from (select t.*,rownum rn from table where a0=:a0and rownum<=to_number(:lastrow) ) where rn>=to_number(:firstrow);是正常的啊
我在SQLPLUS里面直接运行select a1,a2,a3,a4,a5,a6,a7,a8,a9 from (select t.*,rownum rn from table where a0=:a0and rownum<=to_number(:lastrow) ) where rn>=to_number(:firstrow);是正常的啊
t.*这不报错?你的table名字是t?
我在SQLPLUS里面直接运行select a1,a2,a3,a4,a5,a6,a7,a8,a9 from (select t.*,rownum rn from table where a0=:a0and rownum<=to_number(:lastrow) ) where rn>=to_number(:firstrow);是正常的啊
t.*这不报错?你的table名字是t?这里笔误:
declare a_cur cursor for select a1,a2,a3,a4,a5,a6,a7,a8,a9 from (select t.*,rownum rn from table t where a0=:a0and rownum<=to_number(:lastrow) ) where rn>=to_number(:firstrow);
你的变量类型是不是不一致啊
弱弱的问一句,你不会没有open cursor吧
弱弱的问一句,你不会没有open cursor吧
怎么可能啊!我把这个代码放到存储过程里面运行,都很正常。可是就是在PC程序里面运行,就马上报1007的错误了,你说诡异不诡异啊!
你的变量类型是不是不一致啊
数据库字段都是varchar2,程序变量都是char
你的变量类型是不是不一致啊
数据库字段都是varchar2,程序变量都是char
还是你个数不匹配造成的,好好检查一下。以下是官方解释
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.