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: PL/SQL Variable Question

Re: PL/SQL Variable Question

From: Andy Hardy <aph_at_ahardy.demon.co.uk>
Date: 22 Nov 1998 03:52:17 GMT
Message-ID: <01be15ca$e50c05a0$430c400a@viao1>

shirushah_at_hotmail.com wrote in article <737t8m$rfu$1_at_nnrp1.dejanews.com>...
> How do you assign, from the row of data that you have selected with a
rowtype
> variable, just the data from one column into a variable? Here is an
example
>
> SQL> variable li_deptname varchar2(20);
> SQL> declare
> li_dept dept%rowtype;
> begin
> select * into li_dept
> from dept
> where deptno = 40;
> end;
>
> In the dept table exsits a loc column, how do I get only data from that
one
> column and assign it to the host variable li_deptname?
>

li_dept is a rowtype, so you refer to each component of that row as li_dept.column_name e.g. li_dept.loc so you can have x := li_dept.loc;

Andy Received on Sat Nov 21 1998 - 21:52:17 CST

Original text of this message

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