sql >> Base de Datos >  >> RDS >> Oracle

obtener el argumento de error '0' está fuera de rango

INSTR(ltrim(pn.pname),'REFERENCE ID=')

devuelve 0 (lo que indica que no se encontró la subcadena que está buscando) y si intenta hacer:

 REGEXP_SUBSTR( value, regex, 0 )

Obtendrá el error:

ORA-01428: argument '0' is out of range

En su lugar, podría usar:

REGEXP_SUBSTR(
  pn.pname,
  'REFERENCE ID="(\d+)"',
  1,                      -- Start from the 1st character
  1,                      -- Find the 1st occurrence
  NULL,                   -- No flags
  1                       -- Return the contents of the 1st capturing group
)