单位从Informix 换成oracle数据库   好多东西还不明白   
Create Or Replace Procedure exec_fill_idlecell(v_start_time Date)
Begin
Select * from perf_bsc where start_time=v_start_time
End
调用:
Call exec_fill_idlecell('2009-10-06 00:00:00')
Call exec_fill_idlecell('2009-10-06')
Call exec_fill_idlecell('')
 单位日期保存是  yyyy-mm-dd hh24:mi:ss  这样的 1A:在存储过程定义的时候  用date类型可以么?
2A: 调用的时候提示 “ora-06575 程序包或函数 exec_fill_idlecell 处于 无效状态
 本来很长的存储过程 我先改正这样 也不行。。 请大虾们指点  谢谢

解决方案 »

  1.   

    你的过程如果就像你上面写的那样,那么是不行的。首先语法就错了。你查查语法,过程体内有select时要有into
      

  2.   

    写select 必须有into? 
    那我delete from  也是提示 无效状态 。。请教~~
      

  3.   

    我修改后存储过程 帮忙看下     有问题不明白 谢谢CREATE OR REPLACE Procedure exec_fill_idlecell(start_time_Input Date)
    as
    Begindelete from perf_bsc where start_time=start_time_Input and  (idle_cell is null or (idle_cell=0 and
                              exceed_bcell=0 and worst_cell=0 and overflow_cell=0 and fatal_over_cell=0 and busy_cell= 0));
     
      
    execute Immediate 'Create Table IdlecellTmpTab As select * from perf_bsc where ne_id not in (select ne_id from perf_bsc where start_time=' ||start_time_input;
     
    End ; 有2个问题不明白,,第一:这个存储过程 我在调用的时候  要传参 一个日期型begin
    exec_fill_idlecell('2008-10-07 00:00:00')
    end
    这样传参 认为是一个字符串   应该怎么写?这样写会报错:
    begin
    exec exec_fill_idlecell('to_date('2008-10-07 00:00:00','yyyy-mm-dd hh24:mi:ss')')
    end
    第二:
    存储过程这句  execute Immediate   总是报错  请大侠帮忙改改 谢谢~~~
      

  4.   

    begin 
    exec exec_fill_idlecell(to_date('2008-10-07 00:00:00','yyyy-mm-dd hh24:mi:ss')) 
    end;execute Immediate 'Create Table IdlecellTmpTab As select * from perf_bsc where ne_id not in 
    (select ne_id from perf_bsc where start_time=' ||start_time_input||' )'; 
      

  5.   

    execute Immediate 'Create Table IdlecellTmpTab As select * from perf_bsc where ne_id not in 
    (select ne_id from perf_bsc where start_time=' ||start_time_input||' )';  这句 在执行的时候 好像只是执行了前半句 
    'Create Table IdlecellTmpTab As select * from perf_bsc where ne_id not in 
    (select ne_id from perf_bsc where start_time='
    然后报错 
      

  6.   

    select * from perf_bsc Where ne_id not in (select ne_id from perf_bsc where start_time=to_date('2008-10-07 00:00:00','yyyy-mm-dd hh24:mi:ss'))这句sql是否能够正常执行呢?单独跑如果可以,再把to_date('2008-10-07 00:00:00','yyyy-mm-dd hh24:mi:ss')替换成'||start_time_input||'