Help with %rowtype
Posted on 2005-04-26
Hello all! I'm new to Oracle and trying to teach myself it through various resources; mostly online! We don't have an oracle DBA on staff, so I'm assuming this role.
I'm trying to figure out the how to use the %rowtype attribute to acquire all the data per row. I created a test database called erictest with two fields (firstname, lastname). I have about 10 records in this test database.
Here is my test code...
SET SERVEROUTPUT ON
type eric_test_table is table of erictest%ROWTYPE
index by binary_integer;
lowernumber number := 1;
select count(*) into ericcounter from erictest;
FOR i IN lowernumber..ericcounter LOOP
select * into erictemptable from erictest;
FOR i IN 1..ericcounter LOOP
This thing doesn't work.
Now, if I change the above code to just return all FirstNames by altering the "is table of" and "select" statements accordingly, it works fine. I just can't return all the data (firstname and lastname) for each row.