Products | Versions |
---|---|
TIBCO ActiveMatrix BusinessWorks | - |
Not Applicable | - |
Below is the DDL script for the Stored Procedure along with dependent objects used in the BW project
++++++++++++
CREATE OR REPLACE TYPE EMP_SALARY_REC AS OBJECT (
EMP_ID NUMBER(5),
EMP_NAME VARCHAR2(255),
START_DATE DATE,
SALARY NUMBER
);
/
CREATE OR REPLACE Type EMP_SALARY_TAB AS TABLE OF EMP_SALARY_REC;
/
CREATE OR REPLACE PACKAGE EMP_SALARY_PKG IS
PROCEDURE GET_EMP_SALARIES(i_array IN EMP_SALARY_TAB,o_array OUT
EMP_SALARY_TAB);
End EMP_SALARY_PKG;
/
create or replace
PACKAGE BODY EMP_SALARY_PKG AS
PROCEDURE GET_EMP_SALARIES(i_array IN EMP_SALARY_TAB,o_array OUT EMP_SALARY_TAB)
IS
emp_salary_rec test.EMP_SALARY_REC;
num_of_months NUMBER;
base_salary_usd NUMBER := 70000;
annual_bonus_pct NUMBER := 3.5;
updated_salary NUMBER;
BEGIN
o_array := i_array;
FOR idx IN i_array.first()..i_array.last() LOOP
emp_salary_rec := i_array(idx);
num_of_months := 24;
updated_salary := (((num_of_months / 12) * annual_bonus_pct) /
100) + base_salary_usd;
emp_salary_rec.SALARY := updated_salary;
o_array(idx) := emp_salary_rec;
END LOOP;
EXCEPTION
WHEN OTHERS THEN
-- handle errors here...
dbms_output.put_line('Error: '||substr(1,255,sqlerrm));
END GET_EMP_SALARIES;
END EMP_SALARY_PKG;
/
+++++++++++++
Alternatively, you can use Ref Cursors instead of object types in the SP parameters.