Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the difference between the data types of MySQL and Oracle

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly shows you "what is the difference between the data types of MySQL and Oracle", the content is simple and clear, and I hope it can help you solve your doubts. Let me lead you to study and learn this article "what is the difference between the data types of MySQL and Oracle".

Data type

The serial number ORACLEMYSQL annotation 1NUMBERint / DECIMALDECIMAL is NUMBER (10Magne2). Such a structure INT is NUMBER (10), which represents an integer.

MYSQL has many types of int, tinyint mediumint bigint, etc., different int widths are different 2Varchar2 (n) varchar (n) 3DateDATATIME date field processing

MYSQL date fields are divided into DATE and TIME. Only DATE is available in the ORACLE date field, which contains the information of year, month, day, hour, minute and second. The system time of the current database is SYSDATE, accurate to seconds. Or use the string to convert the date function TO_DATE ('2001-08-01) year-month-day 24 hours: minute: second format YYYY-MM-DD HH24:MI:SS TO_DATE () there are many date formats, see ORACLE DOC. Convert date field to string function TO_CHAR ('2001-08-01 "grammar" YYYYMMI MmurDD HH24:MI:SS')

The mathematical formulas of the date field are very different. MYSQL finds 7 days from the current time using DATE_FIELD_NAME > SUBDATE (NOW (), INTERVAL 7 DAY) ORACLE to find 7 days from the current time using DATE_FIELD_NAME > SYSDATE-7

Several functions that insert the current time into the MYSQL are: the NOW () function returns the current date and time as `'YYYY-MM-DD HH:MM:SS', which can be directly stored in the DATETIME field. CURDATE () returns today's date in the format 'YYYY-MM-DD', which can be saved directly into the DATE field. CURTIME () returns the current time in the format 'HH:MM:SS', which can be saved directly in the TIME field. Example: insert into tablename (fieldname) values (now ())

The current time in oracle is the equivalent of INTEGER in sysdate4INTEGERint / INTEGERMysql to int5EXCEPTIONSQLEXCEPTION in 2.5 Mysql exception handling 6CONSTANT VARCHAR2 (1) there is no CONSTANT keyword migration from ORACLE to MYSQL in mysql, all CONSTANT constants can only be defined as variables 7TYPE g_grp_cur IS REF CURSOR; cursor: there are alternatives in mysql see 8TYPE unpacklist_type IS TABLE OF VARCHAR2 (2000) INDEX BY BINARY_INTEGER; array in mysql: temporary table processing in mysql

Or write the logic directly into the corresponding code

Direct processing of each value in the collection details see Array processing 9 automatically growing data types MYSQL has automatically growing data types, insert records do not need to operate this field, will automatically obtain data values. ORACLE does not have an auto-growing data type, so you need to create an auto-growing serial number, and when you insert a record, you assign the next value of the serial number to this field. Processing of 10NULLNULL Null characters

MYSQL's non-empty fields also have empty content, and ORACLE defines non-empty fields that do not allow empty content. Define the structure of the ORACLE table according to the NOT NULL of MYSQL, and errors will occur when importing data. Therefore, it is necessary to judge the empty character when importing the data, and if it is a NULL or empty character, you need to change it to a space string. The above is all the content of this article entitled "what is the difference between MySQL and Oracle data types". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report