i have a column containing hostnames in the format of :
oraclehost.server.region.company.net
How to extract the oraclehost
part from the hostname i.e the string before the first .
.
Please sugges.Thanks.
i have a column containing hostnames in the format of :
oraclehost.server.region.company.net
How to extract the oraclehost
part from the hostname i.e the string before the first .
.
Please sugges.Thanks.
Alternatively, substr + instr
combination which would probably perform better for large data sets:
substr(hostnames, 1, instr(hostnames, '.') - 1)
For example:
SQL> with mytable (hostnames) as
2 (select 'oraclehost.server.region.company.net' from dual)
3 select substr(hostnames, 1, instr(hostnames, '.') - 1) result
4 from mytable;
RESULT
----------
oraclehost
SQL>