how to display only those data which is specified in a given year

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • girish1989
    New Member
    • May 2012
    • 1

    how to display only those data which is specified in a given year

    Hiii,
    I had written procedure which will display missing data from a table

    Code:
    CREATE OR REPLACE PROCEDURE GETEMPLOYEE_INFO
    (
    P_CPNCOD in varchar2,
    P_PAYDAT in date,
    P_PAYTYP in varchar2,
    P_ERV out varchar2)
    is
    R_DI_FILLODINF NUMBER(20);
    BEGIN
       FOR i IN (SELECT * FROM DI_ELEMOD)
       LOOP
         SELECT COUNT(*) INTO R_DI_FILLODINF
         FROM DI_FILLODINF
         WHERE P_CPNCOD=i.CPNCOD and
               P_PAYDAT=i.PAYDAT and
               P_PAYTYP=i.PAYTYP ;
              
        if nvl(R_DI_FILLODINF,0)<=0
         then	
        dbms_output.put_line ('missing data : ' ||     i.CPNCOD  ||     i.PAYDAT  ||     i.PAYTYP   );
        end if;
        end loop;
        EXCEPTION
           WHEN OTHERS THEN NULL;
     end;
    /

    but now my problem is if I put '01-JUN-12' date than procedure should return only those data which is present in year 2012

    Code:
    DECLARE
    V_INSTY DI_FILLODINF.INSTYP%TYPE;
    BEGIN
    GETEMPLOYEE_INFO ('CO','01-JUN-12','D',V_INSTY);
    END;
    /
    Last edited by Rabbit; May 29 '12, 03:23 PM. Reason: Please use code when posting code.
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    Please use code when posting code.

    If you're trying to limit on the year, why are you passing a specific date?

    Comment

    Working...