Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: PL/SQL Variable Question
On Sun, 22 Nov 1998 02:35:02 GMT, shirushah_at_hotmail.com
wrote:
>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?
Look at the following example. Note the colon used in front of li_emp_name when it's used in the PL/SQL block. THe colon tells PL/SQL that it's a bind variable.
SQL> variable li_emp_name varchar2(40)
SQL> begin
2 select employee_name into :li_emp_name
3 from employee where employee_id = 101;
4 end;
5 /
PL/SQL procedure successfully completed.
SQL> print li_emp_name
LI_EMP_NAME