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
 
mutiple select in DB2.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
ursprasanna
Warnings : 2

New User


Joined: 15 May 2006
Posts: 20
Location: chennai

PostPosted: Mon May 22, 2006 4:59 pm    Post subject: mutiple select in DB2.
Reply with quote

When know that If there is a multiple row select for a select statement then , the select ends up with a sqlabend.

By using cursor we can handle this problem.

I would like to know whether this problem can be handled with out using cursor .

If so how??

Thanks,
Prasanna Subramaniam.
Back to top
View user's profile Send private message

guptae

Moderator


Joined: 14 Oct 2005
Posts: 1187
Location: Bangalore,India

PostPosted: Mon May 22, 2006 6:01 pm    Post subject:
Reply with quote

Hi,

There is two approch.
1) use the cursor
2) stregthentr ur where clause so that u will get only 1 row.

Correction r welcome
Back to top
View user's profile Send private message
die7nadal

Active User


Joined: 23 Mar 2005
Posts: 156

PostPosted: Mon May 22, 2006 6:42 pm    Post subject:
Reply with quote

Prasanna
It all depends on what u are trying to do with your SELECT Stmt.
1) If you want to fetch all rows no matter what - CURSOR is needed.
2) If you know that all the rows returned are dups and wish to fetch just a single row. You could use SELECT DISTINCT, or FETCH FIRST 1 ROWS ONLY.
3) If all you wanna know is, if the query returns any rows, you could check for the SQLCODE after the query for -811.
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 Can we limit length in concatenation ... balaji81_k DB2 7 Tue Aug 22, 2017 2:50 am
No new posts Select numeric portion from CHAR data... balaji81_k DB2 6 Sat Aug 19, 2017 1:51 am
No new posts Getting Mutiple input from Panels vidyaa CLIST & REXX 12 Mon Aug 14, 2017 1:28 pm
No new posts SQL - select data available in index Nileshkul DB2 3 Mon Jun 26, 2017 1:30 am
No new posts Two Selects in a single select query Rohit Umarjikar DB2 1 Fri Nov 04, 2016 8:46 pm

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