Using default-declarations in sql, PL-SQL Programming


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
Description: Demonstrate your knowledge of PL/SQL programming by writing and thoroughly testing triggers and stored procedures associated with an e-commerce application that pr

Assignment Statement: The assignment statement sets the present value of the variable, parameter, field, or element. The statement consists of an assignment target followed by

Define basic operators of relational algebra with an example each

a. Write an anonymous block that contains a PL/SQL function. Given an order number orderNo, the function will calculate the total number of the parts in the order. Then the anonym

Row Operators The Row operators return or reference the particular rows. ALL retains the duplicate rows in the result of a query or in an aggregate expression. The DISTINCT el

Create the four tables and populate them with the given data. Answer the following queries in SQL. 1. Get all part-color/part-city combinations. Note: Here and subsequently, the

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

Implicit Cursors The Oracle implicitly opens a cursor to process each SQL statement not related with an explicitly declared cursor. The PL/SQL lets you refer to the most recen

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

Loop Labels Like the PL/SQL blocks, loops can also be labeled. The label, an undeclared identifier enclosed by double angle brackets, should appear at the beginning of the LOOP