Oracle/PLSQL: Função TO_CHAR

Posted by Bento | Posted in PL/SQL | Posted on 01-11-2013-05-2008

0

Oracle/PLSQL: Função TO_CHAR
Sintaxe da função;

TO_CHAR( value, [ format_mask ], [ nls_language ] )

exemplo com datas
TO_CHAR(sysdate, ‘yyyy/mm/dd’); retorno ‘2003/07/09’
TO_CHAR(sysdate, ‘Month DD, YYYY’); retorno ‘July 09, 2003’
TO_CHAR(sysdate, ‘FMMonth DD, YYYY’); retorno ‘July 9, 2003’
TO_CHAR(sysdate, ‘MON DDth, YYYY’); retorno ‘JUL 09TH, 2003’
TO_CHAR(sysdate, ‘FMMON DDth, YYYY’); retorno ‘JUL 9TH, 2003’
TO_CHAR(sysdate, ‘FMMon ddth, YYYY’); retorno ‘Jul 9th, 2003’

http://www.techonthenet.com/oracle/functions/to_char.php

Oracle/PLSQL: Função TRUNC

Posted by Bento | Posted in PL/SQL | Posted on 01-11-2013-05-2008

0

Oracle/PLSQL: FunçãoTrunc

SELECT
trunc((408.35 / 30 * 4 ),2)
FROM dual

Oracle/PLSQL: Função ADD_MONTHS

Posted by Bento | Posted in PL/SQL | Posted on 01-11-2013-05-2008

0

Oracle/PLSQL: Função ADD_MONTHS

ADD_MONTHS(’01-Aug-03′, 3)

retorno ’01-Nov-03′

Oracle/PLSQL: Função REPLACE

Posted by Bento | Posted in PL/SQL | Posted on 01-11-2013-05-2008

0

Oracle/PLSQL: Função REPLACE

SELECT
replace(‘1.1.1.1.1’, ‘.’, ”)
FROM dual

retorno
11111

Oracle/PLSQL: Função DECODE

Posted by Bento | Posted in PL/SQL | Posted on 01-11-2013-05-2008

0

Oracle/PLSQL: Função DECODE

Decode(situacao,’A’,’Ativo’,’E’,’Excluído’) situacao