Home Database Mysql Tutorial Oracle和SQL语法区别整理

Oracle和SQL语法区别整理

Jun 07, 2016 pm 04:55 PM
or oracle database

字符数据类型 CHAR CHAR 都是固定长度字符资料但oracle 里面最大度为2kb,SQLServer里面最大长度为8kb 变长字符数据类型

  字符数据类型 CHAR CHAR 都是固定长度字符资料但Oracle 里面最大度为2kb,SQLServer里面最大长度为8kb

  变长字符数据类型 VARCHAR2 VARCHAR Oracle 里面最大长度为 4kb,,SQLServer里面最大长度为8kb

  根据字符集而定的固定长度字符串 NCHAR NCHAR 前者最大长度2kb后者最大长度4kb

  根据字符集而定的可变长度字符串 NVARCHAR2 NVARCHAR 二者最大长度都为4kb

  日期和时间数据类型 DATE 有Datetime和Smalldatetime两种 在oracle 里面格式为DMY在SQLSerser里面可以调节,默认的为MDY

  数字类型 NUMBER(P,S) NUMERIC[P(,S)] Oracle 里面p代表小数点左面的位数,s代表小数点右面的位数。而SQLServer里面p代表小数点左右两面的位数之和,s代表小数点右面的位数。

  数字类型 DECIMAL(P,S) DECIMAL[P(,S)] Oracle 里面p代表小数点左面的位数,s代表小数点右面的位数。而SQLServer里面p代表小数点左右两面的位数之和,s代表小数点右面的位数。

  整数类型 INTEGER INT 同为整数类型,存储大小都为4个字节

  浮点数类型 FLOAT FLOAT

  实数类型 REAL REAL

  ORACLE 内部函数大全以及与SQLSERVER的区别:

  下面是Oracle 支持的字符函数和它们的Microsoft SQL Server等价函数。

  函数 Oracle Microsoft SQL  Server

  把字符转换为ASCII :ASCII ASCII

  字串连接: CONCAT --------------(expression + expression)

  把ASCII转换为字符 CHR, CHAR

  返回字符串中的开始字符(左起) INSTR ,---------------CHARINDEX

  把字符转换为小写 LOWER ---------------------LOWER

  把字符转换为大写 UPPER-------------------- UPPER

  填充字符串的左边 LPAD --------------------N/A

  清除开始的空白 LTRIM--------------------LTRIM

  清除尾部的空白 RTRIM --------------------RTRIM

  字符串中的起始模式(pattern) INSTR --------------------PATINDEX

  多次重复字符串 RPAD --------------------REPLICATE

  字符串的语音表示 SOUNDEX --------------------SOUNDEX

  重复空格的字串 RPAD --------------------SPACE

  从数字数据转换为字符数据 TO_CHAR --------------------STR

  子串 SUBSTR --------------------SUBSTRING

  替换字符 REPLACE --------------------STUFF

  将字串中的每个词首字母大写 INITCAP --------------------N/A

  翻译字符串 TRANSLATE --------------------N/A

  字符串长度 LENGTH-------------------- DATELENGTH or LEN

  列表中最大的字符串 GREATEST-------------------- N/A

  列表中最小的字符串 LEAST --------------------N/A

  如果为NULL则转换字串 NVL-------------------- ISNULL

  日期函数

  下面是Oracle 支持的日期函数和它们的Microsoft SQL Server等价函数。

  函数 Oracle --------------------Microsoft SQL  Server

  日期相加 (date column +/- value) or ADD_MONTHS --------------------DATEADD

  两个日期的差 (date column +/- value) or MONTHS_BETWEEN --------------------DATEDIFF

  当前日期和时间 SYSDATE --------------------GETDATE()

  一个月的最后一天 LAST_DAY --------------------N/A

  时区转换 NEW_TIME --------------------N/A

  日期后的第一个周日 NEXT_DAY --------------------N/A

  代表日期的字符串 TO_CHAR --------------------DATENAME

  代表日期的整数 TO_NUMBER (TO_CHAR)) --------------------DATEPART

  日期舍入 ROUND --------------------CONVERT

  日期截断 TRUNC --------------------CONVERT

  字符串转换为日期 TO_DATE --------------------CONVERT

  如果为NULL则转换日期 NVL -------------------- ISNULL

  转换函数

  下面是Oracle 支持的转换函数和它们的Microsoft SQL Server等价函数。

  函数 Oracle --------------------Microsoft SQL  Server

  数字转换为字符 TO_CHAR --------------------CONVERT

  字符转换为数字 TO_NUMBER --------------------CONVERT

  日期转换为字符 TO_CHAR --------------------CONVERT

  字符转换为日期 TO_DATE CONVERT

  16进制转换为2进制 HEX_TO_RAW --------------------CONVERT

  2进制转换为16进制 RAW_TO_HEX --------------------CONVERT

