Differences

This shows you the differences between two versions of the page.

oracle-to-mysql:to_char_number [February 27, 2013 9:47 am] (current)
sqlines created
Line 1: Line 1:
 +====== TO_CHAR - Convert Number to String - Oracle to MySQL Migration ======
 +In Oracle, TO_CHAR function can convert a numeric value to string using the specified format. In MySQL, you can use FORMAT function as well as other string functions and expressions.
 +
 +**Oracle**:
 +
 +<code sql>
 +  -- Convert the price to string format
 +  SELECT TO_CHAR(1000, 'FM$9,999,999') FROM dual;
 +  # $1,000
 +</code>
 +
 +**MySQL**:
 +
 +<code sql>
 +  -- Convert the price to string format
 +  SELECT CONCAT('$', FORMAT(1000, 0));
 +  # $1,000
 +</code>
 +
 +===== Conversion Examples =====
 +
 +Typical conversion examples:
 +
 +| **Oracle** | **MySQL** |
 +| TO_CHAR(1000, 'FM$9,999,999') | CONCAT('$', FORMAT(1000, 0)) |
 +| TO_CHAR(1000, '9,999,999') | FORMAT(1000, 0) |
 +
 +===== Database and SQL Migration Tools =====
 +
 +  * [[/tool|SQLines - Database and SQL Conversion Tool]]
 +  * [[/sqldata|SQLines Data - Data Transfer and Database Schema Migration Tool]]
 +  * [[http://www.sqlines.com/online|Free Online SQL Conversion Tool]]
 +
 +  * [[/oracle-to-mysql|Oracle to MySQL Migration Reference]]
 +  
 +===== About SQLines =====
 +
 +SQLines offers services and tools to help you migrate databases and applications. For more information, please contact us at [[support@sqlines.com]].
 +
 +~~NOTOC~~
 +~~DISCUSSION~~