Case Study:
Get only positive Values
Practice Table:
create table plch_employees (
id integer primary key
, name varchar2(40)
, gender char(1)
)
/
insert into plch_employees values (-100, 'Mr. John Doe','M')
/
insert into plch_employees values (-200, 'Mrs. Jane Doe','F')
/
insert into plch_employees values (300, 'Ms. Julie Doe','F')
/
insert into plch_employees values (-400, 'Mr. Jack Doe','M')
/
insert into plch_employees values (500, 'Dr. James Doe','M')
/
insert into plch_employees values (600, 'Jonathan Doe','M')
/
insert into plch_employees values (700, 'Jeff Jr. Doe','M')
/
commit
/
ABS
Syntax
Purpose
The ABS function returns the absolute value of a number, which will always be zero or a positive number.
This function takes as an argument any numeric data type or any nonnumeric data
type that can be implicitly converted to a numeric data type.
Examples
The following example returns the absolute value of -15:
SELECT ABS (-15) "Absolute"
FROM DUAL;
Absolute
----------
15
No comments:
Post a Comment