Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: How to construct an SQL query?
I still am not clear how do you want to display the results. But this
might help:
say T is the table name and
T_NAME is the column name for form field name,
T_TO_DATE and T_FROM_DATE are columns for 2 date fields to_date and
from_date
write a query like
select <***> into <+++> from T
where T_NAME = nvl(name,T_NAME)
and T_TO_DATE <= nvl(to_date,T_TO_DATE)
and T_FROM_DATE >= nvl(from_date,T_FROM_DATE)
You may want to change the where condition depending upon what should be the output if one if the field is null(not enterted)
nainm
In article <7k1dba$a1m$1_at_nnrp1.deja.com>,
Wassim <net2000_at_francemel.com> wrote:
> Hi,
> suppose that i have a form like this :
> name :
> date : from [ ] to [ ]
>
> [send] [cancel]
>
> i want to know how to construct the SQL query while i can't be done
only
> dynamically because criteria of search are only known after submission
> of the form, search can be on 'name' only, or 'name'+'from_date' or
the
> 3 criteria..
>
> Have i to do it using UNION between 2 or 3 SELECT query?
> Thanks for help !!
>
> Wassim,
> e-mail: net2000_at_francemel.com
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.
>
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
Received on Mon Jun 14 1999 - 09:26:45 CDT