Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: Newbie question regarding PL/SQL
Hi Lisa,
If you really want to solve it using a cursor you could use an explicit fetch instead of the implicit fetch. You do an implicit fetch (you create a record on the fly). You can do an explicit fetch as follows: declare
result_rec result_table%ROWTYPE; cursor c_select is select a,b,c from result_table;begin
fetch c_select into result_rec;
if c_select%isopen then
close c_select;
end if;
end;
This is a very short example that only fetches one row, but I think it gives you a nice idea how to explicitly open a cursor. The advantage is that you van fetch a row from the resultset into the record anytime YOU want. So if the current row has errors, then simply do another fetch, which will put the next row from the resultset in your record. Be sure to put in some error handling, so you will not fetch behind the last row and stuff... just take a look at the cursor%.... operators in your pl/sql reference.
HTH,
Bastiaan Schaap
Oracle web development,
Desyde BV - Baarn
http://www.desyde.nl/
tel. +31355411711
Lisa Adcock <ladcock_at_ford.com> wrote in message
news:8musan$fqq3_at_eccws12.dearborn.ford.com...
> I have a cursor and I would like to do some data validation on each row in
> the cursor before the "real" processing begins. I would like to organize
my
> as follows but am having problems finding the right language
> construct/reserved word.
>
> for emp_record in cur_employees loop
>
> if this row has a data problem then
> continue onto next row in cursor
> end if
>
> -- start real processing here
>
> end
>
> I can solve my problem by putting the "real" processing in the elsif part
of
> the if statement, but the processing logic already involves three nested
ifs
> and I don't want to indent them another level by putting them in the
elsif.
>
> Any ideas would be appreciated!
>
>
>
>
Received on Fri Aug 11 2000 - 00:00:00 CDT
![]() |
![]() |