Welcome to plsql4all.blogspot.com SQL, MYSQL, ORACLE, TERADATA, MONGODB, MARIADB, GREENPLUM, DB2, POSTGRESQL.

Friday, 23 February 2024

position Function in Oracle

In Oracle, the POSITION function is used to find the position of a substring within a string. It returns an integer value representing the position of the first occurrence of the substring within the string. If the substring is not found, it returns 0.


Here's the syntax of the POSITION function in Oracle:


POSITION(substring IN string)


- substring: The substring to search for within the string.

- string: The string in which to search for the substring.


Example:

SELECT POSITION('world' IN 'hello world') AS position FROM dual;


This will return 7, indicating that the substring 'world' starts at the 7th position within the string 'hello world'.

No comments:

Post a Comment

Please provide your feedback in the comments section above. Please don't forget to follow.