Hi Friends,
In a package I created a Varchar2 nested table type name EmployeeCodeList.
Then I created a function whose return type is EmployeeCodeList. However I am not getting how will get values from this function?
TYPE EmployeeCodeList IS TABLE OF VARCHAR2(30);
FUNCTION GenerateRandomEcF( Ec_length NUMBER, NumberOfEmp NUMBER )
<<function code>>
END GenerateRandomEcF;
PROCEDURE GenerateEmpFile( NumberOfEmp NUMBER, Start_SN NUMBER, EmpValue NUMBER, HireDate VARCHAR2, EmpGroup VARCHAR2, Ec_length NUMBER) IS
v_Filename VARCHAR2(40);
v_EmployeeCodes EmployeeCodeList;
v_EmpBatchF UTL_FILE.FILE_TYPE;
BEGIN
v_Filename := 'EMPLOYEE_BATCH_'||TO_CHAR(SYSTIMESTAMP, 'YYYYMMDD_HHMISS')||'.DAT';
v_EmployeeCodes := EmployeeCodeList(NumberOfEmp);
v_EmployeeCodes := SELECT * FROM TABLE(GenerateRandomAcF(Ac_length, NumberOfVoucher));
v_EmpBatchF := UTL_FILE.FOPEN('EXT_VOUCHER_DIR', v_Filename, 'W');
IF UTL_FILE.IS_OPEN(v_EmpBatchF) THEN
FOR i IN 1..NumberOfVoucher LOOP
UTL_FILE.PUT_LINE(v_EmpBatchF, v_EmployeeCodes(i)||','||Start_SN+(i-1)||','||EmpValue||','||HireDate||','||EmpGroup );
END LOOP;
END IF;
END GenerateEmpFile;
How the above highlighted line/code should be written so that I can get value of function in a variable of same nested table type.