top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What is the difference between a local and a global variable?

+2 votes
708 views

Hai, friends tell me the difference between a local and a global variable

posted Nov 13, 2014 by Roshan

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

2 Answers

+2 votes

Local Variable-A Local temporary table exists only for the duration of a connection or, if defined inside a compound statement, for the duration of the compound statement.
Global Variable-A Global temporary table remains in the database permanently, but the rows exist only within a given connection. When connection are closed, the data in the global temporary table disappears. However, the table definition remains with the database for access when database is opened next time.

answer Nov 13, 2014 by Manikandan J
0 votes

A variable which can be accessed from anywhere of the program is known as global variable, while the variable which has limited and can be accessed within the a block i.e. { } or function is known as local variable. Global variable is always defined without using any { }.

answer Nov 13, 2014 by Vikram Singh
...