ARRAY TYPE
declare
CURSOR CUR IS
select TRANSACTION_TYPE_ID
from MTL_TRANSACTION_TYPES
where
TRANSACTION_TYPE_NAME IN
(select MEANING
from FND_LOOKUP_VALUES_VL
WHERE LOOKUP_TYPE = 'LOOKUP TYPE'
AND ENABLED_FLAG = 'Y'
AND TRUNC(START_DATE_ACTIVE)
<= TRUNC(SYSDATE)
AND (END_DATE_ACTIVE IS NULL OR
TRUNC(END_DATE_ACTIVE) >= TRUNC(SYSDATE)));
type t_values is table of number(20) INDEX BY pls_integer; --varchar2(20);
a_values t_values;
lv_num integer := 1;
begin
-- Test statements here
/*OPEN CUR;
FETCH CUR BULK
COLLECT INTO a_values;--l_column_list;
CLOSE CUR;*/
for c_cursor in cur loop
a_values(c_cursor.TRANSACTION_TYPE_ID) := c_cursor.TRANSACTION_TYPE_ID;
end loop;
DBMS_OUTPUT.put_line(a_values.count);
begin
IF a_values(lv_num) = lv_num THEN
DBMS_OUTPUT.put_line(lv_num);
end if;
exception
when others then
DBMS_OUTPUT.put_line('error');
end;
end;
/*2
86
123*/
NESTED TABLE TYPE
DECLARE
TYPE type_cd IS TABLE OF NUMBER;
v_my_list type_cd;
lv_bum number := 86;
begin
BEGIN
select TRANSACTION_TYPE_ID --LISTAGG(TRANSACTION_TYPE_ID, '|') WITHIN GROUP(ORDER BY
1)
bulk collect
into v_my_list
-- INTO
lv_trans_types_ids
from MTL_TRANSACTION_TYPES
where
TRANSACTION_TYPE_NAME IN
(select MEANING
from FND_LOOKUP_VALUES_VL
WHERE LOOKUP_TYPE = 'LOOKUP TYPE'
AND ENABLED_FLAG = 'Y'
AND TRUNC(START_DATE_ACTIVE)
<= TRUNC(SYSDATE)
AND (END_DATE_ACTIVE IS NULL OR
TRUNC(END_DATE_ACTIVE) >= TRUNC(SYSDATE)));
-- lv_trans_types_ids:='^('||lv_trans_types_ids||')$';
EXCEPTION
WHEN OTHERS THEN
v_my_list := NULL;
END;
IF lv_bum MEMBER OF v_my_list THEN
dbms_output.put_line('chida');
END IF;
END;
No comments:
Post a Comment