Questions tagged [format-model]

"Format Model" is an Oracle SQL terminology for a string output or input format in functions that convert different data types from and to string values.

In Oracle, built-in functions, like TO_CHAR, TO_DATE, TO_NUMBER, accept string parameter called "Format Model", which can represent either input or output of such function.

Examples:

-- Convert date field to string SELECT TO_CHAR(dateField, 'MM/DD/YYYY HH:MI:SS') from table1

Output: 01/01/1999 10:15:30

-- Convert string input to date SELECT TO_DATE('01/01/1999 10:15:30', 'MM/DD/YYYY HH:MI:SS') from DUAL

Output: 01-JAN-99

2 questions
1
vote
2 answers

How to add blanks between digits (currency) - Oracle format

I need to give format to the following number: 1234567.89 as 1 234 567.89 I already tried: select regexp_replace( '1234567.89', '(...)', '\1 ' ) from dual; But its starting from left to right the counting and it's ignoring the decimal dot. Thanks…
Maverick.pe
  • 1,917
  • 4
  • 15
  • 20
-1
votes
3 answers

Oracle TO_CHAR Format Module 'FM099999999V99MI' equivalent in SQL Server

I am moving data from Oracle to an MS SQL server. I'm using a TO_CHAR Format module for the amount field to change the amount to the desired format using FM. I'm looking for an equivalent function in the SQL server to get the same…
Sampath
  • 21
  • 2