Initializing records, PL-SQL Programming

Initializing Records

The illustration below shows that you can initialize a record in its type definition. Whenever you declare a record of the type TimeRec, its 3 fields suppose an initial value of zero.

DECLARE

TYPE TimeRec IS RECORD (

secs SMALLINT := 0,

mins SMALLINT := 0,

hrs SMALLINT := 0);

The illustration later shows that you can impose the NOT NULL constraint on any field, and so avoid the assigning of nulls to that field. The Fields declared as NOT NULL should be initialized.

DECLARE

TYPE StockItem IS RECORD (

item_no INTEGER(3) NOT NULL := 999,

description VARCHAR2(50),

quantity INTEGER,

price REAL(7,2));

Posted Date: 10/4/2012 3:37:11 AM | Location : United States







Related Discussions:- Initializing records, Assignment Help, Ask Question on Initializing records, Get Answer, Expert's Help, Initializing records Discussions

Write discussion on Initializing records
Your posts are moderated
Related Questions
Methods: In normal, a method is a subprogram declared in an object type specification using the keyword MEMBER or STATIC. The method cannot have similar name as the object typ

Records Records are the items of the type RECORD. The Records have exclusively named fields that can store the data values of various types. And hence, a record treat associate

Using SET TRANSACTION You use the SET TRANSACTION statement to begin the read-only or read-write transaction, start an isolation level, or assign your present transaction to a

Positional and Named Notation You can write the actual parameters when calling a subprogram, using either positional or named notation. That is, you can point to the relationsh

Collections:   The collection is an ordered group of elements, all of similar type (for illustration, the grades for a class of students). Each element has an exclusive subsc

Exceptions An exception is the runtime error or warning condition that can be predefined or user-defined. The Predefined exceptions are raised implicitly through runtime system

Use the PLS_INTEGER Datatype When you require to declare an integer variable, use the datatype PLS_INTEGER that is the most efficient numeric type. That is as the PLS_INTEGER

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

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

Question: a) Given the following relation: Location(loc_id, bldg_code, room, capacity) The underlined field is a primary key. (i) Write a PL/SQL program using the impl