2017-10-13 48 views
0

我在Oracle數據庫12c企業版版本12.1.0.2.0-64位生產數據庫中有此過程,每當我嘗試重新編譯它。該程序是一個副本,並從另一個DB粘貼,所以現在有錯誤的,因爲在其他數據庫包正常工作......不過,我得到這個錯誤:錯誤(3,34):PLS-00201:標識符XXX必須聲明

Error(1,35): PLS-00304: cannot compile body of 'P_COUNTRY_PLATS' without its specification 

create or replace PACKAGE "P_COUNTRY_PLATS" is 

procedure createNew (p_msisdn IN lopes.country_plats.recipient_msisdn%TYPE 
        ,p_channel IN lopes.country_plats.channel%TYPE 
        ,p_message IN lopes.country_plats.message%TYPE 
        ); 
procedure createNew (p_msisdn IN lopes.country_plats.recipient_msisdn%TYPE 
        ,p_channel IN lopes.country_plats.channel%TYPE 
        ,p_message IN lopes.country_plats.message%TYPE 
        ,p_request_date IN lopes.country_plats.request_date%TYPE 
        ,p_action_history_id IN lopes.country_plats.action_history_id%TYPE 
        ); 
procedure createNew (p_msisdn IN lopes.country_plats.recipient_msisdn%TYPE 
        ,p_channel IN lopes.country_plats.channel%TYPE 
        ,p_message IN lopes.country_plats.message%TYPE 
        ,p_request_date IN lopes.country_plats.request_date%TYPE 
        ,p_action_history_id IN lopes.country_plats.action_history_id%TYPE 
        ,p_ac_scheduled_action_id IN lopes.country_plats.ac_scheduled_action_id%TYPE 
        ); 

procedure getNextMsgToSend (p_channel IN lopes.country_plats.channel%TYPE 
          ,p_ip_address IN OUT VARCHAR2 
          ,p_message IN OUT lopes.country_plats.message%TYPE 
          ,p_msg_id IN OUT lopes.country_plats.country_plats_id%TYPE 
          ); 
procedure getNextMsgToSendByImei(p_imei IN VARCHAR2, p_message IN OUT VARCHAR2, p_msg_id IN OUT NUMBER); 

procedure setStatus(p_msg_id IN NUMBER, p_status IN VARCHAR2); 

procedure cancel_scheduled_actions; 
procedure cancel_scheduled_actions(p_msg_id IN number); 
end; 
/

create or replace PACKAGE BODY "P_COUNTRY_PLATS" is 
procedure createNew (p_msisdn IN lopes.country_plats.recipient_msisdn%TYPE 
        ,p_channel IN lopes.country_plats.channel%TYPE 
        ,p_message IN lopes.country_plats.message%TYPE 
        ) 
is 
begin 
    createNew(p_msisdn, p_channel, p_message, sysdate, null, null); 
end; 

procedure createNew (p_msisdn IN lopes.country_plats.recipient_msisdn%TYPE 
        ,p_channel IN lopes.country_plats.channel%TYPE 
        ,p_message IN lopes.country_plats.message%TYPE 
        ,p_request_date IN lopes.country_plats.request_date%TYPE 
        ,p_action_history_id IN lopes.country_plats.action_history_id%TYPE 
        ) 
is 
begin 
    createNew(p_msisdn, p_channel, p_message, p_request_date, p_action_history_id, null); 
end; 

procedure createNew (p_msisdn IN lopes.country_plats.recipient_msisdn%TYPE 
        ,p_channel IN lopes.country_plats.channel%TYPE 
        ,p_message IN lopes.country_plats.message%TYPE 
        ,p_request_date IN lopes.country_plats.request_date%TYPE 
        ,p_action_history_id IN lopes.country_plats.action_history_id%TYPE , 
        p_ac_scheduled_action_id IN lopes.country_plats.ac_scheduled_action_id%TYPE 
) 
is 
    PsdRetryNbroutgoing_psd number; 
begin 
    PsdRetryNbr := of_owner.p_ru.getPsdRetryNbr(p_msisdn); 

    of_owner.p_db_trc.trc(1007, '-'||p_channel||'-'||p_msisdn||'-'||p_message||'-'||p_request_date||'-'||p_action_history_id||'-'||p_ac_scheduled_action_id||'-'||PsdRetryNbr); 

    insert into lopes.country_plats 
    (country_plats_id,channel,recipient_msisdn,message,request_date,status,action_history_id, ac_scheduled_action_id, remaining_retry_nbr) values (
    lopes.SEQ_COUNTRY_PLATS_ID.nextval 
    ,p_channel 
    ,p_msisdn 
    ,p_message 
    , p_request_date 
    ,'R' 
    ,p_action_history_id 
    ,p_ac_scheduled_action_id 
    ,PsdRetryNbr 
); 
end;      

procedure getNextMsgToSend(p_channel IN lopes.country_plats.channel%TYPE 
          ,p_ip_address IN OUT VARCHAR2 
          ,p_message IN OUT lopes.country_plats.message%TYPE 
          ,p_msg_id IN OUT lopes.country_plats.country_plats_id%TYPE 
          ) 

