Programming T-SQL, PL/SQL Comparison

 
Operation T-SQL PL/SQL
Scope of variables Variables visible only within batch or procedure. Batch is separated with keyword GO
Declare variables /* Variables get assigned default value of NULL. Must have @ as the first character. */ DECLARE @local varchar(30) DECLARE @another_local int = 10
Setting variables SET @local = 'Test' SELECT @another_local = 5 SELECT @local = ID from [dbo].[Test]
Display variable SELECT @local PRINT @local

Leave a Reply