PL SQL vs. T SQL

Difference Between PL SQL and T SQL

T-SQL (Transact SQL) is SQL’s extension developed by Microsoft. T-SQL is used in Microsoft SQL Server. PL / SQL (Structured Query Language / Procedural Language) is an extension of SQL procedure developed by Oracle. PL / SQL is the core programming language set in the Oracle database.

PL / SQL

PL / SQL is an extension of SQL procedure developed by Oracle. PL/SQL programs are built up of the basic units known as blocks. PL / SQL provides support for variables, loops (WHILE loops, FOR loops, and cursor FOR loops), conditional statements, arrays and exceptions. A PL / SQL program has SQL statements. These statements include DELETE, INSERT, and SELECT & UPDATE etc. SQL statements such as CREATE, ALTER or DROP are not allowed in PL / SQL programs. PL/SQL functions can contain PL / SQL and SQL statements and they return a value. PL/SQL procedures cannot have SQL statements and they do not return a value. PL / SQL also supports an object oriented programming concepts such as encapsulation, information hiding and function overloading. But it does not support inheritance. In PL / SQL packages can be used for procedures, group functions variables, etc. The packages can reuse of codes. The use of the code of PL / SQL on the Oracle server would enhance performance, since the Oracle server pre-compiles the code of PL / SQL before executing it.
T-SQL

T-SQL is SQL’s extension developed by Microsoft. T-SQL extends SQL by adding several features such as programming procedure, local variables and support functions for string / processing of information and data. These features make T-SQL Turing complete. Any application that needs to communicate with Microsoft SQL Server should send a statement T-SQL in Microsoft SQL Server. T-SQL provides flow control by using the following keywords: IF and ELSE, WHILE, RETURN, BEGIN and END, CONTINUE, WAITFOR, BREAK, and GOTO. In addition, it also allows addition of FROM clause to DELETE and UPDATE statements. FROM clause allows insertion of joins to DELETE and UPDATE statements. T-SQL also allows for insertion into multiple rows of a table using BULK INSERT statement. This will insert multiple rows in a table while reading an external file containing the data. Use of the BULK INSERT increases the performance and is better than making use of indicidual INSERT statements for each row that needs to be inserted.

What is the difference between PL / SQL and T-SQL?

PL / SQL procedural addition of the SQL made available by Oracle and is used with Oracle database server, while T-SQL SQL is an extension that was developed by the company Microsoft and is used primarily with Microsoft SQL Server. There are some differences between data types in PL / SQL and T-SQL. For example T-SQL has two types of data called SMALL-DATETIME and DATETIME, while PL / SQL has a simple data type called DATE. In addition, for the functionality of the function DECODE is used in PL / SQL, while CASE statement must be used in T-SQL. Also, in place of SELECT INTO statement in T-SQL, the INSERT INTO statement must be used within PL / SQL. In PL / SQL, there is MINUS operator, which could be used with SELECT statements. In T-SQL the same results can be obtained by using the NOT EXISTS clause with the SELECT statements.

 

 

Category: VS  |  Tags: