Using operator value in pl sql, PL-SQL Programming

Using Operator VALUE:

As you may expect, the operator VALUE returns the value of an object. The VALUE takes its argument a correlation variable.  For illustration, to return a result set of the Person objects, you can use the VALUE as shown below:

BEGIN

INSERT INTO employees

SELECT VALUE(p) FROM persons p

WHERE p.last_name LIKE '%Smith';

In the next example, you use VALUE to return a specific Person object:

DECLARE

p1 Person;

p2 Person;

...

BEGIN

SELECT VALUE(p) INTO p1 FROM persons p

WHERE p.last_name = 'Kroll';

p2 := p1;

...

END;

At this position, p1 holds a local Person object, that is a copy of the stored object whose last name is 'Kroll', and p2 holds the other local Person object, that is a copy of p1. As the illustration below shows, you can use these variables to access and update the objects they have:

BEGIN

p1.last_name := p1.last_name || 'Jr';

Currently, the local Person object held by p1 has the last name 'Kroll Jr'.

Posted Date: 10/6/2012 8:18:46 AM | Location : United States







Related Discussions:- Using operator value in pl sql, Assignment Help, Ask Question on Using operator value in pl sql, Get Answer, Expert's Help, Using operator value in pl sql Discussions

Write discussion on Using operator value in pl sql
Your posts are moderated
Related Questions
Packaging Cursors   You can split a cursor specification from its body for placement in a package. In that way, you can change the cursor body without changing the cursor spec

Deleting Objects You can use the DELETE statement to eradicate objects from an object table. To eradicate objects selectively, you use the WHERE clause, as shown below: BEG

Providing Results of Queries Expressing queries in SQL is the (big) subject. Here I present just a simple example to give you the flavour of things to come in those chapters.

Use Object Types and Collections The Collection types and object types increase your efficiency by allowing for the realistic data modeling. The Complex real-world entities an

Primary Key - SQL A PRIMARY KEY specification carries an implicit NOT NULL constraint on each column of the specified key. When more than one key constraint is required, the k

FETCH Statement The FETCH statement retrieve rows of data one at a time from the result set of the multi-row query. The data is stored in fields or variables which correspond t

Components of an Object Type: An object type encapsulates the operations and data. Therefore, you can declare the methods and attributes in an object type specification, but no

%ISOPEN The %ISOPEN yields TRUE if its cursor or cursor variable is open; or else, the %ISOPEN yields FALSE. In the illustration, you use the %ISOPEN to select an action:

Ensuring Backward Compatibility   The PL/SQL Version 2 permits some abnormal behavior which Version 8 disallows. Particularly, Version 2 permits you to (i) Make the forw

DECLARE : This keyword signals the beginning of the declarative section of the PL/SQL block, that contains local declarations. The Items declared locally exist only within the