Pratik Somaiya
You need to work on a migration project from on-premises Oracle to Azure, Oracle DB is written in PL-SQL and in Azure it follows T-SQL. What are basic differences between T-SQL and PL-SQL?
By Pratik Somaiya in SQL on Jan 31 2024
  • Jayraj Chhaya
    Feb, 2024 1

    T-SQL and PL-SQL are both dialects of SQL (Structured Query Language) used in different database systems. While they share similarities, there are some key differences between the two:

    Syntax: T-SQL and PL-SQL have different syntax structures. PL-SQL follows a block structure, where code is enclosed within BEGIN and END keywords. T-SQL, on the other hand, uses a more procedural approach with statements executed sequentially.

    Data Types: T-SQL and PL-SQL have some common data types like VARCHAR and INTEGER, but they also have their own specific data types. For example, T-SQL has the MONEY data type, while PL-SQL has the BOOLEAN data type.

    Exception Handling: PL-SQL has robust exception handling mechanisms, allowing developers to catch and handle specific errors. T-SQL, on the other hand, relies more on the TRY-CATCH construct for error handling.

    Built-in Functions: Both T-SQL and PL-SQL have a wide range of built-in functions, but the specific functions and their syntax may differ. For example, T-SQL uses the GETDATE() function to retrieve the current date and time, while PL-SQL uses SYSDATE.

    Procedural Constructs: PL-SQL is a procedural language, meaning it supports constructs like loops, conditional statements, and variables. T-SQL, while not a full procedural language, has some procedural constructs like IF-ELSE statements and WHILE loops.

    System Objects: T-SQL and PL-SQL have their own system objects and functions specific to their respective database systems. For example, T-SQL has system views like sys.tables and sys.columns in SQL Server, while PL-SQL has system views like USER_TABLES and USER_TAB_COLUMNS in Oracle.

    When migrating from PL-SQL to T-SQL, it is important to understand these differences and make the necessary adjustments to ensure a smooth transition. This may involve rewriting queries, modifying exception handling, and adapting to the specific features and functions of T-SQL in Azure.

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS