说白了,就是如何传表名、字段名到游标里面的SELECT语句中
解决方案 »
- 求一SQL语句
- 怎么向中间表里插入数据
- 如果只有表空间能恢复库吗?
- 在安装oracle10g的时候总是出现EnterpriseManager配置失败的错误
- 数据库TURNING的,老难题,高手请进
- 小弟想考OCP, 请问广州哪里有专业的OCP培训,请了解情况的朋友告知,谢谢
- ORACLE9I导出数据时当导出数据文件到4G就停止导出了,请问是何原因?
- oracle9i在windows2000server中不能启动OracleOraHome92ManagementSever,十万火急!!!
- 多个存储函数转成一个package
- 复杂SQL大讨论,怎样写效率最高。
- 在ORACLE中怎样计算其需求量。如生产A需要零件X、Y、Z、L、M、N各是几个!
- date类型的数据,如何用sqlldr导入?
open cursor for strsql;
execute immediate strSql....
请教 我用你的方法,出现以下结果:
ERROR 位于第 20 行:
ORA-06550: 第 20 行, 第 5 列:
PLS-00360: 无主体的游标说明需要返回类型
ORA-06550: 第 20 行, 第 5 列:
PL/SQL: Item ignored
ORA-06550: 第 26 行, 第 11 列:
PLS-00320: 此表达式的类型说明不完整或格式错误
ORA-06550: 第 26 行, 第 6 列:
PL/SQL: Statement ignored
ORA-06550: 第 27 行, 第 15 列:
PLS-00320: 此表达式的类型说明不完整或格式错误
ORA-06550: 第 27 行, 第 9 列:
PL/SQL: SQL Statement ignored
ORA-06550: 第 28 行, 第 10 列:
PLS-00320: 此表达式的类型说明不完整或格式错误
ORA-06550: 第 28 行, 第 4 列:
PL/SQL: Statement ignored
ORA-06550: 第 38 行, 第 12 列:
PLS-00320: 此表达式的类型说明不完整或格式错误
ORA-06550: 第 38 行, 第 6 列:
PL/SQL: SQL Statement ignored1 declare
2 strdbcursor1 varchar2(50);
3 strTemp varchar2(5000);
4 recNum number(15);
5 cursor dbcursor1 is select 表编码 from testmis.zbm_dict,testmis.zfl_dict
6 where 保密级别>1 and testmis.zbm_dict.分类编码=testmis.zfl_dict.分类编码
7 and testmis.zfl_dict.数据库编码='FXHY';
8 begin
9 recNum:=0;
10 /* delete testmis.temp;*/
11 delete testmis.索引信息表;
12 open dbcursor1;
13 fetch dbcursor1 into strdbcursor1;
14 while dbcursor1%found
15 loop /* 读取表字段 */
16 declare
17 strdbcursor2 varchar2(50);
18 strsql varchar2(500);
19 strn varchar2(100);
20 cursor dbcursor2;
21 /* cursor dbcursor2 is ; */
22 begin
23 strTemp:='';
24 strn:='user_col_comments';
25 strsql:='select COLUMN_NAME from '||strn;
26 open dbcursor2 for strsql;
27 fetch dbcursor2 into strdbcursor2;
28 while dbcursor2%found loop
29
30 if strTemp is null then
31 strTemp:='cursor dbcursor3 is select '||strdbcursor2;
32 else
33 strTemp:=strTemp||','||strdbcursor2;
34 end if;
35 strTemp:=strTemp||'from '||strdbcursor1;
36 fetch dbcursor2 into strdbcursor2;
37 end loop;
38 close dbcursor2;
39 end;
40
41 fetch dbcursor1 into strdbcursor1;
42 end loop;
43 close dbcursor1;
44 end;