Slick Query

Giganews Newsgroups
Subject: Slick Query
Posted by:  artmer…
Date: Fri, 25 Jul 2008

I want to see if I can create a slick query to do this and cut down on
some code.

I have a list of dates & statuses like this:

01/05/08 Complete
02/15/09 Complete
02/18/08 Active
05/10/08 Cancelled
06/07/08 Pending
02/19/08 Complete

I'll order them in the query.  What I need to do is first check to see
if there is a status of Active or Pending and return the first one I
encounter.  If those do not exist, I need to return the first Complete
or Cancelled I encounter.

In this case Active would be returned.

Right now I have a cursor and some PL/SQL going through 2 loops
checking for Active/Pending, then Complete/Cancelled.  I'd like to see
if I can do it all in one query.

Any hopes of doing this?