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: select into NULL in PL/SQL

Re: select into NULL in PL/SQL

From: john sprague <bearpig_at_attglobal.net>
Date: Tue, 26 Jun 2001 20:56:22 -0500
Message-ID: <3B393D46.959E1E1B@attglobal.net>

Jeff Wilson wrote:

> Have looked everywhere for an example or explanation of this without
> success.
>
> Have a table with a column that can contain NULL. Am using a cursor to loop
> over every record and load this column value into a variable using SELECT
> INTO.
>
> When I get to a NULL value, I get an ORA-04013 or similar that says "data
> not found".

Parsed above ...

Try a fetch from a seed cursor to get the data . The fecth will put it into a variable that you can then conditionally handle and drive via a loop structure if needed into the sub querry.

I avoid select into but only because my own impact analysis search vs plsql code will identify things specifically labled as 'cursor' so my c-code search program knows to return all contiguous code. It is a formulaic method of crude impact analysis in lieu of a real change control / impact analysis code - but most of my plsql is ad hoc - not that I don't occasionally want to know where I used 'johnny' so I know if table structures change ( I have a few developers in the shop ) that I need my code to change ...

Nevertheless... what follows helps:

so ...

open getseed;

<<L_primaryloop>>
loop

fetch getseed into v_cancontainnull;

exit when getseed%notfound;

    if v_cancontainnull is null then .....

            //special null handling mentioned ///

    end if;

    if v_cancontainnull is not null then .....

        open getsecondquerry;

        fecth getsecondquerry into v_whatever1......;

        /// process action based on v_whatever one -- initiate loop if multiple returns possible ///

        close getsecondquerry;

    end if;

end loop L_primaryloop;

close getseed; Received on Tue Jun 26 2001 - 20:56:22 CDT

Original text of this message

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