Jump to content

Check Last Position at which value occurs through pl/sql

Recommended Posts


Hello boobal


with t1 as (select 'A+++500+read++' col1 from dual)
select regexp_count(substr(col1,1,regexp_instr(col1,'[^\+]+',1,regexp_count(col1,'[^\+]+'))-1),'\+') from t1;

This queyr you gave for finding total count of '+' before last value..Here last value is 'read'.So with this query i got total count of '+' before 'read' as 4 which is absolutely right.

It was a sample data which i provided u.But in my table data is like this..



When i am running the same query for 'dual',then it works.But when i m running the same query for my real table,then i get error.:-''0 out of range''.

Whats solution for this??Due to 0,query is not working.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now