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
Manipulating Local Collections Within PL/SQL, to manipulate the local collection, by using theĀ  TABLE and CAST operators . The operands of CAST are a collection declared locally

Selecting Objects: Suppose that you have run the SQL*Plus script below that creates object type Person and object table persons, and that you have settled the table: CREATE

Scope and Visibility The References to an identifier are resolved according to its visibility and scope. The scope of an identifier is that area of a program unit (subprogram, b

Semidifference via NOT IN and a subquery SELECT StudentId FROM IS_CALLED WHERE Name = 'Devinder' AND StudentId NOT IN (SELECT StudentId FROM IS_ENROLLED_ON WHER

Explicit Cursors The set of rows returned by the query can include zero, one, or multiple rows, depending on how many rows meet your search criteria. Whenever a query returns

Using FORALL and BULK COLLECT Together You can unite the BULK COLLECT clause with the FORALL statement, in that case, the SQL engine bulk-binds column values incrementally. In

Datatype Conversion At times it is necessary to convert a value from one datatype to another. For e.g. if you want to inspect a rowid, you should convert it to a character stri

Perform the following queries on the Hospital1.DB using SQL Anywhere (START EARLY!). a. Which patients have purchased the drug "Tylenol"? List the names and addresses. Arrange the

Using Host Arrays The Client-side programs can use anonymous PL/SQL blocks to bulk-bind input and output host arrays. However, this is the well-organized way to pass the colle

Effects of NULL for Table Expression Here's an important distinction between expressions denoting tables and expressions denoting multisets of rows: a table expression cannot