Several question about select.

From: Eitan <no_spam_please_at_nospam.com>
Date: Wed, 25 Jan 2006 21:38:19 +0200
Message-ID: <43d7e6a3$1_at_news.barak.net.il>



Hello,
I want a solutions for a compicateds sql select statments.

The selects can use anything : views, stored procedures, analytic functions, etc...
(not use materialized view, unless it is neccessary).

question 1)
The selects can use anything : views, stored procedures, analytic functions, etc...
(not use materialized view, unless it is neccessary).
Suppose I have the folowing select :

select x from t

  • t is a table, and x is numeric column.

The select statement is fixed and cannot be change. The only change that is allowed is to put a where clause at the end of the select.

I want that the where clause will influence the result of the select, like the following.

If I add :
where x = 1
The result will be : 1

If I add :
where x = 2
The result will be : 2

etc..

If I could do something like :
select rownum
from t
where rownum = 1

(the where statement works only for rownum = 1, and then the select return
the value : 1).

The select may use an analitic function etc... ).

If there is any solution for above , I would like to know please + some code sample.

question 2)

I have a binary tree.
I want to search the tree in some kind of select statement (Left + Parent + Right).
The output should be the binary search of the tree, each row of the select return in the right order the search output.

I can use stored procedures, package etc... but, at the end I want to use one single select statement for that.

How can I do that.
Need code sample, please.

Thanks :) Received on Wed Jan 25 2006 - 20:38:19 CET

Original text of this message