T-SQL vs. PL-SQL

T-SQL
TSQL is a proprietary procedural language used by Microsoft in SQL Server.

PL-SQL
PL/SQL is a proprietary procedural language used by Oracle

Microsoft’s T-SQL is similar to Oracle’s PL-SQL to some extent, sharing with some basic difference as below

  • Difference in data type, There are many different data type. Sharing few as below …
T-SQL PL-SQL
Integer, SmallInt etc Number
Varchar Varchar2
DATETIME, SMALL-DATETIME Date

 

  • The default date format of PL-SQL does not include time part.
  • In T-SQL, there is no need of dual.
    • Example:
      • T-SQL Syntax will look like: select getdate()
      • PL-SQL will look like: select sysdate from dual
  • In T-SQL there is an IDENTITY function on the other hand SEQUENCE in PL-SQL.
  • In the T-SQL have to use NOT EXISTS clause in Select statement on the other hand in PL-SQL there is MINUS operator.
  • SQL Server can have multiple databases on an Instance but Oracle cannot have multiple databases on an Instance.
  • T-SQL’s RAISEERROR throws an exception on other hand raise_application_error in PL-SQL.
  • In T-SQL, stored procedure do not rollback automatically if something fails. You can use TRY CATCH but still the roll back is optional. In PL-SQL, stored procedures are atomic. Any error inside a stored procedure rolls back up to the point where the stored procedure was called.