SQL Statements

Posted on 2005-02-27
Medium Priority
Last Modified: 2010-04-17
how `can we implement a sort function when making a method.  This is what we have so far.....

CREATE TYPE Employment_Type AS OBJECT (Employment_ID NUMBER(10), Employment_type varchar2(10), Client REF Client_Type, Completion_Date DATE);

CREATE TABLE Employment OF Employment_Type(Employment_ID PRIMARY KEY);

now, i'm trying to make a method that will sort the dates of completion_date by most recent ones.  Here is where i have encountered a problem because i don't know how to sort the completion_date attribute so that it prints out the most recent date that table employment holds.
this is what i have so far and where i am stuck:

create or replace type body employment_type as
member function most_recent ( m most_recent_type)
return date is
****here is where i'm supposed to make a comparison and see which date is the most recent one to return ----how do i do this******

thank you very much for your suggestions
Question by:new_foxpro
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
LVL 25

Accepted Solution

jrb1 earned 2000 total points
ID: 13416630
What are you programming in?  What DB?

The basic answer is,

select max(completion_date) from employment;

If pl/sql:

 select max(completion_date) into max_date from employment;

Featured Post

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question