Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Insert Multiple records

kiran mahanthyJul 12 2016 — edited Jul 13 2016

Hi All ,

I am using Oracle 11g DB.

My use case is -

I need to insert multiple records into a DB table using Java code.

I have a java collection (DTO Class with the fields corresponding to the columns of the DB table I need to insert the values into)

I need to pass this to a package pl/sql procedure and insert the values to the table.

I am very new to this. Looking for a sample code !

My Java DTO class :

public class TestDTO {

  

    public String chain;

    public String division;

    public String subdivision;

    public String department;

    public String  productclass;

    public String category;

    public String region;

    public String district;

    public String store;

}

Insert Script

Insert into TESTSTG(ROWID1,CHAIN,DIVISION,SUBDIVISION,DEPARTMENT,PRODUCTCLASS,CATEGORY,REGION,DISTRICT,STORE,SWAT,BOOSTING,

OHTYPE,PRIORITYORDER,SEASONALBUILD,STORESIZEPREF,USERDEFINEDVALUE,TARGETPERCENTAGE,MAX,MIN,BASEWEIGHING,CMFLTYPE,NMFLTYPE,CMLOCID,NMLOCID,

ATTRLEVELERROR,ROWLEVELERROR,DRIVERTYPE,DRIVERVALUE,REMOVEFLAG,STATUS) values

              (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?);


Thanks

Kiran

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 10 2016
Added on Jul 12 2016
6 comments
2,352 views