日期:2014-05-17  浏览次数:20687 次

存储过程错误 在线等....
SQL code

create or replace procedure sp_OCN_Alarm(import_Date in date,v_t_step1 in varchar2(50))
as
    v_sql varchar2(4000);
begin
    /*v_t_step1:='V_STEP1';
    import_Date:=to_date('2012-04-01','yyyy-mm-dd');*/
    /************************************************************/
    /**获取 temp_t_customer 表数据                             **/
    /************************************************************/
    v_sql:='
    insert into temp_t_customer(INSERT_MONTH,Userid,customerid,cust_name,address_detail,telephone1,telephone2,custdistrictid)
    select 
        '||to_char(import_Date,'yyyymm')||' as INSERT_MONTH,
        '||to_char(import_Date,'yyyymm')||'||a.CustomerID,
        a.CustomerID ,
        a.name ,
        a.custdetailaddress,
        a.telephone as TELEPHONE1,
        a.telephonemobile as TELEPHONE2,
        a.custdistrictid
    from boss2.t_customer'||to_char(import_Date,'yyyymm')||'  a';
    execute immediate v_sql;  
end sp_OCN_Alarm;

ORA-06550: line 5, column 9:
PLS-00905: object OCN.SP_OCN_ALARM is invalid
ORA-06550: line 5, column 9:
PL/SQL: Statement ignored

    



------解决方案--------------------
create or replace procedure sp_OCN_Alarm(import_Date in date,v_t_step1 in varchar2(50))
这句话中,v_t_step1 in varchar2(50)错了。

in 关键字后面只能跟数据类型,不能指定长度

------解决方案--------------------
SQL code

create or replace procedure sp_OCN_Alarm(import_Date in date,v_t_step1 in varchar2(50))
/*应该使用*/
create or replace procedure sp_OCN_Alarm(import_Date in date,v_t_step1 in varchar2)

------解决方案--------------------
v_t_step1 in varchar2(50)参数定义错了,定义参数不需要定义长度大小