Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: PL/SQL Variable Question
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