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
Constants and Variables:   You can declare the constants and variables in the declarative section of any PL/SQL subprogram, block, or package. The Declarations allot the stor

Recursion The Recursion is a powerful method for simplify the design of the algorithms. Principally, the recursion means the self-reference. In the recursive mathematical serie

CURRVAL and NEXTVAL The series is a schema object which generates the sequential numbers. Whenever you form a sequence, you can specify its primary value and an increment. T

Project Description: I want to write some SQL statements. The things I need are between pages 5-7. The only problem is that i want it till tomorrow. Skills required is SQL

Keyword &Parameter Description: index_name: This is an undeclared identifier which can be referenced only within the FORALL statement and only as the collection subscript

Example of Table Literal - SQL Example: A Table Literal (correct version) VALUES ('S1', 'C1', 'Anne'), ('S1', 'C2', 'Anne'), ('S2', 'C1', 'Boris'), ('S3', 'C3'

Using ROLLBACK The ROLLBACK statements end the present transaction and undo any change made during the transaction. The Rolling back is helpful for two reasons. Firstly, if yo

Using Savepoints The scope of the savepoint is a transaction in which it is defined. The Savepoints defined in the major transaction are not related to the savepoints defined

Manipulating Individual Elements Faraway you have manipulated an entire collection. Within the SQL, to manipulate the individual elements of the collection, and then use the ope

Using %TYPE The %TYPE attribute gives the datatype of a variable or the database column. In the example below, the %TYPE gives the datatype of a variable: credit REAL(7,2); debi