SQL subquery or PL/SQL
Date: Mon, 3 May 1993 19:31:00 GMT
Message-ID: <3MAY199314315099_at_author.gsfc.nasa.gov>
Hello folk,
The following SQL works but is inefficient because the
subquery is repeated twice. I've tried a few different
approaches using PL/SQL, but I only know enough PL/SQL to
be a menace to society.
How do you avoid doing that subquery twice?
accept LOC number prompt 'Enter memory location: '
select seq, location,loc_abs_rel,obj_code,obj_abs_rel,symbol,instruction
column statement format 99999
column instruction format a35 word_wrapped
column location format a6
column obj_code format a8
column symbol format a6
column seq format 99999
from source_code_lst
where seq + 5 >=
(select seq
(select seq
from source_code_lst
where location = &&LOC and loc_abs_rel = 'A')
and seq - 5 <=
from source_code_lst
where location = &&LOC and loc_abs_rel = 'A')
order by seq;
undefine LOC
Jeff Chamblee "I'm not very smart, but Computer Sciences Corp. I can lift heavy things."CHAMBLEJ_at_OBCDEV.GSFC.NASA.GOV Received on Mon May 03 1993 - 21:31:00 CEST