All IT Courses 50% Off
QA Tutorials

PL SQL and T- SQL

SQL – Structured Query Language is a standard language for querying a database. PL SQL is called as Procedural language extension to SQL. T-SQL stands for Transact SQL. This is the extension of structured query language. T-SQL was originally developed by Sybase and now it is taken by Microsoft. T-SQL adds some advanced features to SQL to make it more powerful like declared variables, transaction variables and exception handling. These additions make T-SQL more complete which specifies the universality of a computing language.

PL SQL is an extension created by Oracle to have the benefits of looping, functions, variables. PL SQL block has three sections.

PL SQL and T- SQL
  • Declare
  • Begin
  • Exception

Declare section:

Declare section is an optional section where we can declare the variables. 

Begin section:

Begin is the section where all the SQL commands are written.

Exception section:

Exception block: if some error encounters in the earlier statements it is managed or handled in this block. Finally the project is finished by End statement.

For example

PL SQL and T- SQL

Procedures:

It is a named block of statement. It may or may not return the value.

Syntax:

Create PROCEDURE procedure name [parameter name [IN|OUT|INOUT]type[…,])]{IS|AS}
BEGIN
<procedure body>
End Procedure_name;

T-SQL uses some transactions which ensure data consistency.

Data types: In these sections there is lot of classification like numerics, Date and time, Character strings and Unicode character strings and binary strings.

  • Numerics data types like BigInt and Int,smallInt ,decimal,Bit. 
  • Date and Time has Date ,Time,datetime2 etc.
  • Character strings has Char, varchar.
  • Unicode character strings has Nchar,Nvarchar
  • Binary strings has Binary, Varbinary and image.

T-SQL Transactions:

Is a set of T-sql statements which executes together as a unit like we have

  • COMMIT statement to save the changes.
  • ROLL BACK statement to undo the changes before saving.
  • SAVEPOINT statement splits the complete transaction in smaller parts for ROLL BACK.
  • @@ TRANCOUNT counts the number of transactions for sql.

Difference between PL SQL and T-SQL

PL SQLT-SQL
PL SQL was developed by Oracle.T-sql was developed by Microsoft.
It is a natural programming which is compatible with the sql and also provides better functionality.it provides highest degree of control to the programmers
PL sql is good with its performance with oracle database serverT-sql is good with the performance with Microsoft sql server.
It is complex to understand and Useit is much simpler and easy to Use
There is a AUTOCOMMIT Command which saves transactions automatically.There is no AUTOCOMMIT command all transactions are saved manually.
here INSERT INTO statement must be used.here SELECT INTO statement must be used.
PL sql provides OOPs concepts like data-encapsulation, function overriding etcThis allows inserting multiple rows into table using BULK INSERT statement.

Facebook Comments

5 Comments

  1. SQL – Structured Query Language is a standard language for querying a database. PL SQL is called as Procedural language extension to SQL. T-SQL stands for Transact SQL. This is the extension of structured query language. T-SQL was originally developed by Sybase and now it is taken by Microsoft. T-SQL adds some advanced features to SQL to make it more powerful like declared variables, transaction variables and exception handling. These additions make T-SQL more complete which specifies the universality of a computing language.
    PL SQL was developed by Oracle. It is a natural programming which is compatible with the sql and also provides better functionality. PL sql is good with its performance with oracle database server. It is complex to understand and Use

    T-sql was developed by Microsoft. it provides highest degree of control to the programmers. T-sql is good with the performance with Microsoft sql server. it is much simpler and easy to Use.

  2. SQL is a standard language for querying a database. PL SQL is called as Procedural language extension to SQL. T-SQL stands for Transact SQL. This is the extension of SQL. T-SQL adds some advanced features to SQL to make it more powerful like declared variables, transaction variables and exception handling. These additions make T-SQL more complete.PL SQL is an extension created by Oracle to have the benefits of looping, functions, variables. PL SQL block has three sections which are Declare, Begin and Exception.
    Data types:
    *Numerics data types like BigInt and Int,smallInt ,decimal,Bit.
    *Date and Time has Date ,Time,datetime2 etc.
    *Character strings has Char, varchar.
    *Unicode character strings has Nchar,Nvarchar
    *Binary strings has Binary, Varbinary and image.
    T-SQL Transactions:
    *COMMIT statement to save the changes.
    *ROLL BACK statement to undo the changes before saving.
    *SAVEPOINT statement splits the complete transaction in smaller parts for ROLL BACK.
    *@@ TRANCOUNT counts the number of transactions for sql.

  3. PL SQL is called as Procedural language extension to SQL. T-SQL stands for Transact SQL. This is the extension of structured query language. T-SQL was developed by Microsoft whereas PL SQL was developed by Oracle. T-SQL adds some advanced features to SQL to make it more powerful like declared variables, transaction variables and exception handling. PL SQL has the advanced features like looping, functions, variables. PL SQL block has three sections.
    1. Declare
    2. Begin
    3. Exception

    T-SQL Transactions:
    1.COMMIT statement to save the changes.
    2.ROLL BACK statement to undo the changes before saving.
    3.SAVEPOINT statement splits the complete transaction in smaller parts for ROLL BACK.
    4.@@ TRANCOUNT counts the number of transactions for sql.

  4. SQL – Structured Query Language is a standard language for querying a database. PL SQL is called as Procedural language extension to SQL. T-SQL stands for Transact SQL. This is the extension of structured query language. T-SQL adds some advanced features to SQL to make it more powerful like declared variables, transaction variables and exception handling. These additions make T-SQL more complete which specifies the universality of a computing language.

    PL SQL is an extension created by Oracle to have the benefits of looping, functions, variables. PL SQL block has three sections.
    1. Declare
    2. Begin
    3. Exception

    Some of the differences between PL-SQL and T-SQL are:
    1)PL SQL was developed by Oracle. T-sql was developed by Microsoft.
    2)PL SQL is a natural programming which is compatible with the sql and also provides better functionality. T-SQL provides highest degree of control to the programmers
    3)PL SQL is good with its performance with oracle database server. T-sql is good with the performance with Microsoft sql server.
    4)PL SQL is complex to understand and Use. T-SQL is much simpler and easy to Use.

  5. SQL – Structured Query Language – a standard language for querying a database.
    PL SQL – Procedural language – extension to SQL.
    T-SQL – Transact SQL – the extension of structured query language.

    PL SQL is an extension created to have the benefits of looping, functions, variables.
    T-SQL uses some transactions which ensure data consistency. It adds some advanced features to SQL to make it more powerful like declared variables, transaction variables and exception handling.

    To sum up on PL SQL and T-SQL
    PL SQL:
    – Developed by Oracle.
    – Natural programming, compatible with the SQL and also provides better functionality.
    – Good with its performance with oracle database server
    – Complex to understand and Use
    – AUTOCOMMIT Command which saves transactions automatically.
    – “INSERT INTO” statement must be used.
    – Provides OOPs concepts like data-encapsulation, function overriding etc

    T-SQL
    – Developed by Microsoft.
    – Provides highest degree of control to the programmers
    – Good with the performance with Microsoft sql server.
    – Much simpler and easy to Use
    – NO AUTOCOMMIT command all transactions are saved manually.
    – “SELECT INTO” statement must be used.
    – Inserting multiple rows into table using BULK INSERT statement.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Related Articles

Back to top button
Close
Close