Differences between oracle and SQL (common functions) (4) _ MySQL

Source: Internet
Author: User
Tags time zones
Differences between oracle and SQL (common functions) (4) ORACLE functions

BitsCN.com

Ual

41. a day of the week (such as Sunday)

S: unknown

O: SELECT Next_day (sysdate, 7) vaule from dual;

42. string conversion time

S: can be directly converted to or select cast ('2017-09-08 'as datetime) value

O: SELECT To_date ('2017-01-05 22:09:38 ', 'yyyy-mm-dd hh24-mi-ss') vaule from dual;

43. calculate the difference of a part of the two dates (for example, seconds)

S: select datediff (ss, getdate (), getdate () + 12.3) value O: subtract directly with two dates (such as D1-D2 = 12.3)

SELECT (D1-D2) * 24*60*60 vaule from dual;

44. calculate a new date (for example, minute) based on the difference value)

S: select dateadd (mi, 8, getdate () value

O: SELECT sysdate + 8/60/24 vaule from dual;

45. time in different time zones

S: unknown

O: SELECT New_time (sysdate, 'ydt ', 'gmt') vaule from dual;
----- Time zone parameter. Beijing must be in the East 8 zone of Ydt -------
Ast adt standard Atlantic Time

Bst bdt Standard Time

Standard time for central CST CDT

Est edt standard Eastern time

GMT Standard Time

Hst hdt Alaska-Hawaii Standard Time

Standard time for mst mdt mountainous areas

NST standard time for new Finland

Pst pdt Pacific Standard Time

Yst ydt yukon Standard Time

Character functions supported by Oracle and their Microsoft SQL Server equivalent functions:

Functions: Oracle Microsoft SQL Server

Convert characters to ASCII

CONCAT (expressi limit n + expressi limit n)

Convert ASCII to CHR CHAR

Returns the Start character (from the left) instr charindex in the string.

Convert characters to LOWER-case LOWER

Convert character to uppercase UPPER

Fill the left lpad n/A of the string

Clear the starting blank LTRIM

Clear trailing blank RTRIM

INSTR PATINDEX

Repeat the string rpad replicate multiple times

Voice representation of the string SOUNDEX

Repeat the SPACE string RPAD SPACE

Convert numeric data to character data TO_CHAR STR

SUBSTRING SUBSTR SUBSTRING

REPLACE STUFF

Capital the first letter of each word in the string. initcap n/

Translation string translate n/

String LENGTH: DATELENGTH or LEN

The largest string in the list: greatest n/

The smallest string in the list, least n/.

BitsCN.com

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.