Me hiciste el día gnzsoloyo,
Tengo los resultados de ambas consultas, pero aun necesito saber (o desifrar) donde consigo los valores que obtiene al realizar dicha consulta, por ahi veo un FROM DUAL, el cual dicha vista/tabla no existe.
Código SQL:
Ver originalFUNCTION TEF_SELECTION_VALUES ( FORMULARIO VARCHAR2, IDFIELD VARCHAR2, P_CODIGO NUMBER) RETURN varchar2 IS
XXXX VARCHAR2(90);
L_TEF_TAB_SELECT_VALUES TEF_TAB_SELECT_VALUES:= TEF_TAB_SELECT_VALUES();
F_DATOS VARCHAR2(4000);
F_ELEMENTOS NUMBER(15);
F_LONGUITUD NUMBER(15);
L_LOCALE VARCHAR2(30);
L_VALUE VARCHAR2(255);
L_NUMBER NUMBER(15);
X NUMBER(15) :=0;
R NUMBER(15) :=0;
CURSOR C1 IS
SELECT DISTINCT
TO_NUMBER(FUENTE.LONGUITUD, '999990') AS LONGUITUD,
TO_NUMBER(SUBSTR(SUBSTR(FUENTE.CADENA, LENGTH(FUENTE.LONGUITUD)+2, LENGTH(FUENTE.CADENA)-LENGTH(FUENTE.LONGUITUD)+1), 1, INSTR(SUBSTR(FUENTE.CADENA, LENGTH(FUENTE.LONGUITUD)+2, LENGTH(FUENTE.CADENA)-LENGTH(FUENTE.LONGUITUD)+1), '\')-1), '999990') AS ELEMENTOS,
SUBSTR(SUBSTR(SUBSTR(FUENTE.CADENA, LENGTH(FUENTE.LONGUITUD)+2, LENGTH(FUENTE.CADENA)-LENGTH(FUENTE.LONGUITUD)+1), INSTR(SUBSTR(FUENTE.CADENA, LENGTH(FUENTE.LONGUITUD)+2, LENGTH(FUENTE.CADENA)-LENGTH(FUENTE.LONGUITUD)+1), '\'), LENGTH(SUBSTR(FUENTE.CADENA, LENGTH(FUENTE.LONGUITUD)+2, LENGTH(FUENTE.CADENA)-LENGTH(FUENTE.LONGUITUD)+1))-INSTR(SUBSTR(FUENTE.CADENA, LENGTH(FUENTE.LONGUITUD)+2, LENGTH(FUENTE.CADENA)-LENGTH(FUENTE.LONGUITUD)), '\')), 1, FUENTE.LONGUITUD) AS CADENA,
FUENTE.LOCALE AS LOCALE
FROM
(SELECT SUBSTR(SUBSTR(NVL(PROPSHORT, PROPLONG), INSTR(NVL(PROPSHORT, PROPLONG), '\230\4\')+7, LENGTH(NVL(PROPSHORT, PROPLONG))-INSTR(NVL(PROPSHORT, PROPLONG), '\230\4\')), 1, INSTR(SUBSTR(NVL(PROPSHORT, PROPLONG), INSTR(NVL(PROPSHORT, PROPLONG), '\230\4\')+7, LENGTH(NVL(PROPSHORT, PROPLONG))-INSTR(NVL(PROPSHORT, PROPLONG), '\230\4\')), '\')-1) AS LONGUITUD,
SUBSTR(NVL(PROPSHORT, PROPLONG), INSTR(NVL(PROPSHORT, PROPLONG), '\230\4\')+7, LENGTH(NVL(PROPSHORT, PROPLONG))-INSTR(NVL(PROPSHORT, PROPLONG), '\230\4\')) AS CADENA,
D.LOCALE AS LOCALE
FROM ARSCHEMA A, FIELD B, FIELD_DISPPROP C, VUI D
WHERE A.SCHEMAID = B.SCHEMAID
AND B.SCHEMAID = C.SCHEMAID
AND A.SCHEMAID = D.SCHEMAID
AND C.FIELDID = B.FIELDID
AND D.VUIID = C.VUIID
AND D.LOCALE LIKE 'es%'
AND B.FIELDID = IDFIELD
AND A.SCHEMAID = (SELECT SCHEMAID FROM ARSCHEMA WHERE NAME = FORMULARIO)) FUENTE;
BEGIN
OPEN C1;
FETCH C1 INTO F_LONGUITUD, F_ELEMENTOS, F_DATOS, L_LOCALE;
LOOP
IF F_DATOS IS NULL THEN EXIT; END IF;
--x :=0;
R :=0;
FOR R IN 1..F_ELEMENTOS LOOP
--dbms_output.PUT_LINE(f_datos);
SELECT REPLACE(SUBSTR(F_DATOS, 1, INSTR(F_DATOS, '\', 2)), '\', '') INTO L_NUMBER FROM DUAL;
--dbms_output.PUT_LINE(l_number);
SELECT '\' || REPLACE('@' || F_DATOS, '@' || SUBSTR(F_DATOS, 1, INSTR(F_DATOS, '\', 2)), '') INTO F_DATOS FROM DUAL;
--dbms_output.PUT_LINE(f_datos);
SELECT REPLACE(SUBSTR(F_DATOS, 1, INSTR(F_DATOS, '\', 2)), '\', '') INTO L_VALUE FROM DUAL;
--dbms_output.PUT_LINE(l_value);
SELECT '\' || REPLACE('@' || F_DATOS, '@' || SUBSTR(F_DATOS, 1, INSTR(F_DATOS, '\', 2)), '') INTO F_DATOS FROM DUAL;
L_TEF_TAB_SELECT_VALUES.EXTEND;
L_TEF_TAB_SELECT_VALUES (X + 1) := TEF_OBJ_SELECT_VALUES(FORMULARIO, IDFIELD, L_NUMBER, L_VALUE, L_LOCALE);
XXXX:=L_VALUE;
EXIT WHEN L_NUMBER=P_CODIGO;
X := X + 1;
END LOOP;
FETCH C1 INTO F_LONGUITUD, F_ELEMENTOS, F_DATOS, L_LOCALE;
EXIT WHEN C1%NOTFOUND;
END LOOP;
CLOSE C1;
RETURN XXXX;
END;
[/QUOTE]