Oracle Database provides the TO_CHAR(number)
function that enables you to format numbers based on a given format model. There are three format elements that you can use with the TO_CHAR()
function in order to return a value as a currency.
Category: DBMS
Database Management Systems
3 Ways to Format a Number to 2 Decimal Places in Oracle
When using Oracle Database, you can use functions like TO_CHAR(number)
to return numbers as a string, formatted to two decimal places (or however many decimal places you require).
Or you can use functions like ROUND(number)
and TRUNC(number)
to round or truncate the number to your required number of decimal places.
2 Ways to Get the Minutes from a Datetime Value in Oracle Database
Below are two functions that can be used to return the minutes portion from a datetime value in Oracle Database.
Continue readingCHARTOROWID() Function in Oracle
In Oracle Database, the CHARTOROWID()
function converts a string value to ROWID
data type.
How to Get the Short Month Name from a Date in MariaDB
In MariaDB, you can use the DATE_FORMAT()
function to return various date parts from a date. One of the things you can return is the short month name. For example Nov
or Dec
(instead of November
or December
).
TO_DATE() Function in Oracle
In Oracle Database, the TO_DATE()
function converts its argument to a value of DATE
data type.
How to Add the Meridiem Indicator (AM/PM) to a Time Value in Oracle
When using the TO_CHAR()
function to format a datetime value in Oracle Database, you can add the meridiem indicator (AM/PM) by simply adding either AM
or PM
to your format model.
Oracle then displays the appropriate meridiem indicator, depending on whether the time value is AM or PM.
You can provide it in any uppercase or lowercase, and with or without dots (e.g. AM
, A.M.
am
, a.m
, etc). Oracle will then display the meridiem indicator as specified.
RAWTONHEX() Function in Oracle
In Oracle Database, the RAWTONHEX()
function converts a raw value to hexadecimal.
It’s similar to the RAWTOHEX()
function, except that its value is always returned in the national character set.
RAWTOHEX() Function in Oracle
In Oracle Database, the RAWTOHEX()
function converts a raw value to hexadecimal.
HEXTORAW() Function in Oracle
In Oracle Database, the HEXTORAW()
function converts hexadecimal to a raw value.