Class 12 |MySQL 19

Text Functions

DUAL Table

Dual is a special inbuilt table in ORACLE with one row and one column storing “X”. It is generally used to perform calculation , to execute functions with user defined values and display(use ) date functions.

select 2*3 from dual;
select 10+20 from dual;

Lower()

This function helps us to convert / display value of a column or user defined value to lower case.

Select lower(‘COMPUTER’) from dual;

Output:
computer

Select name , lower(name) from std;

Ram ram
MOHAN mohan

To change all the names to lower case in table? And save.

Update std set name=lower(name);
Commit;

Upper()

This function helps us to convert / display value of a column or user defined value to upper case.

Select upper(‘computer’) from dual;

COMPUTER

Select name, upper (name) from STD;

Ram RAM
Mohan kumar MOHAN KUMAR

To convert all the names to upper case in the database.

Update std set name=upper (name);
Commit;

Length()

Helps us to find the length of value of a column or user defined string.

Select name,length(name) from emp;

Ram 3
Mohan 5
Kapil 5
Ram kumar 9

Select length(‘computer’) from dual;
8
Select length(‘hello world’) from dual;
11

Ascii()

Helps us to display ascii value of the specified character. If string is passed as an arguments the ascii value of 1st character is displayed.

Select ascii(‘a’), ascii(‘A’) from dual;
97 65

select ascii(‘a’),ascii(‘abc’) from dual;
97 97

Char()

Helps us to display the character form a specified ascii value

Select char(65),char(90),char(97),char(122) from dual;

A Z a z