Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

returning YES/NO conditionally

MrGibbageAug 17 2010 — edited Aug 27 2010
I have a table for recording maintenance actions on large ships. The table has a "task_number" column (a code to identify the task) and a "task_class" column which refers to each ship type (small, medium or large ships, for instance). The task numbers are not the PK, and there are duplicates. Each record contains the task number, task class, and more associated information. The task number and task class are never null. I would like to run a query that would return something like this:
If the table contained data such as

TASK_NUMBER | TASK_CLASS
X-3161-0 | SMALL
X-3161-0 | LARGE
X-1984-3 | LARGE
P-3535-1 | MEDIUM
P-3535-1 | SMALL
P-3535-1 | LARGE

TASK_NUMBER | SMALL? | MEDIUM? | LARGE?
X-3161-0 | YES | NO | YES
X-1984-3 | NO | NO | YES
P-3535-1 | YES | YES | YES

So, as you can see, every task number should be included, and then the class applicability follows. I do know ahead of time what all of the "classes" are--I don't have to figure that out at run time.

If this can be done easily with plain SQL, I would appreciate it, but PL/SQL is acceptable too.
This post has been answered by Frank Kulash on Aug 27 2010
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 24 2010
Added on Aug 17 2010
20 comments
3,787 views