ORACLE存储过程不编译

ORACLE存储过程不编译,oracle,stored-procedures,Oracle,Stored Procedures,我在这个查询中苦苦挣扎,不明白Oracle为什么不编译以下存储过程, 错误为PL/SQL:ORA-00933:comando SQL terminato Erroneamte,行中包含“来自storico_dipendente AS anag 提前谢谢 保罗 create or replace PROCEDURE AVERAGE_VRE ( p_refDate IN DATE , p_level IN VARCHAR2 ) /

我在这个查询中苦苦挣扎,不明白Oracle为什么不编译以下存储过程, 错误为PL/SQL:ORA-00933:comando SQL terminato Erroneamte,行中包含“来自storico_dipendente AS anag

提前谢谢

保罗

create or replace 
    PROCEDURE AVERAGE_VRE (
                p_refDate IN DATE ,
          p_level IN VARCHAR2 )
    /*
        Procedure Name: AVERAGE_VRE
        Author:         Paolo URSINI
        Date:           21 jan 2015
        Description:    this procedure compute the average amount from PAYROLL table
                        inserting into PAYROLL_CALCOLATO table.
                        The assumption is that every wage type is equally divided
                        by ALL THE ACTIVE EMPLOYEE
    */
    IS 
      FTE decimal(8,3) := 0;

    BEGIN    
      SELECT sum(percentuale_parttime) into FTE
        from storico_dipendente
        where TRUNC(data_inizio_variazione) <= p_refDate 
            and TRUNC(data_fine_variazione) >= p_refDate 
            and flag_status = 1;    

        INSERT INTO PAYROLL_CALCOLATO (
            MATRICOLA, 
            DATA_PY, 
            IMPORTO,
            ID_CODICE_VOCE,
            TM_INS,
            TM_UPD,
            ID_GRUPPO_DATI)
            SELECT 
                anag.MATRICOLA, voci.DATA_PY, (voci.sumImporto / FTE ), 
                voci.ID_CODICE_VOCE, 
                SYSDATE, 
                SYSDATE, 
                2           
            FROM storico_dipendente AS anag,
          (
            SELECT DATA_PY, ID_CODICE_VOCE, sum(IMPORTO_PY) sumImporto
              FROM PAYROLL 
              WHERE TRUNC(DATA_PY) = p_refDate
              GROUP BY DATA_PY, ID_CODICE_VOCE
          ) AS voci         
        where TRUNC(data_inizio_variazione) <= p_refDate 
            and TRUNC(data_fine_variazione) >= p_refDate 
            and flag_status = 1 and cod_livello = p_level;  

    END AVERAGE_VRE;

从两个表/子查询别名中删除AS。虽然Oracle允许您将AS与列别名一起使用,但它对表别名的语法无效。

请从两个表/子查询别名中删除AS。虽然Oracle允许您将AS与列别名一起使用,但它对表别名的语法无效。

请从两个表/子查询别名中删除AS。虽然Oracle允许您将AS与列别名一起使用,但它对表别名的语法无效。

请从两个表/子查询别名中删除AS。虽然Oracle允许您将AS与列别名一起使用,但它对表别名的语法无效。

已解决,问题在于别名中的关键字AS。 下面的代码编译正确

 CREATE OR REPLACE PROCEDURE AVERAGE_VRE (
            p_refDate IN DATE ,
      p_level IN VARCHAR2 )
/*
    Procedure Name: AVERAGE_VRE
    Author:         Paolo URSINI
    Date:           21 jan 2015
    Description:    this procedure compute the average amount from PAYROLL table
                    inserting into PAYROLL_CALCOLATO table.
                    The assumption is that every wage type is equally divided
                    by ALL THE ACTIVE EMPLOYEE
*/
IS 
  FTE decimal(8,3) := 0;

BEGIN    
  SELECT sum(percentuale_parttime) into FTE
    from storico_dipendente
    where TRUNC(data_inizio_variazione) <= p_refDate 
        and TRUNC(data_fine_variazione) >= p_refDate 
        and flag_status = 1 and cod_livello = p_level;    

    INSERT INTO PAYROLL_CALCOLATO (
        MATRICOLA , 
        DATA_PY, 
        IMPORTO,
        ID_CODICE_VOCE,
        TM_INS,
        TM_UPD,
        ID_GRUPPO_DATI)
        SELECT 
            anag.MATRICOLA ,voci.DATA_PY, (voci.sumImporto / FTE ), 
            voci.ID_CODICE_VOCE, 
            SYSDATE, 
            SYSDATE, 
            2         
        FROM storico_dipendente anag,
              (
                SELECT DATA_PY, ID_CODICE_VOCE, sum(IMPORTO_PY) sumImporto
                  FROM PAYROLL 
                  WHERE TRUNC(DATA_PY) = p_refDate
                  GROUP BY DATA_PY, ID_CODICE_VOCE
              ) voci            
    where TRUNC(data_inizio_variazione) <= p_refDate 
        and TRUNC(data_fine_variazione) >= p_refDate 
        and flag_status = 1 and cod_livello = p_level;  

END AVERAGE_VRE;

解决后,问题出现在别名中,关键字为。 下面的代码编译正确

 CREATE OR REPLACE PROCEDURE AVERAGE_VRE (
            p_refDate IN DATE ,
      p_level IN VARCHAR2 )
/*
    Procedure Name: AVERAGE_VRE
    Author:         Paolo URSINI
    Date:           21 jan 2015
    Description:    this procedure compute the average amount from PAYROLL table
                    inserting into PAYROLL_CALCOLATO table.
                    The assumption is that every wage type is equally divided
                    by ALL THE ACTIVE EMPLOYEE
*/
IS 
  FTE decimal(8,3) := 0;

