Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

sql query

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

New User


Joined: 20 May 2010
Posts: 75
Location: India

PostPosted: Thu Jul 24, 2014 2:19 am    Post subject: sql query
Reply with quote

Hi , this may be a weird thinking ..just want to know tbough...

Select x
Into y
Where x = y

Is this query will work in a sequential manner. Where value of y changes every time

Basically my question is for a table as below

Date amt
1 100
2 100
3 200
4 400
5 400

If I execute

Move 100 to ww-amt

Select amt
Into ww-amt
Where amt = ww-amt
And date > 1


Will this give me Sqlerrd as 4
Back to top
View user's profile Send private message

Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1219
Location: Israel

PostPosted: Thu Jul 24, 2014 4:20 pm    Post subject: Reply to: sql query
Reply with quote

No replies yet, which means your question was not understood.
Please rephrase, give a better example (1,2,3,4,5 in a date column doesn't look good), give interesting info (ever heard of SQLCODE?) and use code formatting.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1715
Location: UK

PostPosted: Thu Jul 24, 2014 8:58 pm    Post subject: Reply to: sql query
Reply with quote

Quote:
Will this give me Sqlerrd as 4

Why do you think it would? What happened when you tried it? Why would you even want to do this? You might as well say
Code:
WW-AMT = WW-AMT;
(PL/1, Rexx, C etc) or
Code:
MOVE WW-AMT TO WW-AMT
(COBOL - if it allows it)
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1610
Location: NY,USA

PostPosted: Fri Jul 25, 2014 12:25 am    Post subject:
Reply with quote

Quote:
Will this give me Sqlerrd as 4

SQLERRD is an array, so you need to specify the occurance or explain the terminology. However give a try and see what comes out.

Code:
Select amt
Into ww-amt
Where amt = ww-amt
And date > 1


What is the concern with this query? you would still expect for 100?
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
This topic is locked: you cannot edit posts or make replies. Db2 SQL query to convert rows into co... subratarec DB2 5 Thu Nov 17, 2016 4:51 pm
No new posts Two Selects in a single select query Rohit Umarjikar DB2 1 Fri Nov 04, 2016 8:46 pm
No new posts Problem in Running Query via JCL vickey_dw DB2 3 Tue Oct 18, 2016 11:11 pm
No new posts SQL Query optimization. arunsoods DB2 12 Sun Sep 04, 2016 6:27 am
No new posts Query on BLSR Nileshkul JCL & VSAM 2 Sat Aug 13, 2016 5:18 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us