IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Selecting a row from multiple tables!


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Vignesh Sid

New User


Joined: 04 Sep 2017
Posts: 43
Location: India

PostPosted: Thu Oct 26, 2017 6:09 pm
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: 2454
Location: Hampshire, UK

PostPosted: Thu Oct 26, 2017 7:54 pm
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: 446
Location: USA

PostPosted: Thu Oct 26, 2017 7:59 pm
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 All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts To Sort detail records in a file with... SYNCSORT 5
No new posts Question regarding ISPF tables with T... TSO/ISPF 11
No new posts To Populate Trailer cnt in the file w... SYNCSORT 1
No new posts To join 2 tables and to join 3rd tabl... DB2 8
No new posts Multiple INSPECTS on a big size file COBOL Programming 6
Search our Forums:


Back to Top