Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Re: How to add a weight factor to a query?

Re: How to add a weight factor to a query?

From: Daniel A. Morgan <dmorgan_at_exesolutions.com>
Date: Thu, 25 Jan 2001 20:37:58 -0800
Message-ID: <3A70FF26.6A1EE04C@exesolutions.com>

> In article <3A6FAE32.3AEF8B41_at_exesolutions.com>,
> "Daniel A. Morgan" <dmorgan_at_exesolutions.com> wrote:
> > > How do I add a weight factor to a query? For example, take the
> > > following query:
> > >
> > > SELECT table.field1, table.field2, table.field3
> > > FROM table
> > > WHERE field1 = 'value1'
> > > AND field2 = value2
> > > OR field3 = value3
> > >
> > > What I would like to do now is give each test a factor of
 importance.
> > > So (field1 = 'value1') should be the most important, let's say 60%,
 the
> > > other two should be of importance for 20% each.
> > >
> > > Can anybody help me with this? Thanks very much in advance for your
> > > time and effort!
> >
> > The only way I know to do this is to create a view or snapshot in
 which you
> > display the data with the weight factor calculated and then query
 from that
> > object. You could use a decode to create the values for the weight-
 value
> > field.
> >
> > Obviously the SQL for the view or snapshot could be incorporated into
 a SQL
> > query but approaching it in this way (with the view) will make it less
> > complicated to construct or (with the snapshot) run substantially
 faster.
> >
> > Hope this helps.
> >
> > Daniel A. Morgan
> >
>
> Thanks for your reply, but I don't think that this solves my problem.
> The weight factors added to the query are not calculated, they are set
> values. People who use my software must be able to build a query and
> enter these weight factors for themselves.
>
> Still, thank you for your time and effort!

Don't dismiss me solution so quickly. It still works. You just need to use dynamic SQL to construct the query on the fly. I tried it just now and it works just fine.

Daniel A. Morgan Received on Thu Jan 25 2001 - 22:37:58 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US