Sorry for jumping in.
You can also get the results using an 'iterator' :
As per your example (4th ocurrence of '_':
BTEQ -- Enter your SQL request or BTEQ command:
SELECT SUBSTR(pre.cadena, it.iterador, 1) caracter,
it.iterador posicion
FROM ( SELECT '1_3_5_7_9_ABCDEF' cadena ) pre,
( SELECT day_of_calendar iterador FROM SYS_CALENDAR.CALENDAR WHERE DAY_OF_CALENDAR < 16) it
WHERE caracter='_'
QUALIFY ROW_NUMBER() OVER (ORDER BY posicion) = 4
;
*** Query completed. One row found. 2 columns returned.
*** Total elapsed time was 1 second.
caracter posicion
-------- -----------
_ 8
HTH.
Cheers.
Carlos.
Sorry for jumping in.
You can also get the results using an 'iterator' :
As per your example (4th ocurrence of '_':
BTEQ -- Enter your SQL request or BTEQ command:
SELECT SUBSTR(pre.cadena, it.iterador, 1) caracter,
it.iterador posicion
FROM ( SELECT '1_3_5_7_9_ABCDEF' cadena ) pre,
( SELECT day_of_calendar iterador FROM SYS_CALENDAR.CALENDAR WHERE DAY_OF_CALENDAR < 16) it
WHERE caracter='_'
QUALIFY ROW_NUMBER() OVER (ORDER BY posicion) = 4
;
*** Query completed. One row found. 2 columns returned.
*** Total elapsed time was 1 second.
caracter posicion
-------- -----------
_ 8
HTH.
Cheers.
Carlos.