Results 1 to 4 of 4

Thread: oracle pl/sql

  1. #1
    Join Date
    Nov 2002
    Posts
    22

    Unanswered: oracle pl/sql

    guys i have table emp( empno(pk), ename, job, sal) how can i declare a pl/sql table of employee name type, populate the pl/sql with all employee information , & then loop thro pl/sql table to find out whose name has letter k as middle character.

    thanks
    makr

  2. #2
    Join Date
    Jan 2003
    Location
    Vienna, Austria
    Posts
    102

    Re: oracle pl/sql

    why don't you run
    select * from emp
    where ename like '%k%';

    (% is the percentage character)
    ^/\x

  3. #3
    Join Date
    Nov 2003
    Location
    Rotterdam, Netherlands
    Posts
    127
    Also you can use a cursor if u insist on using a LOOP
    may be for someother purpose....

  4. #4
    Join Date
    Apr 2003
    Location
    NY
    Posts
    208

    Re: oracle pl/sql

    You first declare a Record. Then declare a Pl/Sql table of that Record type. Then declare local variable of that Table type and you loop through the table and "insert" records.

    Pl/sql tables are basically Arrays. So you use them like an array.

    [php]
    Type t_emp is Record (
    Emp_No Number,
    Ename Varchar2(50),
    Job Varchar2(50),
    Salary Number);

    Type t_table is Table of t_emp%type
    index by binary_integer;

    lv_array t_table;

    Begin

    lv_array(1).Emp_No := 100;

    Oracle Press PL/SQL Programming is a good resource. Or maybe your textbook....

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •