How split a string by delimited in Oracle?

A delimiter-separated string can be converted to a set of rows in Oracle SQL, with the combination of the regex function REGEX_SUBSTR and recursion via CONNECT BY. This feature can be used for splitting a single input string with comma-separated query parameters, into a list of values.

Does substring work in Oracle?

The Oracle/PLSQL SUBSTR functions allows you to extract a substring from a string.

How Split comma-separated Values in PL SQL?

How to split comma separated value strings into rows in Oracle…

  1. Using replace ( str, ‘,’ ) to remove all the commas from the string.
  2. Subtracting the length of the replaced string from the original to get the number of commas.
  3. Add one to this result to get the number of values.


The Oracle REGEXP_SUBSTR() function is an advanced version of the SUBSTR() function that allows you to search for substrings based on a regular expression. Instead of returning the position of the substring, it returns a portion of the source string that matches the regular expression.

How do I split a string in SQL?

The STRING_SPLIT(string, separator) function in SQL Server splits the string in the first argument by the separator in the second argument. To split a sentence into words, specify the sentence as the first argument of the STRING_SPLIT() function and ‘ ‘ as the second argument. FROM STRING_SPLIT( ‘An example sentence.

How split comma separated values in SQL query into columns?

Lets split the comma separated phone number list into columns, For this we will use Cross Apply operator, String_Split function and SQL pivot. Following query is used for splitting a comma separated phone number list into columns.

What is Regexp_like in Oracle?

The Oracle REGEXP_LIKE() function is an advanced version of the LIKE operator. The REGEXP_LIKE() function returns rows that match a regular expression pattern. Noted that in SQL standard, REGEXP_LIKE is an operator instead of a function.

How do I split a string after a specific character in SQL?

How to Split a String by a Delimited Char in SQL Server?

  1. Use of STRING_SPLIT function to split the string.
  2. Create a user-defined table-valued function to split the string,
  3. Use XQuery to split the string value and transform a delimited string into XML.

How to get a substring in SQL?

The source_string is the string from which you want to extract the substring.

  • The position is the starting position where the substring begins. The first position of the string is one (1).
  • The length is the length of the substring. The length argument is optional.
  • How to use substr in SQL?

    string (mandatory): This is the base string value that the substring is obtained from.

  • start_position (mandatory): This is the starting position of the substring within the string. It’s where the substring starts from.
  • length (optional): This is the number of characters to extract from string,to create the substring.
  • What is substring in SQL?

    Syntax for Substring () The substring () in SQL server Expression can be any character,binary,text or image.

  • Rules for using SUBSTRING (): All three arguments are mandatory in MSSQL substring () function.
  • T-SQL Substring Examples: Query 2: SUBSTRING () in SQL server with the length greater than Total Maximum length of expression.
  • How to trim everything after certain character in SQL?

    – original_string is the text or reference to the cell that you want to work on. – old_character is the character that you want to replace. – new_character is the character that you want to replace old_character with. – instance_number is the instance of the old_character that you want to replace.