This paper introduces the comparison of DB2 common functions with Oracle in detail
1. Type conversion functions: Decimal, Double, Integer, Smallint,real,hex (ARG),
Date, Time,timestamp,char, varchar
Common examples:
--Convert to String type
Oracle:select To_char (15.5000) from dual;
Db2:select char (15.5000) from sysibm.sysdummy1
--Convert to date time
Oracle:select to_date (' 2008-01-01 ', ' YYYY-MM-DD ') from dual;
Db2:select date (' 2008-01-01 ') from sysibm.sysdummy1
2, Date: Year, quarter, month, week, day, hour, minute, second
DayOfYear (ARG): Returns the day value of ARG in the year
DayOfWeek (ARG): Returns the day value of ARG within a week
Days (ARG): Returns the integer representation of the date, from 0001-01-01.
Midnight_seconds (ARG): The number of seconds between midnight and Arg.
MonthName (ARG): Returns the name of the month for Arg.
Dayname (ARG): Returns the week of Arg.
Common examples:
--Returns the current system time
Oracle:select sysdate from dual;
Db2:select Current date from sysibm.sysdummy1
--Returns the next day of the current time (same as year)
Oracle:select sysdate,sysdate + interval ' 1 ' from dual;
Db2:select Current date + 1 day sysibm.sysdummy1