oracle儲存過程procedure_輸入引數varchar2與char報錯

wisdomone1發表於2012-12-14
create or replace procedure proc_bulk_table(x  char(1))
as
  v_number pls_integer;
  v_cnt pls_integer;
  v_begin pls_integer;
  v_receive char(1);
  begin
    v_receive:=x;
    v_number:=3;
     for i in 1..v_number loop
       v_begin:=i-1;
       select count(t.tname) into v_cnt from tab t where tname='T_BULK_TABLE'; --;||to_char(to_date(in_start_date,'yyyymmdd')+v_begin,'yyyymmdd');
       if v_cnt=0 then
         execute immediate 'create table t_bulk_table'||to_char(i)||'(a int,b int)';
         execute immediate 'create index idx_t_bulk_table_'||to_char(i)||' on t_bulk_table'||to_char(i)||'(a)';
       end if;
    end loop;
   end;
 
小結:1,如果儲存過程輸入引數是char或varchar2,如在儲存過程使用,就會報錯
         2,換成其它型別如:date,timestamp,int,pls_integer,則一切正常
        3,這是什麼原因

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9240380/viewspace-751089/,如需轉載,請註明出處,否則將追究法律責任。

相關文章