By API, I assumed masking the call with other PL/SQL procedures.
>>but not sure how I can do that since the cursor value that is needed for insert is only available to
Look at the pseudo code I posted. You pass the cursor values into the stored procedure.
>>and how is it possible to publish this APIs so other applications can use this API?
If you have the procedure declared in the package, it is exposed. to anything that can call that package.
I think where you are going to run into trouble is the procedure would have to account for EVERY column in the table because different 'cursors' from different apps might pass in different values.
For example:
give the table:
create table tab1(col1 char(1), col2 char(1), col3 char(1));
proc1 might have a cursor
select 'a' a,'b' b from dual;
and an insert like:
insert into tab1(col1, col2) values (cur.a, cur.b);
proc2 might have a cursor
select 'a' a,'c' c from dual;
and an insert like:
insert into tab1(col1, col3) values (cur.a, cur.c);
notice both didn't insert into ALL columns in tab1. Your insert proc would need to account for ALL three columns as input parameters.
then that happens if someone adds a column to the table?