is 
begin 
    select op.country_plats_id, op.message, of_owner.p_ru.getRemoteUnitCurrentIP(recipient_msisdn) 
    into p_msg_id, p_message, p_ip_address 
    from lopes.country_plats op 
    where ((op.status ='R') 
     or ((op.status = 'P') 
     and (op.outgoing_date+(of_owner.p_ru.getPsdRetryDelay(op.recipient_msisdn)/(60*24)) <= sysdate) 
     ) 
     ) 
    and rownum=1 
    order by request_date asc; 

    update lopes.country_plats 
    set outgoing_date = sysdate 
    , status = decode(remaining_retry_nbr, 0, 'F', 'P') 
    , remaining_retry_nbr = remaining_retry_nbr-1 
    where country_plats_id = p_msg_id; 

exception when no_data_found then 
    p_msg_id := -1; 
    p_ip_address:= ''; 
    p_message := ''; 
end; 

procedure getNextMsgToSendByImei(p_imei IN VARCHAR2, 
          p_message IN OUT VARCHAR2, 
          p_msg_id IN OUT NUMBER 
          ) is 
    p_vehicle_id number(10); 
    p_msisdn varchar2(50); 
begin 

    p_msg_id := -1; 
    p_message := ''; 

    select msisdn, vehicle_id 
    into p_msisdn, p_vehicle_id 
    from of_owner.remote_unit, of_owner.vehicle 
    where remote_unit.imei = p_imei 
    and remote_unit.remote_unit_id = vehicle.remote_unit_id(+); 

    begin 
    select op.country_plats_id, op.message 
    into p_msg_id, p_message 
    from lopes.country_plats op 
    where ((op.status ='R') 
     or ((op.status = 'P') 
      and (op.outgoing_date+(of_owner.p_ru.getPsdRetryDelay(op.recipient_msisdn)/(60*24)) <= sysdate) 
      ) 
     ) 
    and op.recipient_msisdn = p_msisdn 
    and rownum=1 
    order by request_date asc; 

    update lopes.country_plats 
    set outgoing_date = sysdate 
     , status = decode(remaining_retry_nbr, 0, 'F', 'P') 
     , remaining_retry_nbr = remaining_retry_nbr-1 
    where country_plats_id = p_msg_id; 
    exception when others then 
    null; 
    end; 
    -- Check if garmin message to send 
    if (p_msg_id=-1) and (p_vehicle_id is not null) then 
    p_msg_id := of_owner.p_gu_message.getNextMessageToSend(p_vehicle_id, p_message); 
    if (p_msg_id is null) then 
     p_msg_id:=-1; 
    end if; 
    end if; 

exception when no_data_found then 
    p_msg_id := -1; 
    p_message := ''; 
end; 

procedure setStatus(p_msg_id IN NUMBER, p_status IN VARCHAR2) 
is 
begin 

    update lopes.country_plats 
    set status = decode(p_status, 'S', 'S', decode(remaining_retry_nbr, 0, 'F', 'P')) 
    where country_plats_id = p_msg_id;  

end; 

procedure cancel_scheduled_actions is 
begin 
    delete from lopes.country_plats 
    where status = 'R' 
    and ac_scheduled_action_id is not null; 
end; 

procedure cancel_scheduled_actions(p_msg_id IN number) is 
begin 
    delete from lopes.country_plats 
    where country_plats_id = p_msg_id; 
end; 

end P_COUNTRY_PLATS; 
/
+0

將一個'/ 'END'語句後的新行中的字符終止包規範。然後在包體的結尾處將其改爲'結束PLATS;'並將另一個'/'放在以下換行符上。 – MT0

+1

HUH?標題:**錯誤(3,34):PLS-00201:必須聲明標識符XXX **在消息體中:**錯誤(1,35):PLS-00304:如果沒有其規範,則無法編譯「P_COUNTRY_PLATS」的主體**。不同的錯誤代碼(201 vs 304),不同的錯誤信息 - 顯然這兩個錯誤在性質上是彼此不同的,代碼中的不同位置(第3行,第34位與第1行,第35位)不同。所以:這是什麼?這是怎麼發生的? (「This」是你發佈關於一個錯誤的消息,如正文中所述,並給出標題完全不同的錯誤。) – mathguy

+0

@ Lopes - 那麼我們應該解決哪一個問題?PL-00201還是PLS-00304? – g00dy

回答

1

/字符是PL/SQL塊的終止符,並且腳本缺少它們。

變化:

end; 


create or replace PACKAGE BODY      "P_COUNTRY_PLATS" is 

要:

end; 
/

create or replace PACKAGE BODY      "P_COUNTRY_PLATS" is 

,並改變最終:

end;PLATS 

到:

end P_COUNTRY_PLATS; 
/
+0

你有沒有注意到這個傢伙的頭銜和消息體中的內容不匹配? – mathguy