Comparison of data types between Oracle and MySQL

Source: Internet
Author: User
Tags exception handling


number ORACLE mysql note
number int /DECIMAL Decimal number (10,2) Span class= "font8" >int Yes number (Ten) mysql There are many classes int tinyint mediumint bigint int width is different
2 Varchar2(n) VARCHAR (n)
3 Date Datatime Processing of date fields
MYSQLDate field Sub -DATEand the Timetwo species,ORACLEDate fields are onlyDATE, containing the date and time of the month and minute information, using the current database system time forSysdate,accurate to seconds, or convert strings to date-based functionsto_date (' 2001-08-01 ', ' yyyy-mm-dd ')years-Month-Day -hours:minutes:secondsthe Formatyyyy-mm-dd HH24:MI:SS to_date ()There are many kinds of date formats, can seeORACLE DOC.date fields are converted to String functionsto_char (' 2001-08-01 ', ' yyyy-mm-dd HH24:MI:SS ')

the mathematical formula for a date field differs greatly. MYSQLfind out the current time7Day UseDate_field_name>subdate( Now(),INTERVAL 7 Day)ORACLEfind out the current time7Day UseDate_field_name>SYSDATE-7;

MYSQLSeveral functions that insert the current time are:Now ()function to"' yyyy-mm-dd HH:MM:SS 'returns the current datetime, which can be stored directly in theDATETIMEfield. curdate ()in' Yyyy-mm-dd 'format returns today's date and can be stored directly in theDATEfield. curtime ()in' HH:MM:SS 'format returns the current time and can be stored directly in the Timefield. Example:INSERT INTO TableName (fieldname) VALUES (now ())

andOraclethe current time in issysdate
4 integer Int/integer mysql In integer int
5 exception sqlexception  see << 2.5 MySQL exception handling in 2009001-eservice-o2mg.doc>>
6 constant VARCHAR2 (1) mysql migrating from Oracle to MySQL, all constant constants can only be defined as variables
7 type G_grp_cur is REF CURSOR; cursor: there are alternatives in MySQL See < <2009001-eService-O2MG.doc>> 2.2 Cursor Handling
8 type Unpacklist_type is TABLE of VARCHAR2 (a) INDEX by Binary_integer; array: In MySQL, with temporary table handling
or direct write logic to the appropriate code,
directly handles each value in the collection appropriately
See <<2009001-eService-O2MG.doc>> 2.4 array handling
9 auto-growing sequence Auto-growing data type Mysql oracle There is no auto-growing data type, you need to create an autogrow serial number, and when inserting a record, assign the next value of the sequence number to this field.
10 null null null character handling
mysql oracle mysql not NULL oracle table structure leads to errors when data is generated. Therefore, to judge the null character when conducting the data, if the null


This article is from the "Old White blog" blog, please be sure to keep this source http://laobaiv1.blog.51cto.com/2893832/1961069

Comparison of data types between Oracle and MySQL

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.