5 pts.
 to write code
i have created a table "stu" in which the following record exists. stu_id,stu_name,stu_course,stu_marks the stu_marks column output is as follows 822 758 789 658 822 879 598 825 589 785 795 795 658 789 988 what i want is to write query or code (function,procedure or anything) that when i execute it prompts the user to enter whether he want to have top 10 students marks(according to marks),top 5,top 3,2,1 inshort from top1-top15 and when he enters top1 so the highest marks of the student should be displayed,similary if user enters top 10 so the 10 studnets marks will be displayed in descending order i would be grateful to you if u kindly do it

Software/Hardware used:
ASKED: August 18, 2008  11:06 AM
UPDATED: September 22, 2008  8:51 PM

Answer Wiki:
Any chance of changing the schema? Having all marks of a student in a space delimited fields represtents issues as I am sure you have found out. Add another table called stu_marks with 2 fields the stu_id, and the stu_marks. Each students marks gets its own row. This makes it much easier to do a top anything query , and allow for easy ordering (ascending or descending). What version of Oracle are you running? There are many ways of doing it oracle 11 has some new features for pivot table which would assist with this. You can use a split function see asktom.oracle.com for explanation on that, and use a temporary table to store the data in it, to get the top XX with sorting.
Last Wiki Answer Submitted:  August 21, 2008  5:16 pm  by  Rdano   175 pts.
All Answer Wiki Contributors:  Rdano   175 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

Definitely it would be much easier to accomplish this (and many other things) with a different schema…
Was there some special reason to store the marks in this way ?

 63,535 pts.