0
DECLARE
          v_count NUMBER ;
        begin
            SELECT Count(COMPLETION) INTO v_count  FROM AIMS  WHERE  Code=997 AND completion !=2  ;
            IF v_count = 0 THEN
               UPDATE UNITS pu
                    SET
                      code = 'COM',
                      status = 'F',
                      by = '',
                      date =     (
                          SELECT Nvl(Max(la.end_date), To_Date('01/01/1900', 'DD/MM/YYYY'))
                          FROM aims la  WHERE la.code = 997  GROUP BY la.code  
                          ) ;  
                      WHERE ID = 997 ;
            END IF ;

             END;
4

2 回答 2

1
DECLARE
          v_count NUMBER ;
        begin
            SELECT Count(COMPLETION) INTO v_count  FROM AIMS  WHERE  Code=997 AND completion !=2  ;
            IF v_count = 0 THEN
               UPDATE UNITS pu
                    SET
                      code = 'COM',
                      status = 'F',
                      by = '',
                      date =     (
                          SELECT Nvl(Max(la.end_date), To_Date('01/01/1900', 'DD/MM/YYYY'))
                          FROM aims la  WHERE la.code = 997  GROUP BY la.code  
                          ) ;  

--                          ^  Extra semicolon

                      WHERE ID = 997 ;



            END IF ;

             END;
于 2012-04-19T15:05:07.953 回答
1

您的代码中有一个额外的分号。去掉这里的分号:

                  date =     (
                      SELECT Nvl(Max(la.end_date), To_Date('01/01/1900', 'DD/MM/YYYY'))
                      FROM aims la  WHERE la.code = 997  GROUP BY la.code  
                      ) ; 
于 2012-04-19T15:06:00.717 回答