MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Round off

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
psridhar
Beginner


Joined: 16 May 2004
Posts: 68
Topics: 26

PostPosted: Wed Jan 12, 2005 4:10 am    Post subject: Round off Reply with quote

Hi
I have a requirement in SQL where I need to round off a decimal to a valid currency denomination. Examples are as follows...

Input - Output
68.40 - 68.40
68.41 - 68.40
68.42 - 68.40
68.43 - 68.45
68.44 - 68.45
68.45 - 68.45
68.46 - 68.45
68.47 - 68.45
68.48 - 68.50
68.49 - 68.50
68.50 - 68.50

Is there any scalar function available, by manipulating which I can get my required output.

I need another information. Is there a way to grant permission on all the tables in a database to some one. For one table, I am using the following command.

Code:
GRANT ALL ON FE.SYSTM_GLBL_READ TO USERID ;
COMMIT ;


Thanks in advance...
Sridhar P
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12372
Topics: 75
Location: San Jose

PostPosted: Wed Jan 12, 2005 6:09 am    Post subject: Reply with quote

psridhar,

Try this sql

Code:

SELECT ROUND(68.40,1) +                         
       CASE INT(SUBSTR(DIGITS(68.40),4,1))     
            WHEN 3 THEN +00.05                 
            WHEN 4 THEN +00.05                 
            WHEN 5 THEN -00.05                 
            WHEN 6 THEN -00.05                 
            WHEN 7 THEN -00.05
            ELSE +00.00 END                     
  FROM SYSIBM.SYSDUMMY1
  ;


Check this link which explains in detail about GRANT (table or view privileges)

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/DSNSQH11/5.66?DT=20010718164132

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group