Using operator ref - manipulating objects pl sql, PL-SQL Programming

Using Operator REF:

You can retrieve refs by using the operator REF that, like VALUE, takes as its argument a correlation variable. In the illustration below, you retrieve one or more refs to the Person objects, then insert the refs into the table person_refs:


INSERT INTO person_refs

SELECT REF(p) FROM persons p

WHERE p.last_name LIKE '%Smith';

In the later illustration, you retrieve a ref and attribute at similar time:


p_ref REF Person;

taxpayer_id VARCHAR2(9);


SELECT REF(p), p.ss_number INTO p_ref, taxpayer_id

FROM persons p

WHERE p.last_name = 'Parker'; -- must return one row



In the final illustration, you update the attributes of a Person object:


p_ref REF Person;

my_last_name VARCHAR2(15);




SELECT REF(p) INTO p_ref FROM persons p

WHERE p.last_name = my_last_name;

UPDATE persons p

SET p = Person('Jill', 'Anders', '11-NOV-67', ...)

WHERE REF(p) = p_ref;


Posted Date: 10/6/2012 8:20:37 AM | Location : United States

Related Discussions:- Using operator ref - manipulating objects pl sql, Assignment Help, Ask Question on Using operator ref - manipulating objects pl sql, Get Answer, Expert's Help, Using operator ref - manipulating objects pl sql Discussions

Write discussion on Using operator ref - manipulating objects pl sql
Your posts are moderated
Related Questions
Comparison Operators The Comparison operators can compare one expression to another. The outcome is always true, false, or null. Usually, you use a comparison operators in condi

Transactions in SQL BEGIN TRANSACTION, COMMIT, and ROLLBACK, SQL has the same syntax except for START in place of BEGIN. However, START TRANSACTION is used only for outermost

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

What is Cursors how to use it in Real time application ?

Declaring Subprograms   You can declare subprograms in any PL/SQL subprogram, block, or package. But, you should declare subprograms at the end of the declarative part after a

Avoiding Collection Exceptions   In many cases, if you reference a nonexistent collection element, then PL/SQL raises a predefined exception. Consider the illustration shown b

Referencing Records Unlike the elements in a collection, that are accessed using subscripts, the fields in a record are accessed by name. To reference an individual field, you

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

Using Savepoints The scope of the savepoint is a transaction in which it is defined. The Savepoints defined in the major transaction are not related to the savepoints defined

Committing and Rolling Back The COMMIT and ROLLBACK end the active autonomous transaction but do not exit the autonomous routine. As the figure shows, if one transaction ends,