Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: Another question on Code
The formal definition is table of <type> where <type> can be either a standard type or a record type, defined in your program. And of course, your binary integer is the subscript, it is not part of the 'column' defintion.
Hth,
Sybrand Bakker, Oracle DBA
"Arthur" <mechhunter_at_rocketmail.com> wrote in message
news:3a739e5d.75848157_at_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 Sun Jan 28 2001 - 04:45:23 CST
![]() |
![]() |