Oracle SQL – How to Get the First Two Octets of an IP Address

oracle

E.g., IP = '10.11.12.13'
I want to extract '10.11.' or everything except what comes after the 2nd '.'

Best Answer

Regex solution : SELECT REGEXP_SUBSTR("youField", '[0-9]+\.[0-9]+\.') AS "output"

check at http://rextester.com/DJN6158