I have the following statement which compiles fine in my package:
package header:
TYPE role_user_type IS RECORD (
ROLE_ID some_table.ROLE_ID%TYPE,
SUBGROUP some_table.USER_ID%TYPE
);
body:
ROLE_USER_REC MY_PACKAGE.ROLE_USER_TYPE;
SELECT B.USER_ID, B.ROLE INTO ROLE_USER_REC
FROM some_table where user_id like 'M%'
what is the skeleton for looping through ROLE_USER_REC? can we even loop through it?
There is nothing to loop.
role_user_typedefines a single record, that you can access via:Your
SELECT ... INTOwill fail as soon as more than one row is returned.If you need to store several of those records, you can use nested tables like
TYPE role_user_tab IS TABLE OF role_user_type:Example: