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
Effects of NULL in Table Literal When a VALUES expression appears as the source value for an SQL INSERT statement, the key word NULL can appear as a field value, such that for

Demonstrate your knowledge of PL/SQL programming by writing and thoroughly testing triggers and stored procedures associated with an e-commerce application that provides security l

Package Body: The package specification is implemented by the package body. That is, the package body has the definition of every cursor and the subprogram declared in the pac

Write a pl/sql block that declares and uses cursors with parameters. In a loop, use a cursor to retrieve the department number and the department name from the departments table

PITS Depressions in secondary cell wall is called pit. A pit present on the free cell wall surface without its partner is called Blind pit. It consists of 2 parts -

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

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

LOB Types The large object (LOB) datatypes like BFILE, BLOB, CLOB, and NCLOB store the blocks of unstructured data (like graphic images, text, video clips, and sound waveforms)

set serveroutput on declare a number(5); b number(5); c number(5); begin a:=&a; b:=&b; c:=a/b; dbms_output.put_line(c); exception when zero_divide then d

IF Statement The IF statement executes a series of statement conditionally. Whether the series is executed or not depends on the value of the Boolean expression. Syntax: