Category: PL/SQL

PL/SQL NumToYMInterval

Oracle PL/SQL NumToYMInterval Function The NumToYMInterval function converts a number to an INTERVAL YEAR TO MONTH literal. The NumToYMInterval Function syntax: numtoyminterval( number, expression ) Example: select numtoyminterval(300000000, 'MONTH') from dual; +0250 select numtoyminterval(300000, 'YEAR') from dual; +0003...

PL/SQL NumToDSInterval

Oracle PL/SQL NumToDSInterval Function The NumToDSInterval function converts a number to an INTERVAL DAY TO SECOND literal. The NumToDSInterval Function syntax: numtodsinterval( number, expression ) Example: select numtodsinterval(20, 'DAY') from dual; +000000020 00:00:00 select numtodsinterval(2100, 'HOUR') from dual; +000000087 12:00:00 select...

PL/SQL NULLIF

Oracle PL/SQL NULLIF Function The NULLIF function compares two expressions. If exp1 and exp2 are not equal then return exp1. If exp1 and exp2 are equal the function returns NULL. The NULLIF Function syntax: NULLIF( exp1, exp2 ) Example: select NULLIF(24,...

PL/SQL Months_Between

Oracle PL/SQL Months_Between Function The Months_Between is used to show the number of months between two dates. The Months_Between Function syntax: months_between( date1, date2 ) Example: Select months_between(to_date('2010/06/06','yyyy/mm/dd'),to_date('2010/09/06','yyyy/mm/dd')) From dual; -3 Select months_between(to_date('2010/09/20','yyyy/mm/dd'),to_date('2010/05/26','yyyy/mm/dd')) From dual; 3.80645161290323 Select months_between (to_date('2010/09/20','yyyy/mm/dd'),to_date('2010/09/20','yyyy/mm/dd')) From dual;...

PL/SQL Mod

Oracle PL/SQL Mod Function The Mod function returns the remainder of a divided by b. The Mod Function syntax: mod( a, b ) a – b * floor(a/b) Example Select mod(17,5) From dual; 2 Select mod(17,0) From dual; 17 Select mod(17.3,2)...