Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Tricky Sql Question
Hi,
You can use PL/SQL :
Create or replace procedure View_junk is
Cursor cur_junk is
select text, qty from junk_tab order by qty;
v_qty Number;
v_text Varchar2(50);
BEGIN
for rec_junk in cur_junk loop
if v_qty is not null and v_qty <> rec_junk.qty then
dbms_output.put_line (v_text||' '||to_char(v_qty)); v_text := ''; v_qty := rec_junk.qty; elsif v_qty is null then v_qty := rec_junk.qty;
\\|// (o o) ------------------oOO--(_)--OOo------------------ Ludovic DESSEMON Pepiniere.rey_at_wanadoo.fr
dmarsha3 <dmarsha3_at_csc.com> a écrit dans l'article
<6ia5qh$323_at_explorer.csc.com>...
> Group :
>
> I have a table junk_tab(text,num,qty)
>
> Text num Qty
> ----------------
> A 1 5
> B 2 5
> C 3 5
> A 1 4
> B 2 4
> E 1 6
> F 2 6
>
>
> and I would like to have a result like
>
> ABC 5
> AB 4
> EF 6
>
> Could somebody give a tip,direction or solution for this problem.
>
> Thanks in advance
>
> rama
> rkolluru_at_csc.com
>
Received on Mon May 04 1998 - 01:56:17 CDT
![]() |
![]() |