Character Manipulation
Character Manipulation
CONCAT
LENGTH
REVERSE
REPLACE
TRANSLATE
SUBSTR
INSTR
TRIM
RTRIM
LTRIM
LPAD
RPAD
ASCII
CHR
CONCAT
CONCAT:
(i) It accept exactly two arguments.
(ii)It used to concatenating two input strings.
SYNTAX:
CONCAT(input_string1,input_string2)
select CONCAT('Oracle','Database') from dual;
LENGTH:
(i) It accept only one argument.
(ii)It Display length of the string
SYNTAX:
Length(input_string1)
REVERSE:
(i) It accept only one argument.
(ii)It Display string in reverse order.
REPLACE:
(i) It accept two or three arguments.
(ii)It used to perform find and replace.
SYNTAX:
REPLACE (input_string,finding_string,replacing_string)
TRANSLATE:
SYNTAX
TRANSLATE(input_string,finding_character,replacing_character)
DIff:
SUBSTR:
SYNTAX
SUBSTR(input_string,starting_position,length)
Question:
empname(3 letter)+emp_id
select employee_id,first_name, CONCAT(SUBSTR(first_name,1,3),employee_id) from
employees;
INSTR:
(i) It accept two or four arguments.
(ii) It used to find the position of finding string.
SYNTAX:
INSTR(input_string,finding_string,starting_position,nth occurance)
select email,SUBSTR(email,1,INSTR(email,'@',1,1)-1)Name,
SUBSTR(email,INSTR(email,'@',1,1)+1) Domain_name from t1;
TRIM:
(i). It accept one argument
(ii).It is used to remove special characters or spaces on both sides.
SYNTAX:
TRIM(special_character from input_string)
RTRIM:
(i). It accept one or two Arguments
(ii).It is used to remove special characters or spaces on right hand side.
RTRIM (input_string,special_char)
RPAD:
It accept two or three Arguments
It is used to adding special characters on RIGHT hand sides
SYNTAX:
RPAD(input_string,length,padding_character)
Syntax(input_character)
CHR:
(ii).It accept one argument.
(ii).It used to get character value from ASCII char.