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:

BEGIN

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:

DECLARE

p_ref REF Person;

taxpayer_id VARCHAR2(9);

BEGIN

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

FROM persons p

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

...

END;

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

DECLARE

p_ref REF Person;

my_last_name VARCHAR2(15);

...

BEGIN

...

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;

END;

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
Logical Connectives - SQL SQL's extended truth tables in which the symbol, for unknown, appears along with the usual T and F. Negation (NOT, ¬) Conjunction (

Functions The function is a subprogram which can take parameters and be invoked. Normally, you can use a function to calculate a value. The function has 2 sections: the specifi

heap sort program in pl/sql

Example of NOT EXISTS in SQL Example: Use of NOT EXISTS CREATE ASSERTION Must_be_enrolled_to_take_exam_alternative1 CHECK ( NOT EXISTS (SELECT StudentId, CourseId

Albeit simple method : These all the truth tables give us our first as albeit simple method for proving a theorem: where check whether it can be written in propositional logic

Semidifference via EXCEPT and JOIN - SQL SELECT * FROM (SELECT StudentId FROM IS_CALLED WHERE Name = 'Devinder' EXCEPT DISTINCT CORRESPONDING SELECT StudentId

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

Updating by insertion Syntax : INSERT INTO ENROLMENT VALUES (SID ('S4'), 'Devinder', CID ('C1'));

Example of Using Aggregation on Nested Tables Example: How many students sat each exam WITH C_ER AS (SELECT CourseId, CAST (TABLE (SELECT DISTINCT StudentId, Mark FROM EXAM

Character Types The Character types allow you to store alphanumeric data, represent words and text, and manipulate the character strings. CHAR You use the CHAR dataty