linux

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Chat Commands and How to Use Them
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

MySQL: An Introduction to the World's Most Popular Database MySQL: An Introduction to the World's Most Popular Database Apr 12, 2025 am 12:18 AM

MySQL is an open source relational database management system, mainly used to store and retrieve data quickly and reliably. Its working principle includes client requests, query resolution, execution of queries and return results. Examples of usage include creating tables, inserting and querying data, and advanced features such as JOIN operations. Common errors involve SQL syntax, data types, and permissions, and optimization suggestions include the use of indexes, optimized queries, and partitioning of tables.

Why Use MySQL? Benefits and Advantages Why Use MySQL? Benefits and Advantages Apr 12, 2025 am 12:17 AM

MySQL is chosen for its performance, reliability, ease of use, and community support. 1.MySQL provides efficient data storage and retrieval functions, supporting multiple data types and advanced query operations. 2. Adopt client-server architecture and multiple storage engines to support transaction and query optimization. 3. Easy to use, supports a variety of operating systems and programming languages. 4. Have strong community support and provide rich resources and solutions.

How to encrypt oracle view How to encrypt oracle view Apr 11, 2025 pm 08:30 PM

Oracle View Encryption allows you to encrypt data in the view, thereby enhancing the security of sensitive information. The steps include: 1) creating the master encryption key (MEk); 2) creating an encrypted view, specifying the view and MEk to be encrypted; 3) authorizing users to access the encrypted view. How encrypted views work: When a user querys for an encrypted view, Oracle uses MEk to decrypt data, ensuring that only authorized users can access readable data.

How to uninstall Oracle installation failed How to uninstall Oracle installation failed Apr 11, 2025 pm 08:24 PM

Uninstall method for Oracle installation failure: Close Oracle service, delete Oracle program files and registry keys, uninstall Oracle environment variables, and restart the computer. If the uninstall fails, you can uninstall manually using the Oracle Universal Uninstall Tool.

How to create oracle dynamic sql How to create oracle dynamic sql Apr 12, 2025 am 06:06 AM

SQL statements can be created and executed based on runtime input by using Oracle's dynamic SQL. The steps include: preparing an empty string variable to store dynamically generated SQL statements. Use the EXECUTE IMMEDIATE or PREPARE statement to compile and execute dynamic SQL statements. Use bind variable to pass user input or other dynamic values ​​to dynamic SQL. Use EXECUTE IMMEDIATE or EXECUTE to execute dynamic SQL statements.

How to read the oracle awr report How to read the oracle awr report Apr 11, 2025 pm 09:45 PM

An AWR report is a report that displays database performance and activity snapshots. The interpretation steps include: identifying the date and time of the activity snapshot. View an overview of activities and resource consumption. Analyze session activities to find session types, resource consumption, and waiting events. Find potential performance bottlenecks such as slow SQL statements, resource contention, and I/O issues. View waiting events, identify and resolve them for performance. Analyze latch and memory usage patterns to identify memory issues that are causing performance issues.

How to create cursors in oracle loop How to create cursors in oracle loop Apr 12, 2025 am 06:18 AM

In Oracle, the FOR LOOP loop can create cursors dynamically. The steps are: 1. Define the cursor type; 2. Create the loop; 3. Create the cursor dynamically; 4. Execute the cursor; 5. Close the cursor. Example: A cursor can be created cycle-by-circuit to display the names and salaries of the top 10 employees.

How to open a database in oracle How to open a database in oracle Apr 11, 2025 pm 10:51 PM

The steps to open an Oracle database are as follows: Open the Oracle database client and connect to the database server: connect username/password@servername Use the SQLPLUS command to open the database: SQLPLUS

See all articles