To concatenate two and more strings into one, you can use || the string concatenation operator
select 'MY' ||' ' ||'LOVE' || ' ' || 'MY' || ' ' || 'INDIA' ;
Output :"MY LOVE MY INDIA"
Ex:- Find the email domain name from email address using substring or position sting function .
do
$$
declare email varchar;g1 varchar;
begin
g1:='tarun@capgemini.com';
email:=(
select substring(g1,
(position('@' in g1)+1),
length(g1) - position('@' in g1)));
raise notice '%',email;
end;
$$
Ex:- How to repeat star at email domain name from email address using substring or position sting function
do
$$
declare email varchar:='tarun@capgemini.com';g1 varchar;
begin
g1:=(select substring(email,1,2) ||repeat('*',5) || substring(email,position('@' in email),
length(email)- position('@' in email)+1));
raise notice '%' ,g1;
end
$$
No comments:
Post a Comment