Avatar of Sarma Vadlamani
Sarma Vadlamani
 asked on

oracle query

hi i want to get
the data only from second error i.e., using regexp or substr
ORA-28007:The pwd cannot be reused.
ORA-06502: PL/SQL:numeric or value error ORA-28007:The pwd cannot be reused.

thanks.
Oracle Database

Avatar of undefined
Last Comment
slightwv (䄆 Netminder)

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
slightwv (䄆 Netminder)

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
johnsone

Assuming that you have the error message in column COL1, this should do it:

SUBSTR(COL1, INSTR(COL1, 'ORA-', 1, 2))
slightwv (䄆 Netminder)

Just in case you ever want just the second error no matter what:
with mydata as(
select 'ORA-28007:The pwd cannot be reused. 
 ORA-06502: PL/SQL:numeric or value error ORA-28007:The pwd cannot be reused.
' myerror from dual
)
select
regexp_substr(myerror,'(ORA-[0-9]{5}.+)(ORA-[0-9]{5})',1,1,null,1)
from mydata;

Open in new window


This returned:
ORA-06502: PL/SQL:numeric or value error
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck