简体   繁体   中英

How to pass a List<> to an Oracle stored procedure

I have code that already stores String data inside a SQL table using a stored procedure:

// my DAO
public class SomeProcedure extends StoredProcedure {
    public void process (String data) {
        Map<String, Object> map = new HashMap<String, Object>();
        hm.put("customData", data);
        Map<?,?> result = super.execute(hm);
    }
}

// My pks
procedure storeData (
    data_p in someTable.data%type,
    data_o out someTable.data%type,
)
as
begin
    insert into someTable
...
end storeData;

I need to modify it to include an object List. For example:

// my DAO
public class SomeProcedure extends StoredProcedure {
    public void process (String data, List<someObject> list) {
        Map<String, Object> map = new HashMap<String, Object>();
        hm.put("customData", data);
        hm.put("customList", list);
        Map<?,?> result = super.execute(hm);
    }
}

It is unclear to me how to support a List of objects in the stored procedure.

Does anyone have experience passing and parsing lists of objects to store procedures? Can anyone provide some sample code of what this would look like?

I am using such call in my application (no access to sources now), but its looks like http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:712625135727

One problem I remember was fighting, was SQL exception at runtime, solved by adding orai18n.jar to classpath beside ojdbc14 (for oracle 10g and passing list of strings )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM