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: Jonathan Gennick <gennick_at_worldnet.att.net>
Date: 22 Nov 1998 17:31:58 GMT
Message-ID: <365d4857.11773270@netnews.worldnet.att.net>


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



Jonathan Gennick Received on Sun Nov 22 1998 - 11:31:58 CST

Original text of this message

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