The below is my code:
SELECT
/*+ parallel (sales 8) */
COUNT(1)
INTO v_datacount_actualtable
FROM sales
WHERE processingunitseq=38
AND (compensationdate BETWEEN TO_DATE(v_startdate,'DD-MON-YYYY') AND TO_DATE(v_enddate,'DD-MON-YYYY')
OR eventtypeseq IN
(SELECT EVENTTYPESEQ FROM EPS_FRS_PAYMENTS
));
SELECT EVENTTYPESEQ FROM EPS_FRS_PAYMENTS
will return 4 values. So I cannot do a simple SELECT INTO.
I want to store the result of SELECT EVENTTYPESEQ FROM EPS_FRS_PAYMENTS
into a variable and make the code something like below, so that the subquery is not executed each time.
SELECT
/*+ parallel (sales 8) */
COUNT(1)
INTO v_datacount_actualtable
FROM sales
WHERE processingunitseq=38
AND (compensationdate BETWEEN TO_DATE(v_startdate,'DD-MON-YYYY') AND TO_DATE(v_enddate,'DD-MON-YYYY')
OR eventtypeseq = v_frseventpeseqs );
SELECT EVENTTYPESEQ FROM EPS_FRS_PAYMENTS
returns four values:
1,
2,
3,
4,
I do not want to hardcode these values in the code as it is a bad practice. Need it in a variable like v_frseventypeseqs.
How can I do that - array/ collection/records/bulk collect into?