?
Solved

SQL Statements

Posted on 2005-02-27
1
Medium Priority
?
219 Views
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
begin
****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
0
Comment
Question by:new_foxpro
1 Comment
 
LVL 25

Accepted Solution

by:
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;
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Question has a verified solution.

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

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
When you discover the power of the R programming language, you are going to wonder how you ever lived without it! Learn why the language merits a place in your programming arsenal.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Six Sigma Control Plans

615 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