472,351 Members | 1,586 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes and contribute your articles to a community of 472,351 developers and data experts.

PL-SQL Tips (SINGLE ROW FUNCTIONS)

amitpatel66
2,367 Expert 2GB
All,

Please find below POST about Oracle SINGLE ROW FUNCTIONS which might be useful.

SINGLE ROW FUNCTION are those which are executed once for each and every row of the Query.

The different types of SINGLE ROW FUNCTIONS are:

1. NUMBER Functions
2. DATE Functions
3. CHARACTER Functions
4. CONVERSION Functions
5. GENERAL Functions

Let us categorize some of the SINGLE ROW FUNCTIONS and its usage:

NUMBER Functions:

ROUND(m,[n]) - Round the number m to n decimal places (n is optional)
Expand|Select|Wrap|Line Numbers
  1. SELECT ROUND(2.555,2) FROM dual -- returns 2.56
  2.  
Expand|Select|Wrap|Line Numbers
  1. DECLARE
  2. a NUMBER;
  3. BEGIN
  4. a:= ROUND(2.555,2);
  5. END;
  6.  
TRUNC(m,[n]) - Truncate the number m to n decimal places (n is optional)
Expand|Select|Wrap|Line Numbers
  1. SELECT TRUNC(2.555,2) FROM dual -- returns 2.55
  2.  
MOD(m,n) - Return the remainder of the number m divided by n
Expand|Select|Wrap|Line Numbers
  1. SELECT MOD(3,1) FROM dual -- returns 0
  2.  
CEIL(m) - Returns smallest integer (Whole Number) without decimal place larger than the number m
Expand|Select|Wrap|Line Numbers
  1. SELECT CEIL(1.5) FROM dual -- smallest integer larger than 1.5 is 2 so this query returns 2
  2.  
FLOOR(m) - Returns largest integer (Whole Number) without decimal place smaller than the number m (Opposite to CEIL)
Expand|Select|Wrap|Line Numbers
  1. SELECT FLOOR(1.5) FROM dual -- largest integer smaller than 1.5 is 1 so this query returns 1
  2.  
SIGN(m) - Retuns +1 if the number m >0 else Returns -1 if the number m is < 0
Expand|Select|Wrap|Line Numbers
  1. SELECT SIGN(-235) FROM dual -- returns -1
  2. SELECT SIGN(235) FROM dual -- returns 1
  3.  
POWER(m,n) - Returns multiplication of m, n times
Expand|Select|Wrap|Line Numbers
  1. SELECT POWER(2,2) FROM dual -- returns 4
  2.  
Sep 17 '07 #1
0 12188

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Hmmm... | last post by:
I am setting up a web site for a friend. Her hosting service does not support Sendmail. It is an NT server. They recommend I use Smtp. I have...
0
by: mucha3456 | last post by:
Please send all sorts of spam to: jacek@karczmarczyk.pl jacek@karczmarczyk.pl jacek@karczmarczyk.pl jacek@karczmarczyk.pl jacek@karczmarczyk.pl
3
by: D. Stimits | last post by:
I've found a number of basic references for PL/PGSQL, but am looking for something more complete. First question, is there available a *complete*...
3
by: Klaus P. Pieper | last post by:
Hi, does anybody out there have experience with the several PL's which are available for PostgreSQL? I am currently evaluating several databases...
22
by: Christopher Murtagh | last post by:
Greetings, I'm trying to write a pl/perl function that will return multiple rows. I've looked all over the web and only found vague references as...
2
by: Chris Ochs | last post by:
I am pretty sure I know this already, but every time you run a Pl/Perl function it is just like running a perl script as far as having to load and...
1
by: Eric D. Nielsen | last post by:
I'm in the process of implementing a "monitor this" type feature on a web-application. When something changes on the monitored item an email to...
5
by: kardon33 | last post by:
Im getting these errors when i use a module, could anyone tell me what they think wrong, its the second one that i think it the problem but i don't...
5
by: eranshuman | last post by:
Hi, I m very new to perl I m running an API which have the Buil.pl When Im compiling using perl Build.pl I was getting error : Can't...
4
by: peterv6 | last post by:
I'm running OS X Snow Leopard on a MacBook Pro. I've installed Mysql using Macports. MySQL works fine, but I need to install the DBI module. I've...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
1
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.