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: Arthur <mechhunter_at_rocketmail.com>
Date: Sun, 28 Jan 2001 04:22:44 GMT
Message-ID: <3a739e5d.75848157@news.iinet.net.au>

Ah.! implicit.. I was never told about that... crap. Say, can you have more than 2 column within a pl/sql table ? I though you can only have two, a binary integer index and the data colum itself.

-Arthur

On Sat, 27 Jan 2001 20:27:39 GMT, rr <raineyr_at_look.ca> wrote:

>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 - 22:22:44 CST

Original text of this message

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