sSQL="create global temporary table t_tempAM as 要写成sSQL :='create global temporary table t_tempAM as ...而SQL中的', 要用''来表示.
解决方案 »
- oracle 10g client 不能與 oracle 7 client 兼容
- 求一在Oracle中关于日期比较的语句。
- default的问题
- 我从wwww.oracle.com下的Oracle 10g Release 2 (10.2.0.1.0) Enterprise/Standard Edition for Win32 有限制吗?
- pl/sql的问题
- ORACLE的存储过程
- oracle数据库中的表因事务处理挂起无法查看,如何处理?
- 如何使在PL/SQL中能够按住ctrl后按往右的键时一跳一个单词啊??
- 为何在Enterprise Manager里看不到我的数据库?
- 如果实现通过两个个表的三个字段的值返回相应的常量?如果:A.a1 Not NULL AND B.b1 NOT NULL返回 '0',A.a1 NOT null and B.b1 is NU
- 急!!!向高手请教 oracle 启不起来了,如何恢复(保给100分)
- 8.1.7安装到linux上,linux要选择哪种安装:专业版,服务器版等???
单引号 '' -> ; '''' -> ' ; ''' -> error ;
双引号 "" -> ; "'" -> ' ; "''" -> '' ; """ -> error
2、还有一点值得提出,创建临语法不正确。
3、返回记录集不这样。用动态游标返回吧。declare
sSQL varchar2(200);
type t_sor is ref cursor;
v_sor t_sor;
beginsSQL='create global temporary table t_tempAM ON COMMIT PRESERVE(DELETE) ROWS as
select decode(substr(batchno,1,1),''0'',''2000'',''1'',''2001'',''2'',''2002'',''3'',''2003'',
''4'',''2004'',''5'',''2005'',''6'',''1996'',''7'',''1997'',''8'',''1998'',''9'',''1999'') yeildmonth,
componentsid,to_char(maintaindate,''yyyymm'') maintainmonth from t_components_analysis
where comyielddate is null and maintaindate is not null
and substr(batchno,1,1) in (''1'',''2'',''3'',''4'',''5'',''6'',''7'',''8'',''9'',''0'')';execute immediate sSQL;
open v_sor for select * from t_tempAM where rownum<=200;
fetch v_sor into 变量1,变量2,变量3;
loop
exit when v_sor%notfound;
dbms_out.put_line(变量1||' '||变量2||' '||变量3);
fetch v_sor into 变量1,变量2,变量3;
end loop;
end;
/
谢谢 Lastdrop(空杯) 一直对我的问题很关照。
谢谢大家了,结贴!
临时表名t_tempAM没声明,不认,该如何解决?SQL plus中具体如下:
open v_cur for select * from t_tempAM;
*
ERROR 位于第 18 行:
ORA-06550: 第 18 行, 第 30 列:
PLS-00201: 必须说明标识符 'T_TEMPAM'
ORA-06550: 第 18 行, 第 16 列:
PL/SQL: SQL Statement ignored