BEGIN    
  SELECT sum(percentuale_parttime) into FTE
    from storico_dipendente
    where TRUNC(data_inizio_variazione) <= p_refDate 
        and TRUNC(data_fine_variazione) >= p_refDate 
        and flag_status = 1 and cod_livello = p_level;    

    INSERT INTO PAYROLL_CALCOLATO (
        MATRICOLA , 
        DATA_PY, 
        IMPORTO,
        ID_CODICE_VOCE,
        TM_INS,
        TM_UPD,
        ID_GRUPPO_DATI)
        SELECT 
            anag.MATRICOLA ,voci.DATA_PY, (voci.sumImporto / FTE ), 
            voci.ID_CODICE_VOCE, 
            SYSDATE, 
            SYSDATE, 
            2         
        FROM storico_dipendente anag,
              (
                SELECT DATA_PY, ID_CODICE_VOCE, sum(IMPORTO_PY) sumImporto
                  FROM PAYROLL 
                  WHERE TRUNC(DATA_PY) = p_refDate
                  GROUP BY DATA_PY, ID_CODICE_VOCE
              ) voci            
    where TRUNC(data_inizio_variazione) <= p_refDate 
        and TRUNC(data_fine_variazione) >= p_refDate 
        and flag_status = 1 and cod_livello = p_level;  

END AVERAGE_VRE;

解决后,问题出现在别名中,关键字为。 下面的代码编译正确

 CREATE OR REPLACE PROCEDURE AVERAGE_VRE (
            p_refDate IN DATE ,
      p_level IN VARCHAR2 )
/*
    Procedure Name: AVERAGE_VRE
    Author:         Paolo URSINI
    Date:           21 jan 2015
    Description:    this procedure compute the average amount from PAYROLL table
                    inserting into PAYROLL_CALCOLATO table.
                    The assumption is that every wage type is equally divided
                    by ALL THE ACTIVE EMPLOYEE
*/
IS 
  FTE decimal(8,3) := 0;

BEGIN    
  SELECT sum(percentuale_parttime) into FTE
    from storico_dipendente
    where TRUNC(data_inizio_variazione) <= p_refDate 
        and TRUNC(data_fine_variazione) >= p_refDate 
        and flag_status = 1 and cod_livello = p_level;    

    INSERT INTO PAYROLL_CALCOLATO (
        MATRICOLA , 
        DATA_PY, 
        IMPORTO,
        ID_CODICE_VOCE,
        TM_INS,
        TM_UPD,
        ID_GRUPPO_DATI)
        SELECT 
            anag.MATRICOLA ,voci.DATA_PY, (voci.sumImporto / FTE ), 
            voci.ID_CODICE_VOCE, 
            SYSDATE, 
            SYSDATE, 
            2         
        FROM storico_dipendente anag,
              (
                SELECT DATA_PY, ID_CODICE_VOCE, sum(IMPORTO_PY) sumImporto
                  FROM PAYROLL 
                  WHERE TRUNC(DATA_PY) = p_refDate
                  GROUP BY DATA_PY, ID_CODICE_VOCE
              ) voci            
    where TRUNC(data_inizio_variazione) <= p_refDate 
        and TRUNC(data_fine_variazione) >= p_refDate 
        and flag_status = 1 and cod_livello = p_level;  

END AVERAGE_VRE;

解决后,问题出现在别名中,关键字为。 下面的代码编译正确

 CREATE OR REPLACE PROCEDURE AVERAGE_VRE (
            p_refDate IN DATE ,
      p_level IN VARCHAR2 )
/*
    Procedure Name: AVERAGE_VRE
    Author:         Paolo URSINI
    Date:           21 jan 2015
    Description:    this procedure compute the average amount from PAYROLL table
                    inserting into PAYROLL_CALCOLATO table.
                    The assumption is that every wage type is equally divided
                    by ALL THE ACTIVE EMPLOYEE
*/
IS 
  FTE decimal(8,3) := 0;

BEGIN    
  SELECT sum(percentuale_parttime) into FTE
    from storico_dipendente
    where TRUNC(data_inizio_variazione) <= p_refDate 
        and TRUNC(data_fine_variazione) >= p_refDate 
        and flag_status = 1 and cod_livello = p_level;    

    INSERT INTO PAYROLL_CALCOLATO (
        MATRICOLA , 
        DATA_PY, 
        IMPORTO,
        ID_CODICE_VOCE,
        TM_INS,
        TM_UPD,
        ID_GRUPPO_DATI)
        SELECT 
            anag.MATRICOLA ,voci.DATA_PY, (voci.sumImporto / FTE ), 
            voci.ID_CODICE_VOCE, 
            SYSDATE, 
            SYSDATE, 
            2         
        FROM storico_dipendente anag,
              (
                SELECT DATA_PY, ID_CODICE_VOCE, sum(IMPORTO_PY) sumImporto
                  FROM PAYROLL 
                  WHERE TRUNC(DATA_PY) = p_refDate
                  GROUP BY DATA_PY, ID_CODICE_VOCE
              ) voci            
    where TRUNC(data_inizio_variazione) <= p_refDate 
        and TRUNC(data_fine_variazione) >= p_refDate 
        and flag_status = 1 and cod_livello = p_level;  

END AVERAGE_VRE;

谢谢,找到了相同的解决方案谢谢,找到了相同的解决方案谢谢,找到了相同的解决方案谢谢,找到了相同的解决方案