0

在此 Oracle 过程中,需要删除最后一条语句“AND TR.VALUE > 49)”。当我对此发表评论时,我在这里收到错误:AND (ARCH >= 0

错误缺少右括号。因为我们取出了最后一个语句,那么我应该在哪里做这个缺失的括号?

CREATE OR REPLACE PROCEDURE HPTC.THS_GET_CNA_PE_DET (
  FACILITYKEY VARCHAR2,
  STARTDATE DATE,
  ENDDATE DATE,
  MENUID NUMBER,
  MENUIDVALUE NUMBER,
  MINVALUE NUMBER,
  MAXVALUE NUMBER,
  SHIFTFACILITY VARCHAR2,
  THEUNIT VARCHAR2,
  THESHIFT NUMBER,
  OCURSOR OUT SYS_REFCURSOR
  )
AS
  ARCH NUMBER(1) := 0;
  SPLITDATE DATE;
BEGIN
  BEGIN
    SELECT NVL(SPLIT_DATE, TO_DATE('01012000', 'MMDDYYYY')) + 1
      INTO SPLITDATE
      FROM OGEN.GEN_P_ARCHIVE
     WHERE FACILITY_KEY = FACILITYKEY;
  EXCEPTION
    WHEN NO_DATA_FOUND THEN
      SPLITDATE := TO_DATE('01022000', 'MMDDYYYY');
  END;

  IF SPLITDATE <= ENDDATE THEN ARCH := ARCH + 1; END IF;
  IF SPLITDATE >= STARTDATE THEN ARCH := ARCH - 1; END IF;

OPEN OCURSOR FOR
   SELECT
     TR.FACILITY_KEY,
     TR.TR_DATETIME TRDATE,
     PM.NURSING_UNIT UNIT,
     TR.MENU_ID,
     NVL(D.DESCR_SHORT, 'Other') MTYPE,
     SH.DESCR SHIFT,
     PM.LAST_NAME,
     PM.FIRST_NAME,
     PM.PATIENT_ID,
     PM.MRN,
     TR.VALUE,
     U.NAME_FULL CNANAME
FROM  HPTC.THS_T_TRANSACTIONS1 TR,
   GEN.GEN_M_PATIENT_MAST PM,
   GEN.GEN_C_SHIFT SH,
   HPTC.THS_M_USERS1 U,
   HPTC.THS_M_MENU2 M1,
  (  SELECT *
  FROM  HPTC.THS_M_MENU2 M2
  WHERE   (M2.MENU_ID_PARENT  = 107)
) M2,
   HPTC.THS_C_MENU_DESCR D
WHERE   (TR.PAT_NUMBER  = PM.PAT_NUMBER)
 AND  ((TR.SHIFT_CODE  = SH.SHIFT_CODE
 AND  SH.FACILITY_KEY  = SHIFTFACILITY))
 AND  ((TR.USER_ID  = U.TS_USER_ID))
 AND  ((M1.MENU_ID (+) = TR.MENU_ID))
 AND  ((M2.MENU_ID (+) = M1.MENU_ID_PARENT))
 AND  ((D.DESCR_ID (+) = M2.DESCR_ID))
 AND  (ARCH >= 0

 AND  TR.FACILITY_KEY  = FACILITYKEY
 AND  TR.TR_DATETIME  BETWEEN STARTDATE  AND  ENDDATE
 AND  TR.EDIT_NO  < 0
 AND  TR.MENU_ID  IN ( 1070103  , 1070203  , 1070803  , 1070403  , 1070503  , 1070603  , 1070703  )
 AND  GEN.STR2NUM(TR.VALUE)  <= MAXVALUE
 AND  (DECODE(THEUNIT , '' , NULL , THEUNIT)  IS NULL
 OR  PM.UNIT_CODE  = THEUNIT)
 AND  (DECODE(THESHIFT , 0 , NULL , THESHIFT)  IS NULL
 OR  TR.SHIFT_CODE  = THESHIFT)
-- AND  TR.VALUE  > 49)
4

1 回答 1

1

您是否尝试删除评论文本并留下右括号?这样
“-- AND TR.VALUE > 49)”
就变成了:
“)”

于 2012-05-07T20:20:22.743 回答