type a_type is table of number;
a a_type := a_type();if((substr(queryname,0,4)= 'jglx') ) then
jglx1:=substr(queryname,6);select count(*) into countjglx from t_rcsibd t where c_value = jglx1 and c_code ='JGLX';
a.extend(countjglx);
i:=0;
while i<countjglx loop
select c_rcsiid into a[i] from t_rcsibd t where c_value = jglx1 and c_code ='JGLX';
open type_cursor1 for
select c_rcsiid ,
max(decode(C_CODE,'ZZJGDM' ,c_value,null)) ZZJGDM,
max(decode(C_CODE,'JGMC' ,c_value,null)) JGMC ,
max(decode(C_CODE,'JGLX' ,c_value,null)) JGlX
from t_rcsibd t where c_rcsiid = a[i] GROUP BY c_rcsiid;i:=i+1;
end loop;提示:select c_rcsiid into a[i] from t_rcsibd t where c_value = jglx1 and c_code ='JGLX';有错误。请问该如何让给数组赋值?
a a_type := a_type();if((substr(queryname,0,4)= 'jglx') ) then
jglx1:=substr(queryname,6);select count(*) into countjglx from t_rcsibd t where c_value = jglx1 and c_code ='JGLX';
a.extend(countjglx);
i:=0;
while i<countjglx loop
select c_rcsiid into a[i] from t_rcsibd t where c_value = jglx1 and c_code ='JGLX';
open type_cursor1 for
select c_rcsiid ,
max(decode(C_CODE,'ZZJGDM' ,c_value,null)) ZZJGDM,
max(decode(C_CODE,'JGMC' ,c_value,null)) JGMC ,
max(decode(C_CODE,'JGLX' ,c_value,null)) JGlX
from t_rcsibd t where c_rcsiid = a[i] GROUP BY c_rcsiid;i:=i+1;
end loop;提示:select c_rcsiid into a[i] from t_rcsibd t where c_value = jglx1 and c_code ='JGLX';有错误。请问该如何让给数组赋值?
解决方案 »
- 大侠们,帮我看看下面那个oracle结果集 如何筛选
- Oracle序列 和 SQL SERVER 自增列的问题
- linux下imp导入多个文件时出现syntax error near unexpected token '('
- (在线跪求)ORACLE如何将查询出的结果行转列
- how can i get ride of the dunplicate rows??
- 急求一个查询语句
- 如何使用powerdesigner导出文档??
- 请教v$sort_segment的作用
- 非常简单的问题,可不可以将函数直接写在sql 文件中,请问这样可行么?
- 请问能否用代码生成ORACLE的连接串,怎样生成.谢谢!!
- 满足两条件,两条记录,查询相同的id
- oracle日期函数
a a_type := a_type();if((substr(queryname,0,4)= 'jglx') ) then
jglx1:=substr(queryname,6);select count(*) into countjglx from t_rcsibd t where c_value = jglx1 and c_code ='JGLX';
a.extend(countjglx);
i:=1; --嵌套表下标从1开始
while i<countjglx loop
select c_rcsiid into a(i) from t_rcsibd t where c_value = jglx1 and c_code ='JGLX'; --使用小括号引用下标
open type_cursor1 for
select c_rcsiid ,
max(decode(C_CODE,'ZZJGDM' ,c_value,null)) ZZJGDM,
max(decode(C_CODE,'JGMC' ,c_value,null)) JGMC ,
max(decode(C_CODE,'JGLX' ,c_value,null)) JGlX
from t_rcsibd t where c_rcsiid = a(i) GROUP BY c_rcsiid;--使用小括号引用下标i:=i+1;
end loop;
select c_rcsiid into a(i) from t_rcsibd t where c_value = jglx1 and c_code ='JGLX';
实际返回的行数超出请求的行数。为什么?我得值是赋给数组的
select c_rcsiid into a from t_rcsibd t where ....然后通过循环再引用a(i)
select c_rcsiid into a from t_rcsibd t where ....然后通过循环再引用a(i)
这样好像不行,
Error: PLS-00642: 在 SQL 语句中不允许使用本地收集类型
Line: 41
Text: select c_rcsiid into a from t_rcsibd t where c_value = jglx1 and c_code ='JGLX';
精通Oracle 10g PL/SQL编程(http://download.csdn.net/source/552111)
select c_rcsiid ,
max(decode(C_CODE,'ZZJGDM' ,c_value,null)) ZZJGDM,
max(decode(C_CODE,'JGMC' ,c_value,null)) JGMC ,
max(decode(C_CODE,'JGLX' ,c_value,null)) JGlX
from t_rcsibd t where c_rcsiid = i
GROUP BY c_rcsiid;end loop;这样为什么只能得到 c_rcsiid = 100的值呢?应该怎么写?