Wednesday, August 22, 2012

implement IF-THEN-ELSE logic in a SELECT ORACLE statement


Oracle SQL from Oracle 8i support methods of create  IF-THEN-ELSE using CASE SQL .
See example below:


SELECT  CTA.CUSTOMER_TRX_ID ID_FACTURA,CTA.TRX_NUMBER NUMERO_FACTURA,RCTTA.name,

CASE WHEN RCTTA.name='SPA' OR RCTTA.name='RSPA' 
      THEN TO_CHAR(TO_DATE(CTA.TRX_DATE, 'DD/MM/RRRR'), 'DD/MM/RRRR') 
 WHEN RCTTA.name='EXP' OR RCTTA.name='REXP' 
       THEN TO_CHAR(TO_DATE(CTA.TRX_DATE, 'DD/MM/RRRR'), 'MM/DD/RRRR')
ELSE 
        TO_CHAR(TO_DATE(CTA.TRX_DATE, 'DD/MM/RRRR'), 'MM/DD/RRRR')
END AS FECHA_FACTURA

FROM RA_CUSTOMER_TRX_ALL CTA ....




Tuesday, August 14, 2012

Export to csv doesn't work. APPLSYS.FND_LOBS_CTX

Recently occurred that File|Export option from main menu in oracle apps doesn´t export properly. Problem is due to log file overflow  . For fixing only execute this script:


begin ctx_ddl.sync_index('APPLSYS.FND_LOBS_CTX');
end;