Sample Procedure to return data by SELECT sequence
search cancel

Sample Procedure to return data by SELECT sequence


Article ID: 142958


Updated On:


IDMS IDMS - Database


This is a sample SQL procedure written to solve the following problem.

The goal was to have a number (e.g. 5) of sub-queries as part of an overall global SELECT statement.
The SELECT should return an indication of which of the sub-queries was the first (in the order specified in the SELECT) to return any rows.
It should also NOT execute any of the sub-queries after the first one returning any rows is found.

It is not possible to do this with conventional SQL.
Even if the correct syntax could be found, it is likely that all of the sub-queries would be executed all of the time.


Release : 19.0
Component : CA IDMS


See the attached .zip file for the source code of the procedure.

Note: This is sample application code provided in good faith.
Final responsibility of using this code rests with the user. 

Attachments get_app