在另一个过程中调用sql过程

时间:2018-02-28 09:27:10

标签: sql oracle stored-procedures procedures

我想在满足某些条件时调用另一个过程中的过程。在另一个程序中调用该过程时,我遇到了问题。

请帮我解决此问题。

---第一道程序----

create or replace 
PROCEDURE first_procedure(

PERIDTYPE   IN VARCHAR2,
CITIZENID IN NUMBER,
NIFNUMBER OUT NUMBER,
PERIDNUMBER1 OUT NUMBER,
NUBINUMBER OUT NUMBER ,
REGFORMID OUT NUMBER ,
BOSTATUSCODE OUT VARCHAR2 ,
PERID OUT NUMBER )
AS
BEGIN
SELECT cm_nu_bi
INTO NUBINUMBER
FROM cm_minjus_agt_vw
WHERE cm_id_citizen_stage_sigt = CITIZENID;
select per_id
into PERID
from ci_per_id
 WHERE id_type_cd = PERIDTYPE
 AND per_id_nbr  = NUBINUMBER;
 SELECT reg_form_id,
per_id_nbr,
bo_status_cd
INTO REGFORMID,
NIFNUMBER,
BOSTATUSCODE
FROM table_x
 WHERE per_id= PERID;

 if NIFNUMBER is not null then
INSERT
INTO table_y
  (
  id_cidadao_stage_sigt,
  NU_NIF
   )
  VALUES
    (
    PERIDNUMBER,
    NIFNUMBER
         );
   else
     EXCE := CM_ERROR_TABLE_ENTRY @CITIZENID=CITIZENID, @REGID=REGFORMID;
    end if;
   END CM_GET_NIF_NBR;

---第二程序---

                         create or replace 
               PROCEDURE second_procedure
               (
               CITIZENID IN NUMBER
                , REGID IN NUMBER  
               , EXCEPTIONCATEGORYCD IN OUT VARCHAR2  
               , MESSAGECATEGORYNUMBER IN OUT NUMBER  
               , MESSAGENUMBER IN OUT NUMBER 
               , MESSAGETEXT IN OUT VARCHAR2
               ) AS 
               BEGIN
               select  
               message_cat_nbr, 
               message_nbr, 
               excp_cat_cd
               into 
               MESSAGECATEGORYNUMBER,
               MESSAGENUMBER,
               EXCEPTIONCATEGORYCD
               from ci_reg_form_excp where 
               reg_form_id= REGID;
               SELECT 
               message_text
               into 
               MESSAGETEXT
               FROM ci_msg_l
               WHERE message_cat_nbr=MESSAGECATEGORYNUMBER
               AND message_nbr=MESSAGENUMBER
               AND language_cd='PTG';
               insert INTO tb_sigt_processing_log@MINJUS_AGT_DBLINK
               (ID_CIDADAO_STAGE_SIGT,exception_cat_code, message_category, message_number, message_text)
               values
               (CITIZENID,EXCEPTIONCATEGORYCD,MESSAGECATEGORYNUMBER,MESSAGENUMBER,MESSAGETEXT);




                 NULL;
               END CM_ERROR_TABLE_ENTRY ;

我得到的问题是。请告诉我是否需要更多输入。

enter image description here

1 个答案:

答案 0 :(得分:1)

我认为你想在这一行中使用参数调用该过程

EXCE := CM_ERROR_TABLE_ENTRY @CITIZENID=CITIZENID, @REGID=REGFORMID;

在Oracle中无效。您可以使用

调用您的程序
CM_ERROR_TABLE_ENTRY( CITIZENID,REGFORMID );