📜  T-SQL 和 PL-SQL 的区别

📅  最后修改于: 2021-09-15 01:40:37             🧑  作者: Mango

1.事务SQL(T-SQL):
T-SQL 是 Transact Structure Query Language 的缩写。它是微软的产品,是用于与关系数据库交互的 SQL 语言的扩展。它被认为在 Microsoft SQL 服务器上表现最佳。 T-SQL 语句用于执行对数据库的事务。 T-SQL 非常重要,因为与 SQL 服务器实例的所有通信都是通过向服务器发送 Transact-SQL 语句来完成的。用户还可以使用 T-SQL 定义函数。

T-SQL 函数的类型是:

  • 聚合函数。
  • 排名功能。有不同类型的排名函数。
  • 行集函数。
  • 标量函数。

这些添加使 T-SQL 符合图灵完整性测试的标准。因此,Transact-SQL 是一种编程语言。

2. SQL 过程语言(PL/SQL):
PL/SQL 代表 SQL 的过程语言。它是 Oracle Corporation 的 SQL 过程扩展,也适用于 Oracle 关系数据库。它的主要优点是它允许使用程序,程序类似于函数。 PL/SQL 的主要亮点是它为我们提供了迭代、决策制定和更多特性的功能。 PL/SQL 中最小的功能单元称为块。它可以处理异常(运行时错误)。

PL/SQL 是一种应用程序语言,通常用于构建、格式化和显示用户屏幕、网页和报告,而 SQL 为这些应用程序提供数据。

T-SQL 和 PL-SQL 的区别:

S.No T-SQL PL/SQL
1. The full Form of TL-SQL is Transact Structure Query language. The full Form of PL/SQL is Procedural Language Structural Query Language.
2. T-SQL was developed by Microsoft. PL-SQL is developed by Oracle.
3. T-SQL provides a higher degree of control to the programmers. It is a natural programming language that is much compatible with the SQL and provides higher functionality.
4. T-SQL performs best with Microsoft SQL server. PL-SQL performs best with Oracle database server.
5. With help of BULK INSERT statement in T-SQL users can input multiple rows. OOPS concepts like function overloading, information hiding and data encapsulation are supported by using PL/SQL.
6. It is much easier to understand and simple to use. It is considered more complex than T-SQL and more powerful.
7. In T-SQL SELECT INTO statement must be used. In PL/SQL INSERT INTO statement is to be be used.
8. In T-SQL, both the DELETE and UPDATE statements are improved to enable data from another table to be used in the operations, without using a subquery. In PL/SQL, subquery is needed to use data from another table in the operation. 9. In T-SQL there is no AUTOCOMMIT command and transactions are saved by using COMMIT command manually after every transaction. In PL/SQL AUTOCOMMIT can be used to automatically commit/save a transaction.