Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
[email protected] web/email now available. Want one? Go here.
Cannot use outlook/hotmail/live here to register as they blocking our mail servers. #microsoftdeez
Obey the Epel!

Paste

Pasted as Plain Text by registered user vvillacorta ( 3 years ago )
SELECT CASE WHEN 
           (SELECT MONTHS_BETWEEN(CAST(MIN( FECCARGA) AS DATE FORMAT 'YYYYMM'), CAST(PERIODO_PARAMETRO AS DATE FORMAT 'YYYYMM')) FROM .................V_CONSOLIDADO_SUNAT_HIST WHERE FECCARGA>=PERIODO_PARAMETRO) 
           >=
          (SELECT MONTHS_BETWEEN(CAST(PERIODO_PARAMETRO AS DATE FORMAT 'YYYYMM'), CAST(MAX( FECCARGA) AS DATE FORMAT 'YYYYMM')) FROM .................V_CONSOLIDADO_SUNAT_HIST WHERE FECCARGA<=PERIODO_PARAMETRO) 
          OR  (SELECT MIN( FECCARGA) FROM .................V_CONSOLIDADO_SUNAT_HIST WHERE FECCARGA>=PERIODO_PARAMETRO)  IS NULL
          THEN 
          (SELECT MAX( FECCARGA) FROM .................V_CONSOLIDADO_SUNAT_HIST WHERE FECCARGA<=PERIODO_PARAMETRO)
          ELSE
           (SELECT MIN( FECCARGA) FROM .................V_CONSOLIDADO_SUNAT_HIST WHERE FECCARGA>=PERIODO_PARAMETRO)                                     
END

 

Revise this Paste

Your Name: Code Language: