Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Selecting a row from multiple tables!

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
Vignesh Sid

New User


Joined: 04 Sep 2017
Posts: 25
Location: India

PostPosted: Thu Oct 26, 2017 6:09 pm    Post subject: Selecting a row from multiple tables!
Reply with quote

I am working on a DB2 module where I should select a row from 5 tables (I can use fetch first row only in query). This selection is done to ensure that all 5 tables are available and we will send a mail that database is ready.

Is there any ways other than giving five different cursors for the five tables and fetching seperately and handle errors if a table is not available?

Please let me know for your thoughts!

Thanks!
Back to top
View user's profile Send private message

Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1925
Location: UK

PostPosted: Thu Oct 26, 2017 7:54 pm    Post subject:
Reply with quote

How about one query selecting one column from each table?
Back to top
View user's profile Send private message
RahulG31

Active User


Joined: 20 Dec 2014
Posts: 408
Location: USA

PostPosted: Thu Oct 26, 2017 7:59 pm    Post subject: Reply to: Selecting a row from multiple tables!
Reply with quote

Quote:
This selection is done to ensure that all 5 tables are available

Do you mean the table or if the rows are available in the table?

Are these 5 tables connected by any column? If they are, then use LEFT OUTER JOIN and find which table column values are null. If they are Null then that would mean the connecting row is Not present.

.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Formatting multiple records to a sing... Vignesh Sid SYNCSORT 3 Tue Nov 07, 2017 12:22 pm
No new posts Updating multiple counts in trailer!! Vignesh Sid SYNCSORT 4 Mon Nov 06, 2017 1:04 pm
No new posts ejck thru rexx to multiple jobs insid... Susanta All Other Mainframe Topics 5 Tue Sep 19, 2017 1:39 pm
No new posts PLI - printing from multiple programs Pedro PL/I & Assembler 8 Fri Sep 08, 2017 6:36 am
This topic is locked: you cannot edit posts or make replies. Selecting two copybooks of different ... Vignesh Sid COBOL Programming 8 Tue Sep 05, 2017 7:28 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us