Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between Script, Stored Procedure, T-SQL, PL/SQL [closed]

I'm getting really confused with all these terms. I used to attend a class called PL/SQL, then when I came out to work, I came across other terms like Stored Procedure, T-SQL and even script. They all look very similar to me, but exactly what are the differences between each of them? (if any)

like image 714
C.J. Avatar asked Dec 04 '22 06:12

C.J.


2 Answers

Here's some rough definitions to explain the differences.

  • PL/SQL - a SQL variation specific to Oracle databases.
  • T-SQL (Transact-SQL) - a SQL variation specific to Microsoft (and Sybase) databases.
  • Stored Procedure - a set of SQL commands that is precompiled and stored on the server for reuse
  • Script - a set of SQL commands that is run ad-hoc (not precompiled / not meant for reuse)

There are more differences between Stored Procedures and Scripts (e.g. sprocs can have parameters, etc.) but that's the fundamental difference.

like image 108
D Stanley Avatar answered Dec 11 '22 12:12

D Stanley


T-SQL is Microsoft's version of SQL. PL/SQL is Oracle's version of SQL. Both are ANSI SQL compliant, but contain additional capabilities that are not in the standard.

A Stored Procedure is a prepared SQL statement that is stored on the database server, and can be reused by calling it.

Script is basically code, but scripts are typically small, standalone programs that operate without the aid of a GUI. A Stored Procedure could properly be called a script.

like image 22
Robert Harvey Avatar answered Dec 11 '22 11:12

Robert Harvey