?
Solved

Oracle RANK() function to Sybase ASE

Posted on 2009-07-09
5
Medium Priority
?
3,583 Views
1 Endorsement
Last Modified: 2013-12-19
Hi experts,

Is there a way of converting (or re-writing) an ORACLE RANK() function into Sybase ASE T-SQL?

I know this is possible in Sybase IQ but I have not seen this function in ASE and was wondering how I could get a query containing RANK to work in Sybase ASE.

Thanks,
1
Comment
Question by:SybaseUk
[X]
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
  • 2
5 Comments
 
LVL 14

Expert Comment

by:shru_0409
ID: 24813060
SELECT TOP 10 * FROM T

try this


0
 
LVL 6

Accepted Solution

by:
IncisiveOne earned 2000 total points
ID: 24814816
Nope.

TOP x will return the first x rows based on your ORDER BY (or the implicit ordering resulting from the index scan).

RANK() returns the position of the row in the result set, OVER (based on) some other identified criteria, such as another column value.

RANK() is easy to implement in Orable because it is ROW_ID based.  Difficult in Sybase because it is purely set oriented.  You will have to use a cursor, ugly as that is.  

I can give you a code struct that does exactly what a cursor does, minus the cursor class of locks and minus the internal overhead; ie. it performs better and allows more concurrency.   An enhanced version is great for pagination as well (return 'pages' of 50 rows at a time from a 7,000 row result set), but it requires a handshake from the front end/web server.

Cheers

0
 

Author Comment

by:SybaseUk
ID: 24821479
Does anyone know how to configure ASE to support CIS rpc procedures?
0
 
LVL 6

Expert Comment

by:IncisiveOne
ID: 24822058
SybaseUk

The way it works is, you need to close the question, award points, and ask a new question.  You will get a much better response, the only people watching this thread are those who have chosen to watch an "Oracle Rank()" question.

Cheers

0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
Shell script to create broker configuration file using current broker Configuration, solely for purpose of backup on Linux. Script may need to be modified depending on OS-installation. Please deploy and verify the script in a test environment.
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Suggested Courses

801 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