Funciones Predeterminadas del Oracle 11g
--******************FUNCIONES NUMÉRICAS
--obtiene el seno de un numero
select sin(2)from dual;
--obtiene el valor absoluto
select abs(-100)from dual;
--obtiene la raiz cuadrada
select sqrt(4)as raiz_cuadrada from dual;
--obtiene el redondeo de numeros decimales
select round(11.235888888,2)from dual;
--obtiene el resto de una division
select mod(3,2) from dual;
--********************FUNCIONES DE CADENA
select concat('hola','mundo')from dual;
select initcap('jose')from dual;
select upper('maria')from dual;
select lower('JESUS')from dual;
select length('jose maria')from dual;
select upper(replace('oracle 10g','10g','11g')) from dual;
select trim(' oracle ')from dual;
select substr('E0001',1,1)from dual;
select to_char(3850.0000,'$9,999.99')FROM dual;
select to_char(4850.34440,'$9,999.99')FROM dual;
--********************FUNCIONES DE FECHAS
select sysdate from dual;
SELECT CURRENT_DATE AS FECHA_ACTUAL FROM DUAL;
select to_char(sysdate,'MM/DD/YY') from dual;
select to_char(sysdate,'DD/MM/YYYY') from dual;
select to_char(SYSDATE, 'FMMonth DD, YYYY')FROM dual;
select to_char(sysdate,'Month')from dual; --muestra MES
select to_char(sysdate,'DAY')from dual; --muestra DIA
select to_char(sysdate,'YEAR')from dual; --muestra AÑO
--formato de fechas nativas
select to_date(sysdate,'DD/MM/YYYY')from dual;
select to_char(to_date('01/01/1984','DD/MM/YYYY'),'YYYY-MM-DD')from dual;
--by. Ing. Jhonatan Abal Mejia
--obtiene el seno de un numero
select sin(2)from dual;
--obtiene el valor absoluto
select abs(-100)from dual;
--obtiene la raiz cuadrada
select sqrt(4)as raiz_cuadrada from dual;
--obtiene el redondeo de numeros decimales
select round(11.235888888,2)from dual;
--obtiene el resto de una division
select mod(3,2) from dual;
--********************FUNCIONES DE CADENA
select concat('hola','mundo')from dual;
select initcap('jose')from dual;
select upper('maria')from dual;
select lower('JESUS')from dual;
select length('jose maria')from dual;
select upper(replace('oracle 10g','10g','11g')) from dual;
select trim(' oracle ')from dual;
select substr('E0001',1,1)from dual;
select to_char(3850.0000,'$9,999.99')FROM dual;
select to_char(4850.34440,'$9,999.99')FROM dual;
--********************FUNCIONES DE FECHAS
select sysdate from dual;
SELECT CURRENT_DATE AS FECHA_ACTUAL FROM DUAL;
select to_char(sysdate,'MM/DD/YY') from dual;
select to_char(sysdate,'DD/MM/YYYY') from dual;
select to_char(SYSDATE, 'FMMonth DD, YYYY')FROM dual;
select to_char(sysdate,'Month')from dual; --muestra MES
select to_char(sysdate,'DAY')from dual; --muestra DIA
select to_char(sysdate,'YEAR')from dual; --muestra AÑO
--formato de fechas nativas
select to_date(sysdate,'DD/MM/YYYY')from dual;
select to_char(to_date('01/01/1984','DD/MM/YYYY'),'YYYY-MM-DD')from dual;
--by. Ing. Jhonatan Abal Mejia
Comentarios