sql function example

FUNCTION EXAMPLE:
| LOWER | (loc) |
| function | input to function |
Using LOWER sql function to convert all the location text to lower case latter
SQL> select deptno, LOWER(loc) as location from dept;
DEPTNO LOCATION
---------- -------------
10 new york
20 dallas
30 chicago
40 boston
Using UPPER sql function to convert all the location text to Upper case latter
SQL> select deptno, UPPER(loc) as location from dept;
DEPTNO LOCATION
---------- -------------
10 NEW YORK
20 DALLAS
30 CHICAGO
40 BOSTON
Using INITCAP sql function to convert and make sure the capital latter in from of the location text.
SQL> select deptno, INITCAP(loc) as location from dept;
DEPTNO LOCATION
---------- -------------
10 New York
20 Dallas
30 Chicago
40 Boston
SQL>
MORE EXAMPLE ON SQL FUNCTION:
SQL> SELECT deptno,
2 INITCAP(loc) as location,
3 LENGTH(loc) as "LOCation" from dept;
DEPTNO LOCATION LOCation
---------- ------------- ----------
10 New York 8
20 Dallas 6
30 Chicago 7
40 Boston 6
SQL> SELECT deptno as "DEPartment",
2 INITCAP(loc) as location,
3 LENGTH(loc) as "LOC Length"
4 from dept;
DEPartment LOCATION LOC Length
---------- ------------- ----------
10 New York 8
20 Dallas 6
30 Chicago 7
40 Boston 6
SQL>
- sql_command's blog
- Add new comment
- 1688 reads

Recent comments
15 hours 35 min ago
1 day 17 hours ago
2 days 21 hours ago
3 days 35 min ago
3 days 13 hours ago
4 days 18 hours ago
2 weeks 2 days ago
2 weeks 3 days ago
2 weeks 3 days ago
2 weeks 3 days ago