Sample Procedure to return data by SELECT sequence
search cancel

Sample Procedure to return data by SELECT sequence

book

Article ID: 142958

calendar_today

Updated On:

Products

IDMS IDMS - Database

Issue/Introduction

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.

Environment

Release : 19.0
Component : CA IDMS

Resolution

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

1578926383260__kd142958.zip get_app