在日期获得时获得的格式既然是这样的 '02-2月 -10'
但在 seleect to_date('20100202','yyyy/mm/dd') from dual;中获得的是 2010/02/02这样的
怎么在过程中获得 2010/02/02这种格式那
在一个过程中执行如下
create or replace procedure sp_custcharstat
is
  v_custno varchar2(100);
  v_fundcode varchar2(100);
  v_date date;
  v_begindate date;
  v_enddate date;
  v_diffday number;
  v_lastshares  number(16,2);
  i  number;
  v_count number;
  type refcursor is ref cursor;
  v_cursor refcursor;
  v_time              varchar2(10); --当前时间
  tmp_table  varchar2(50);
  v_sql  varchar2(500);
  v_defaultTablespace varchar2(30) := 'crm_htable';--CRM计算默认表空间
begin
 v_time := to_char(sysdate,'hh24miss');  
 v_begindate :=to_date('20100202','yyyy/mm/dd');
 v_enddate :=to_date('20120202','yyyy/mm/dd');
 v_diffday :=v_enddate-v_begindate;
 tmp_table :='tpcrm_sharecurrent_'||v_time||'';
 select c_value into v_defaultTablespace from tsysparameter where c_item='crmHistoryTableSpace';
 --删除表
 
-- execute immediate 'truncate table '||tmp_table||'';
-- execute immediate 'drop table '||tmp_table||'';
 --创建临时表
 v_sql :='create table '||tmp_table||' tablespace '||v_defaultTablespace||' nologging as select d_cdate,  c_custno ,c_fundcode ,f_lastshares from tsharecurrents ';
 dbms_output.put_line(v_sql);
 execute immediate v_sql;
 v_sql := ' select c_custno,c_fundcode,f_lastshares from '||tmp_table||'';
 for  i in 0..v_diffday loop
   open v_cursor for v_sql;
    loop
      fetch v_cursor into v_custno,v_fundcode,v_lastshares;
          v_date := to_date('20100202','yyyy/mm/dd')+i;
                     dbms_output.put_line(v_date);
          exit when v_cursor%notfound; 
          v_sql :='select count(*)   from  '||tmp_table||' t where t.c_custno = '''||v_custno||''' and t.c_fundcode = '''||v_fundcode||''' and t.d_cdate=to_date('''||v_date||''',''yyyy/mm/dd'')';
          dbms_output.put_line(v_sql);
          execute immediate v_sql into v_count;
          if v_count = 0 then
              v_sql :='insert into '||tmp_table||' as select c_custno,c_fundcode,f_lastshares from '||tmp_table||' where t.c_custno = '''||v_custno||''' and t.c_fundcode = '''||v_fundcode||''' and t.d_cdate=(to_date('''||v_date||''',''yyyy/mm/dd'')-1)';
              dbms_output.put_line(v_sql);
              v_custno:=null;
              v_fundcode:=null;
              v_lastshares:=null;
             execute immediate v_sql;
             commit;
          end if;
     end loop;
 end loop;
end