Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: assigning nulls to records

Re: assigning nulls to records

From: Daniel Morgan <damorgan_at_x.washington.edu>
Date: Tue, 20 Jan 2004 18:03:13 -0800
Message-ID: <1074650523.99565@yasure>


Haximus wrote:

> The PL/SQL documentation for 9.2 states that "to set all the fields in a
> record to null, simply assign to it an uninitialized record of the same
> type" and gives the following example:
>
> DECLARE
> TYPE EmpRec IS RECORD (
> emp_id emp.empno%TYPE,
> job_title VARCHAR2(9),
> salary NUMBER(7,2));
> emp_info EmpRec;
> emp_null EmpRec;
> BEGIN
> emp_info.emp_id := 7788;
> emp_info.job_title := 'ANALYST';
> emp_info.salary := 3500;
> emp_info := emp_null; -- nulls all fields in emp_info
> ...
> END;
>
> Is it acceptable to set fields in a record to null by assigning null to the
> record itself? Like:
>
> emp_info := null;
>
> I tried the syntax and it appears to work, I am just curious if this is
> actually documented somewhere because I have been unable to find it.

Absolutely.

-- 
Daniel Morgan
http://www.outreach.washington.edu/ext/certificates/oad/oad_crs.asp
http://www.outreach.washington.edu/ext/certificates/aoa/aoa_crs.asp
damorgan_at_x.washington.edu
(replace 'x' with a 'u' to reply)
Received on Tue Jan 20 2004 - 20:03:13 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US