WorkerName in Varchar2, --参数
Starttime in Varchar2,
Endtime in Varchar2, strSql:='';
strSql:=strSql || 'insert into tempStat ' || chr(10);
strSql:=strSql || 'select recvid,id,case when c.inputonetime is not null then 1 else 0 end input1,' || chr(10);
strSql:=strSql || 'case when c.inputtwotime is not null then 1 else 0 end input2,' || chr(10);
strSql:=strSql || 'case when c.xiaoduitime is not null then 1 else 0 end xiao,' || chr(10);
strSql:=strSql || 'case when c.relationtime is not null then 1 else 0 end relat' || chr(10);
strSql:=strSql || 'from viewYeWu c ' || chr(10);
strSql:=strSql || 'where ' || chr(10);
strSql:=strSql || '(c.inputoneren=:1 and c.inputonetime>=to_date(:2,''yyyy-mm-dd hh24:mi:ss'') ' || chr(10);
strSql:=strSql || ' and c.inputonetime<=to_date(:3,''yyyy-mm-dd hh24:mi:ss''))' || chr(10);
strSql:=strSql || ' or (c.inputtworen=:1 and c.inputtwotime>=to_date(:2,''yyyy-mm-dd hh24:mi:ss'')' || chr(10);
strSql:=strSql || ' and c.inputtwotime<=to_date(:3,''yyyy-mm-dd hh24:mi:ss''))' || chr(10);
strSql:=strSql || ' or (c.xiaoduiren=:1 and c.xiaoduitime>=to_date(:2,''yyyy-mm-dd hh24:mi:ss'')' || chr(10);
strSql:=strSql || ' and c.xiaoduitime<=to_date(:3,''yyyy-mm-dd hh24:mi:ss''))' || chr(10);
strSql:=strSql || ' or (c.guanlianren=:1 and c.relationtime>=to_date(:2,''yyyy-mm-dd hh24:mi:ss'')' || chr(10);
strSql:=strSql || ' and c.relationtime<=to_date(:3,''yyyy-mm-dd hh24:mi:ss''))' || '';-- open myCur for strSql;
execute immediate strSql using Workername,Starttime,Endtime;执行后提示:
ORA-01008: 并非所有变量都已关联
Starttime in Varchar2,
Endtime in Varchar2, strSql:='';
strSql:=strSql || 'insert into tempStat ' || chr(10);
strSql:=strSql || 'select recvid,id,case when c.inputonetime is not null then 1 else 0 end input1,' || chr(10);
strSql:=strSql || 'case when c.inputtwotime is not null then 1 else 0 end input2,' || chr(10);
strSql:=strSql || 'case when c.xiaoduitime is not null then 1 else 0 end xiao,' || chr(10);
strSql:=strSql || 'case when c.relationtime is not null then 1 else 0 end relat' || chr(10);
strSql:=strSql || 'from viewYeWu c ' || chr(10);
strSql:=strSql || 'where ' || chr(10);
strSql:=strSql || '(c.inputoneren=:1 and c.inputonetime>=to_date(:2,''yyyy-mm-dd hh24:mi:ss'') ' || chr(10);
strSql:=strSql || ' and c.inputonetime<=to_date(:3,''yyyy-mm-dd hh24:mi:ss''))' || chr(10);
strSql:=strSql || ' or (c.inputtworen=:1 and c.inputtwotime>=to_date(:2,''yyyy-mm-dd hh24:mi:ss'')' || chr(10);
strSql:=strSql || ' and c.inputtwotime<=to_date(:3,''yyyy-mm-dd hh24:mi:ss''))' || chr(10);
strSql:=strSql || ' or (c.xiaoduiren=:1 and c.xiaoduitime>=to_date(:2,''yyyy-mm-dd hh24:mi:ss'')' || chr(10);
strSql:=strSql || ' and c.xiaoduitime<=to_date(:3,''yyyy-mm-dd hh24:mi:ss''))' || chr(10);
strSql:=strSql || ' or (c.guanlianren=:1 and c.relationtime>=to_date(:2,''yyyy-mm-dd hh24:mi:ss'')' || chr(10);
strSql:=strSql || ' and c.relationtime<=to_date(:3,''yyyy-mm-dd hh24:mi:ss''))' || '';-- open myCur for strSql;
execute immediate strSql using Workername,Starttime,Endtime;执行后提示:
ORA-01008: 并非所有变量都已关联
解决方案 »
- 求:在同一张表中根据name相同,把后面的text字段全部串成一个文件的SQL
- 怎样改小数据表的初始值大小
- 怎么在 win xp 环境下设置 sql*plus 的 SQLPATH 这个环境变量,怎么我的设置总是不起效?
- ORA-00600: 内部错误代码,参数: [qks3tInit], [], [], [], [], [], [], []
- 招聘软件开发,软件测试--应届毕业生
- IP地址问题
- 关于jsp连接Oracle数据库的问题,请指教:
- 表中数据存放顺序和提取问题???
- 8i里列出所有的表,怎么写?
- java.lang.ClassCastException: org.apache.xerces.parsers.XML11Configuration c
- sql问题请教distinct!
- 关于两个多对多的联合查询问题,请教达人~ (修正帖子以及贴出解决方案)
嗯,说的不错,是变量问题啊!恭喜楼主自己搞定问题了!自己动手,丰衣足食啊!