Oracle sp中缺少括号

时间:2012-05-07 16:21:49

标签: oracle plsql

在这个Oracle程序中,最后一个语句“AND TR.VALUE> 49)”需要删除。当我评论这个时,我在这里得到错误: AND(ARCH> = 0

错误缺少右括号。因为我们拿出了最后一个陈述,那么我应该把这个丢失的paren?

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)

1 个答案:

答案 0 :(得分:1)

您是否尝试删除评论文字并留下右括号? 那个 “ - 和TR.VALUE&gt; 49)”
只是:
“)”