解决方案 »
- java程序远程连接oracle数据库
- 关于odi的问题
- 单独执行存储过程70秒,通过java调用此存储过程执行需要400秒,问题会在哪里
- 请问下这句exp导出语句什么意思?
- 求教一个odbc连接oracle数据库的问题。
- 请教,一个oracle存储过程的问题?谢谢大家指导
- 菜鸟级提问有关job的,为什么这段代码编译不了[代码很简单请高人们抬眼看看,拜托了]
- ORACLE里 CASE DECODE 的问题相关。在线等待
- SYS在图形化的管理工具中无法以SYSDBA登录,为什么?
- [求助]请大神帮忙看下dbms_metadata输出的ddl问题
- 急请各位帮我看一下这个UPDATE更新语句有什么问题
- sequence cache对于性能影响大么?
where ( mbrid='1000' and dos >= dos1 and dos <= dos30);
单引号都去掉,已经是date类型的了
不行吧 我这个是在动态游标中 我 for后面还有一对单引号呢? open fi_cur1 for ' select distinct mbrid from fi06
where ( mbrid=''1000'' and dos >= '||dos1||' and dos <= '||dos30||')';
dos 是 date 的
动态游标一般是表名、字段名是变量才需要用到。值是变量的话用不着的。
create or replace procedure test_p is
type tcur is ref cursor;
fi_cur1 tcur;
dos1 date;
dos30 date;
name varchar2(20);
begin
dos1 := to_date('2006-01-01','yyyy-mm-dd');
dos30 := to_date('2006-11-01','yyyy-mm-dd');
name := 'fi06';
open fi_cur1 for ' select distinct mbrid from '||name||'
where ( mbrid=''1000'' and dos >= '||dos1||' and dos <= '||dos30||')';
end test_p;
这样啊,那你的to_date得写到sql中去,把你的'2009-01-01'作为参数
||连接得是字符串。
create or replace procedure test_p is
type tcur is ref cursor;
fi_cur1 tcur;
dos1 varchar2(20);
dos30 varchar2(20);
name varchar2(20);
begin
dos1 := '2006-01-01';
dos30 := '2006-11-01';
name := 'fi06';
open fi_cur1 for ' select distinct mbrid from '||name||'
where ( mbrid=''1000'' and dos >= '||to_date(dos1,'yyyy-mm-dd')||' and dos <= '||to_date(dos30,'yyyy-mm-dd')||')';
end test_p;但是还是是不可以的还是报 缺失右括号
where ( mbrid=''1000'' and dos >= to_date('''||dos1||''',''yyyy-mm-dd'') and dos <= to_date('''||dos30||''',''yyyy-mm-dd''))';dos1,dos30是字符串。
is
type tcur is ref cursor;
fi_cur1 tcur;
dos1 date;
dos30 date;begindos1 := to_date('2006-01-01','yyyy-mm-dd');
dos30 := to_date('2006-11-01','yyyy-mm-dd');
open fi_cur1 for ' select distinct mbrid from fi06 where ( mbrid='||chr(39)||'1000'||chr(39)|| 'and dos >= '||dos1||' and dos <= '||dos30||')';end test_p;
转成和dos1,dos30一样的格式。