Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL/PL SQL help
Rushika Pandya wrote:
>
> I have a table that is a parent/child table. This table has five levels.
> One of the attributes can be defined at any one of these five levels.
> I want to be able to select the level_id where this attribute is not null.
>
> The searching preference is level 5..level1.
>
> I know how to get the attribute value:
> nvl(table5.attribute, nvl(table4.attribute, nvl(table3.attribute,
> nvl(table2.attribute, nvl(table1.attribute, '0')
> but I do not know how to get the corresponding level value...
>
> How would I go about doing this...
How about decoding the attribute values?
ie decode(table5.attribute,null,null,5) etc
Cheers,
Terry
Received on Mon Oct 27 1997 - 00:00:00 CST