SQL包:预期的subprg_spec

时间:2017-02-10 09:12:02

标签: sql oracle plsql oracle-sqldeveloper

在我的SQL包内部最后一行说

时出现错误
  

语法错误。部分认可的规则(预期的subprg_spec)

我经历过代码几次无法找到错误,因为一切对我都有意义。 :/

   PROCEDURE p_get_stmfrd_rel_records(asd IN NUMBER, pc_recordset OUT SYS_REFCURSOR)

   IS

   BEGIN
      OPEN pc_recordset FOR 
        SELECT NVL(LOGNO, 0) LOGNO
               ,NVL(INSTANCENO, 0) INSTANCENO
               ,RELEASE_BUILD
               ,SCRIPT_NAME
               ,NVL(VERSION, 0) VERSION
               ,NVL(REQUEST, 0) REQUEST
               ,COMMENTS
               ,NVL(GLUSDBT1_DEPLOYDATE, '1-Jan-0001') GLUSDBT1_DEPLOYDATE
               ,NVL(GLUSDBR1_DEPLOYDATE, '1-Jan-0001') GLUSDBR1_DEPLOYDATE
               ,NVL(GLUSDBP1_DEPLOYDATE, '1-Jan-0001') GLUSDBP1_DEPLOYDATE
             FROM (SELECT dlog.LOGNO
              ,DLOGDET.INSTANCENO
              ,DLOG.RELEASEID AS RELEASE_BUILD
              ,DLOG.FILENAMEEXT_VC AS SCRIPT_NAME
              ,DLOG.VERSION
              ,DLOG.REQUEST
              ,DLOG.NOTE AS COMMENTS
              ,DLOGDET.DEPLOYDATE
              ,INST.INSTANCEID              
                   FROM ADM_DEPLOYMENTLOG DLOG
                        JOIN ADM_DEPLOYMENTLOGDETAIL DLOGDET
                           ON DLOG.LOGNO = DLOGDET.LOGNO AND DLOGDET.CANCELEDIND = 'N'
                        LEFT OUTER JOIN ADM_INSTANCE INST
                           ON     DLOGDET.INSTANCENO = INST.INSTANCENO
                              AND INST.SITEID = 'STM'
                              AND INST.CANCELEDIND = 'N')
                PIVOT
                   (MAX (TRUNC (DEPLOYDATE))
                   AS DEPLOYDATE
                   FOR INSTANCEID
                   IN ('GLUSDBT1' AS GLUSDBT1
                     ,'GLUSDBR1' AS GLUSDBR1
                     ,'GLUSDBP1' AS GLUSDBP1));


   END p_get_stmfrd_rel_records;  





PROCEDURE p_insert_stmfrd_rel_records(
                                      DeployDate  IN   DATE,
                                      LogNO       IN   NUMBER,
                                      InstanceNO  IN   NUMBER
                                     ) IS
    vNum number;
BEGIN
    select count(1)
    into vNum
    FROM ADM_DEPLOYMENTLOGDETAIL
     WHERE     INSTANCENO = InstanceNO
           AND LOGNO = LogNO
           AND DEPLOYDATE IS NOT NULL;
    IF vNum > 0
    THEN
        BEGIN
            UPDATE ADM_DEPLOYMENTLOGDETAIL
               SET DEPLOYDATE    = DeployDate
             WHERE     INSTANCENO = InstanceNO
                   AND LOGNO = LogNO;
        END;
    ELSE
        BEGIN
            INSERT INTO ADM_DEPLOYMENTLOGDETAIL(
                                                LOGDETAILNO,
                                                DEPLOYDATE,
                                                STATUSID,
                                                CANCELEDIND,
                                                INSTANCENO
                                               )
                 VALUES (
                         ADM_DEPLOYMENTLOGDETAILNO_SQL.NEXTVAL,
                         DeployDate,
                         'D',
                         'N',
                         InstanceNO
                        );
        END;
    END IF;
END p_insert_stmfrd_rel_records;

0 个答案:

没有答案