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

Home -> Community -> Usenet -> c.d.o.server -> Re: Help for SQL!?

Re: Help for SQL!?

From: JZ <ibm_97_at_yahoo.com>
Date: 6 Jul 2004 09:31:11 -0700
Message-ID: <10bc841c.0407060831.60374495@posting.google.com>


The following query is what I get, it shows you really have very very limited SQL knowledge, not mention Oracle.

SELECT *
2 FROM t
3 WHERE NOT EXISTS (SELECT NULL
4 FROM t t_x
5 WHERE t_x.t1 = t.t1
6 AND t_x.t2 <> t.t2
7 AND t_x.t3 <> t.t3
8 AND (t_x.t2 BETWEEN t.t2 AND t.t3
9 OR t_x.t3 BETWEEN t.t2 AND t.t3))
10 /

Daniel Morgan <damorgan_at_x.washington.edu> wrote in message news:<1088902443.769543_at_yasure>...
> JZ wrote:
>
> > Our JAVA code only can process SQL, not PL/SQL. I know if PL/SQL can
> > be used, the problem is pretty easy to solve.
> >
> >
> > Daniel Morgan <damorgan_at_x.washington.edu> wrote in message news:<1088834737.754221_at_yasure>...
> >
> >>JZ wrote:
> >>
> >>
> >>>Oracle 9.2
> >>>
> >>>I have a table like:
> >>>
> >>>t1 t2 t3
> >>>-----------------------------
> >>>char1 01/01/2004 01/05/2004
> >>>char1 01/10/2004 01/15/2004
> >>>char1 01/20/2004 01/25/2004
> >>>char1 01/01/2004 01/15/2004
> >>>char1 01/01/2004 01/25/2004
> >>>char1 01/10/2004 01/25/2004
> >>>
> >>>t2 value is always less than t3.
> >>>
> >>>How can I use SQL (no PL/SQL) to get output like:
> >>>
> >>>t1 t2 t3
> >>>-----------------------------
> >>>char1 01/01/2004 01/05/2004
> >>>char1 01/10/2004 01/15/2004
> >>>char1 01/20/2004 01/25/2004
> >>>
> >>>WHat I want is: no 'middle' values between t2 and t3 can be found in
> >>>the table.
> >>>The reason why 'char1 01/01/2004 01/15/2004' is no good is because
> >>>'01/10/2004' is between '01/01/2004' and '01/15/2004', and it's in the
> >>>table.
> >>>
> >>>Any help?
> >>>
> >>>THanks a lot!!!
> >>
> >>This is school work so you need to work on this yourself.
> >>
> >>Personally I think the request preposterous and that any sane person
> >>would use PL/SQL.
>
> Java can submit PL/SQL in the form of anonymous blocks. But given that
> you didn't know that my guess is that your knowledge of Oracle is so
> limited that you shouldn't be writing any.
>
> Get someone that knows how to write stored procedures to write the code
> and pass parameters to the procedure.
Received on Tue Jul 06 2004 - 11:31:11 CDT

Original text of this message

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