What is PL/SQL?(PL/SQL是什么,与T-SQL对比)
PL/SQL:ORACLE对标准SQL语言的扩展
T-SQL:MSSQL对标准SQL语言的扩展
英文定义:In Oracle database management, PL/SQL is a procedural language extension to Structured Query Language (SQL). The purpose of PL/SQL is to combine database language and procedural programming language. The basic unit in PL/SQL is called a block, which is made up of three parts: a declarative part, an executable part, and an exception-building part.
Because PL/SQL allows you to mix SQL statements with procedural constructs, it is possible to use PL/SQL blocks and subprograms to group SQL statements before sending them to Oracle for execution. Without PL/SQL, Oracle must process SQL statements one at a time and, in a network environment, this can affect traffic flow and slow down response time. PL/SQL blocks can be compiled once and stored in executable form to improve response time.
A PL/SQL program that is stored in a database in compiled form and can be called by name is referred to as a stored procedure. A PL/SQL stored procedure that is implicitly started when an INSERT, UPDATE or DELETE statement is issued against an associated table is called a trigger.
解释1:SQL是结构化查询语言,比较接近自然语言,使用SQL,只需要说干什么,不需要说怎么干。由数据定义语言、数据操纵语言、数据控制语言构成,它不面向过程,即前一条语句与后一条语句无关。
PL/SQL,Oracle对SQL标准的扩充,增加了面向过程的功能,所以可以用来编写存储过程、存储函数、触发器等等。
解释2:pl/sql被称为块结构化语言,pl/sql块是pl/sql语言基本单位,其中可能包含程序代码,变量声明,异常处理,过程,函数甚至包含其他的pl/sql块。是sql的扩充
解释3:SQL是结构化查询语言,是标准的,PL/SQL是oracle的扩展,在标准SQL中加入了IF...ELSE... For....等控制过程的SQL
解释4:SQL是一种访问关系数据库的结构化查询语言.SQL是第四代语言(4GL).这意味着它描述的是应该做什么,而不是怎么做.
第三代语言(3GL),如C,COBOL,在本质上就更过程化.它们在解决问题时实现的是一步接一步的是算法.
PL/SQL相当于将SQL(4GL)的强大和灵活和3GL的过程性结构相结合.
PL/SQL是Procedural Language/SQL的缩写,它通过增加了用在其他过程性语言中的结构来对SQL进行了扩展.