| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.server -> Re: another mental block - Help still wanted Pleeeeease!!!
jmourik_at_yahoo.com (Jan van Mourik) wrote in message news:<ffe966de.0311051359.2dbd152b_at_posting.google.com>...
> > But what I need is
> > 
> > 
> >      N_ID V_ V_T     V_VAL
> > --------- -- --- ---------
> >      1111 AV TLL       150
> >      2222 AV TLP       100
> >      3333 AV TQD       100
> >      4444 AV           100
> >      5555 AJ RDL       120
> >      6666 AJ RPX       200
> >      7777 AJ RPN       125
> > 
> 
> Don't know where this comes from:
> >      6666 AJ RPX       200
> 
> but the rest could be:
> jvmo_at_ids9i> l
>   1  select n.n_id,
>   2         n.v_cat,
>   3         n.v_type,
>   4         nvl((select v1.v_val from tclval v1 where n.v_cat =
>                                          v1.v_cat and v1.v_type = n.v_type)
>   5            ,(select v2.v_val from tclval v2 where n.v_cat =
>                                          v2.v_cat and v2.v_type is null)
>   6            )  as val2
>   7    from tclnvv n
>   8*  order by 1
> jvmo_at_ids9i> /
> 
>       N_ID V_ V_T       VAL2
> ---------- -- --- ----------
>       1111 AV TLL        150
>       2222 AV TLP        100
>       3333 AV TQD        100
>       4444 AV            100
>       5555 AJ RDL        120
>       6666 AJ RPX
>       7777 AJ RPN        125
> 
> 7 rows selected.
> 
> Of course, insert into tclval values ('AJ',null,200);
> will get you the result set you printed :-)
> 
> jan
Mmmmm ... nice
Thanks Jan (you spotted my typo too ;-))
I'm on 8.1.7 here so I can't use that in PL/SQL. I guess a view or maybe dynamic SQL is called for here.
CE Received on Thu Nov 06 2003 - 03:23:30 CST
![]()  | 
![]()  |