Using default-declarations in sql, PL-SQL Programming

Using DEFAULT

You can use the keyword DEFAULT rather than that of the assignment operator to initialize the variables. For e.g. the declaration
blood_type CHAR := ’O’;

it can be rewrite as follows:

blood_type CHAR DEFAULT ’O’;

Use DEFAULT for the variables that have a typical value. Use the assignment operator for the variables (like counters & accumulators) which have no typical value. Some of the examples are shown below:

hours_worked INTEGER DEFAULT 40;
employee_count INTEGER := 0;

You can also use DEFAULT to initialize the cursor parameters, subprogram parameters,  and fields in a user-defined record.

Posted Date: 10/3/2012 4:35:09 AM | Location : United States







Related Discussions:- Using default-declarations in sql, Assignment Help, Ask Question on Using default-declarations in sql, Get Answer, Expert's Help, Using default-declarations in sql Discussions

Write discussion on Using default-declarations in sql
Your posts are moderated
Related Questions
%ROWTYPE: This attribute gives a record type which represents a row in the database table or a row fetched from a formerly declared cursor. The Fields in the record and corresp

Query: SELECT * FROM EMPLOYEE1; Select 5 columns and all rows from one table Query: SELECT C_ID, COMPANY, BUILDING, DEPARTMENT, BRANCH FROM CONTRACT;

Bulk Binds advantages In the Embedded Oracle RDBMS, the PL/SQL engines accept any valid PL/SQL subprogram or block. As the figure shows, the PL/SQL engine executes all procedur

Using Cursor Attributes To process the SQL data manipulation statements, the SQL engine must opens an implicit cursor named SQL. This cursor's attributes (%FOUND, %NOTFOUND, %

Object Types An object type is a user-defined complex datatype which encapsulates the data structure along with the functions and procedures required to manipulate the data. Th

Transaction Control The Oracle is transaction oriented; that is, Oracle uses the transactions to make sure the data integrity. The transaction is a sequence of SQL data manip

Using Operator REF: You can retrieve refs by using the operator REF that, like VALUE, takes as its argument a correlation variable. In the illustration below, you retrieve one

Parameter and Keyword Description: select_item: This select_item is a value returned by the SELECT statement, and then assigned to the equivalent variable or field in the

What is Cursors how to use it in Real time application ?

Subprograms The PL/SQL has two types of subprograms known as the procedures and functions that can take parameters and be invoked. As the following example represents, a subp