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

Home -> Community -> Usenet -> c.d.o.tools -> Re: Another question on Code

Re: Another question on Code

From: rr <raineyr_at_look.ca>
Date: Sat, 27 Jan 2001 20:27:39 GMT
Message-ID: <3A734BAE.D7F82A5C@look.ca>

emp_rec is implicity declared as a record type matching job_cur, so in this case,
job_cur record type is a record type defined as (job.emp%TYPE, deptno.emp%TYPE)
emp_rec is a variable of that type
rachel

Arthur wrote:

> This work, but see on the line that reads
> FOR emp_rec IN job_cur LOOP...
> What I don't understand is, why was there no need to declare
> emp_rec ????
>
> SET SERVEROUTPUT ON
> DECLARE
> TYPE job_dept_table IS TABLE OF VARCHAR2(60)
> INDEX BY BINARY_INTEGER;
> job_dept job_dept_table;
> v_both VARCHAR2(60);
> x NUMBER:=0;
> v_count NUMBER;
>
> CURSOR job_cur IS
> SELECT DISTINCT job, deptno
> FROM emp
> ORDER BY deptno;
>
> BEGIN
> FOR emp_rec IN job_cur LOOP
> job_dept(x) := to_char(emp_rec.deptno)||(emp_rec.job);
> x:= x+1;
> END LOOP;
>
> DBMS_OUTPUT.put_line(x);
> x:=x-1;
> FOR i IN 1..x LOOP
> DBMS_OUTPUT.PUT_LINE(job_dept(i));
> END LOOP;
>
> END;
> /
>
> Another question, when you have a PL/SQL table.. is there no way you
> can use SELECT using the PL/SQL table within the same code where the
> table was create ?
>
> Many thanks in advance.
>
> Arthur
  Received on Sat Jan 27 2001 - 14:27:39 CST

Original text of this message

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