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
 

 

divide operator in select statement

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

New User


Joined: 20 May 2008
Posts: 8
Location: Hyderabad

PostPosted: Mon Dec 08, 2008 9:25 pm    Post subject: divide operator in select statement
Reply with quote

i am selecting 10 fields from a table .
can i use divide operator in select statemnt for caluculating the resultant filed which is not a column of the table, but the fileds paticipating in the divide operator are present in the table.

let's say
PAID-AMOUNT-PER-UNIT =C-LI-CLC-ALLW-AMT/C-LI-ALLOW-UNT-NUM
Here C-LI-CLC-ALLW-AMT, C-LI-ALLOW-UNT-NUM are fileds of a table but
PAID-AMOUNT-PER-UNIT is not a filed of this table or any other table. can i do the above operation in the select statement
Back to top
View user's profile Send private message

Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2276
Location: @my desk

PostPosted: Mon Dec 08, 2008 10:45 pm    Post subject:
Reply with quote

pardhasaradhireddy,

Yes, we can do arithmetic operations using different columns of a table and name the resultant column provided the operand column definitions are of numeric type.
Back to top
View user's profile Send private message
pardhasaradhireddy

New User


Joined: 20 May 2008
Posts: 8
Location: Hyderabad

PostPosted: Mon Dec 08, 2008 10:49 pm    Post subject:
Reply with quote

how can u reply me with sample code
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Mon Dec 08, 2008 11:00 pm    Post subject:
Reply with quote

Hello,

Suggest you build a prototype query with the operations you want to accomplish and we can help you get it running if there are problems.

When you post your code, please use the "Code" tag at the top of the reply panel for readability (green on black) as well as preserve alignment. Use Preview to see how your post will appear to the forum and when you are satisfied with the appearance, Submit.
Back to top
View user's profile Send private message
umasankarmf

New User


Joined: 08 Sep 2008
Posts: 43
Location: india

PostPosted: Tue Dec 09, 2008 12:14 pm    Post subject:
Reply with quote

Hi pardhasaradhireddy,

You can use the following query.


select C-LI-CLC-ALLW-AMT/C-LI-ALLOW-UNT-NUM as PAID-AMOUNT-PER-UNIT from TAB_NAME

The name which is using after AS is only for display purpose.

If any corrections ............... well come.....

Regards
Umasankar M
Back to top
View user's profile Send private message
pardhasaradhireddy

New User


Joined: 20 May 2008
Posts: 8
Location: Hyderabad

PostPosted: Tue Dec 09, 2008 1:57 pm    Post subject:
Reply with quote

thank you
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 ROUNDED Problem with COMPUTE statement shalem COBOL Programming 11 Thu Feb 09, 2017 8:16 pm
No new posts VALIDATE NULL VALUE IN DB2 CASE STATE... useit DB2 5 Thu Feb 09, 2017 4:34 pm
No new posts -913/-911 Deadlock during UPDATE stat... NoSleep319 DB2 5 Fri Nov 18, 2016 12:37 am
No new posts Two Selects in a single select query Rohit Umarjikar DB2 1 Fri Nov 04, 2016 8:46 pm
No new posts COBOL DB2 - CALL statement - high CPU... TS70363 DB2 15 Sun Sep 11, 2016 6:07 am


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