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

Override a value through sql


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

New User


Joined: 26 Apr 2007
Posts: 49
Location: Delhi

PostPosted: Thu Dec 06, 2007 1:02 pm
Reply with quote

Hi
Say I have a query:
Selet A, B, C
from tableA

My req is whatever be the value of A, B and C, the value of must display as 1.

Say in tableA the values are;
A B C
2 d e
3 f g

Once we run the above query, the result set must be:
A B C
1 d e
1 f g

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

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Thu Dec 06, 2007 1:07 pm
Reply with quote

Mahua,

Quote:
My req is whatever be the value of A, B and C, the value of must display as 1.

What is the reason behind this? I believe IBM has not thought of such kind of 'business requirements'.
Back to top
View user's profile Send private message
Srihari Gonugunta

Active User


Joined: 14 Sep 2007
Posts: 295
Location: Singapore

PostPosted: Thu Dec 06, 2007 1:18 pm
Reply with quote

Murali,
There will be some instances in which you need to hardcode the values in the query. I have some queries like that in my applications.
Mahua, you can use the following query.
Select '1', B, C
from tableA
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Thu Dec 06, 2007 1:21 pm
Reply with quote

Hari,

Quote:
There will be some instances in which you need to hardcode the values in the query.

I agree with you. But TS wanted col A value to be displayed as '1' irrespective of actual value. I belive this is not HARDCODING the value.
Back to top
View user's profile Send private message
Srihari Gonugunta

Active User


Joined: 14 Sep 2007
Posts: 295
Location: Singapore

PostPosted: Thu Dec 06, 2007 1:24 pm
Reply with quote

Ok Murali. In that case, Probably Mahua can use this,
Select '1' AS A, B, C
from tableA;

I am expecting Mahua's response to see what exactly he needs.
Back to top
View user's profile Send private message
Mahua Mitra

New User


Joined: 26 Apr 2007
Posts: 49
Location: Delhi

PostPosted: Thu Dec 06, 2007 3:08 pm
Reply with quote

Thanks a lot Srihari,
That was o great help.
Back to top
View user's profile Send private message
Srihari Gonugunta

Active User


Joined: 14 Sep 2007
Posts: 295
Location: Singapore

PostPosted: Thu Dec 06, 2007 3:17 pm
Reply with quote

You are welcome. icon_smile.gif
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 AN OVERRIDE MAY NOT TARGET OVERRIDING... JCL & VSAM 1
No new posts Compare Two datasets and Override Mat... DFSORT/ICETOOL 7
No new posts proc step return code to override in ... JCL & VSAM 3
No new posts IEHPROGM ENQUEUE OVERRIDE JCL & VSAM 4
No new posts Can DFSPARM override SORTKEYS paramet... DB2 2
Search our Forums:


Back to Top