Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

REGEXP_INSTR

968430Oct 15 2012 — edited Oct 15 2012
I've created a PLSQL function to scroll through a table and replace card numbers with asterisks. However, the number of tables that need to be updated could increase so I have used a REF CURSOR and that will take in a table name read from a table of table names.

The format of card numbers can also change so I have put regular expressions into a table and I use a cursor to retrieve those as necessary.

My problem is if I do this:--

IF REGEXP_instr (m_test_rec.narrative, '[0-9]{5}[A-Z]{1}-[0-9]{5}') > 0 THEN

the IF statement works.

If I do this:-

IF REGEXP_instr (m_test_rec.narrative, m_format_rec.bcf_format) > 0 THEN

(where M_FORMAT_REC.BCF_FORMAT is a VARCHAR2 string that equals '[0-9]{5}[A-Z]{1}-[0-9]{5}') the IF statement does not work. I have tried RTRIM/LTRIM and putting double quotes in the table field (ie ''[0-9]{5}[A-Z]{1}-[0-9]{5}'') but neither work.

When I try to use the REGEXP_INSTR in a cursor in this manner it works fine. However, I want to test this second way for timing issues (job currently takes 15 hours).

thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 12 2012
Added on Oct 15 2012
1 comment
178 views