From the course: Oracle Database 12c: Basic SQL

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Using INSTR

Using INSTR - Oracle Database Tutorial

From the course: Oracle Database 12c: Basic SQL

Start my 1-month free trial

Using INSTR

- [Instructor] Oracle's instr function allows us to locate the position of a specific character inside a string. So for example, let's select all data from our employees table. And let's refine our query so that we will only display the first name, last name, as well as the phone number, for all of our employees. So I can type first_name, last_name, and phone_number. Using instr, I can detect the position of a specific literal value inside a string. So for example, let's use the instr function with the phone_number column. This is a varchar column in our table. So we'll type: instr, brackets. The column name, phone_number, in our case, comma and the string value, or literal value, we want to search for inside the column. So for example, let's search for the 650 area code, and we can close the function brackets. By typing instr, followed by the phone_number column, comma 650, Oracle will return us the position of the 650 literal string inside of the phone number value for all rows in…

Contents