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
Parameter and Keyword Description: procedure_name The user-defined procedure is declared by this construct. parameter_name: This identifies the formal parameter t

Many of the reports generated from the system calculate the total dollars in purchases for a shopper. Complete the following steps to create a function named TOT_PURCH_SF that acce

Example of Check Constraints Example: Workaround for when subqueries not permitted in CHECK constraints CREATE FUNCTION NO_MORE_THAN_20000_ENROLMENTS ( ) RETURNS BOOLEAN

ROWID and UROWID Internally, every database table has a ROWID pseudo column that stores binary values known as rowids. Each rowid shows the storage address of a row. A physical

Create a view named CustomerAddresses that shows the shipping and billing addresses for each customer in the MyGuitarShop database. This view should return these columns from the

Operators on Tables and Rows Row Extraction TUPLE FROM r, SQL has row subqueries. These are just like scalar subqueries except that they may specify more than one column.

Question 1. Update stock levels when the order is cancelled At times, customers make mistakes in submitting their orders and call to cancel the order. Brewbean’s wants to create a

Manipulating Collections Within PL/SQL, the collections add procedural power and flexibility. The biggest benefit is that your program can compute subscripts to process the spec

Example of Alternative formulation as a table constraint Example: Alternative formulation as a table constraint ALTER TABLE EXAM_MARK ADD CONSTRAINT Must_be_enrolled_to_

Using a join on 2 tables, select all columns and 10 rows from the 2 tables without the use of a Cartesian product. Query: SELECT * FROM EMPLOYEE1 E JOIN STAFF S ON E.EMP_