Variable declaration - sql, PL-SQL Programming

Variable Declaration - SQL

SQL's support for variables is very similar to Tutorial D's, except that the syntax for creating persistent  variables-base tables-is quite different from that used to declare local variables. Example is SQL's counterpart of that example in the theory book but, as you know, CREATE TABLE is used for base tables.

Example: A Variable Declaration

DECLARE SN SID DEFAULT SID ('S1');

DECLARE in place of VAR and DEFAULT in place of INIT. The effect is exactly the same apart from the fact that, as already noted, SQL's type SID (here assumed to be a distinct type). The key word DEFAULT is perhaps a strange choice as that word normally suggests action to be taken by the system when no specific action is explicitly demanded by the user. Here it is used to state explicitly an immediate assignment to the variable being declared.

Posted Date: 1/18/2013 2:42:10 AM | Location : United States







Related Discussions:- Variable declaration - sql, Assignment Help, Ask Question on Variable declaration - sql, Get Answer, Expert's Help, Variable declaration - sql Discussions

Write discussion on Variable declaration - sql
Your posts are moderated
Related Questions
BIOCHE M ICA L ORIGIN OF LIFE - It is generally agreed by astronomers, geologists and biologists that the earth is approximately 4500-5000 million years old. It is an

Updating by insertion Syntax : INSERT INTO ENROLMENT VALUES (SID ('S4'), 'Devinder', CID ('C1'));

Package STANDARD package named STANDARD defines the PL/SQL atmosphere. The package specification globally declares the exceptions, types, and subprograms that are available a

Using INNER JOIN INNER JOIN is used to retrieve the data from all tables listed based on a condition of equality listed after keyword ON. If the condition is not meet, rows ar

The SQL ‘CREATE TABLE' scripts for all the tables you have implemented. Note that your tables must correspond exactly to the ERD you have provided in 1. above, or you will lose ma

THEO R Y OF ETERNITY OF LIFE (PRAYER - 1880) - The theory of eternity of life, also called the steady-state theory , states that life has ever been in existence as at presen

Using EXCEPTION_INIT To handle unnamed internal exceptions, you should use the OTHERS handler or the pragma EXCEPTION_INIT. The pragma is a compiler directive that can be th

Advantages of Invoker Rights The Invoker-rights routines centralize the data retrieval. They are particularly helpful in applications which store data in various schemas. In su

MERGE and TRUNCATE in SQL SQL has two more table update operators, MERGE and TRUNCATE. MERGE, like INSERT, takes a source table s and uses it to update a target table t. Brief

Pass the nulls to a dynamic SQL: Passing Nulls: Assume that you want to pass the nulls to a dynamic SQL statement. For illustration, you may write the EXECUTE IMMEDIATE