Using operator value in pl sql, PL-SQL Programming

Assignment Help:

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'.


Related Discussions:- Using operator value in pl sql

Calling constructors in pl sql, Calling Constructors: The Calls to a c...

Calling Constructors: The Calls to a constructor are allowed wherever the function calls are allowed. Similarly to the functions, a constructor is called as a section of an ex

Out mode - parameter modes, OUT Mode An OUT parameter returns values t...

OUT Mode An OUT parameter returns values to the caller of a subprogram. Within the subprogram, an OUT parameter act like a variable. That means that you can use an OUT formal

What is a record, What Is a Record  ? A record is a group of related...

What Is a Record  ? A record is a group of related data items that stored in the fields, each with its own name and datatype. Assume that you have different data about an em

Closest approximation to relational union - sql, Closest Approximation to R...

Closest Approximation to Relational Union - SQL Actually, just as SQL has several varieties of JOIN, it also has several varieties of UNION, none of which is equivalent to th

EXCEPTION handling, set serveroutput on declare a number(5); b numb...

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

Parameter and keyword description - fetch statement, Parameter and Keyword ...

Parameter and Keyword Description: cursor_name: This identifies an explicit cursor formerly declared within the present scope. cursor_variable_name: These identif

Overview of control structures-comparison operators, Overview of control st...

Overview of control structures According to the structure theorem, any computer program can be written by using the basic control structures as shown in figure below. They can b

Sql, Write a cursor to open an employee database and fetch the employee rec...

Write a cursor to open an employee database and fetch the employee record whose age is greater than 45

Effects of null in aggregate operator - sql, Effects of NULL in Aggregate O...

Effects of NULL in Aggregate Operator - SQL Let aggop(x) be an invocation of some aggregate operator aggop in SQL, where x is an expression (usually an open expression) to be

Using exception_init - user-defined exceptions, Using EXCEPTION_INIT T...

Using EXCEPTION_INIT To handle unnamed internal exceptions, you should use the OTHERS handler or the pragma EXCEPTION_INIT. The pragma is a compiler directive that can be th

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd