oracle - ORA-00933: SQL command not properly ended In Spring batch Item Writer -
i writing 1 spring batch based application in have write consolidated xml file data multiple tables of database.
bean id="mysqlitemwriter" class="org.springframework.batch.item.database.jdbcbatchitemwriter"> <property name="datasource" ref="datasource" /> <property name="sql"> <value> <![cdata[ insert lease (lease_id, contract_type, contract_number, lease_amount, description, create_date, register_date) values ( :leaseid, :contracttype, :contactnumber, :leaseamount, :description, :leasecreatedate, :leaseupdatedate) insert customer (customer_id ,first_name, last_name, surname, customer_number, record_code, source_system, birth_date,create_date, update_date,address,street,house_number, state, postal_code, country_code ) values ( :customerid , :firstname, :lastname ,:surname, :customernumber, :recordcode, :sourcesystem, :birthdate, :leasecreatedate, :leaseupdatedate, :address, :housenumber, :city, :state, :postalcode, :countrycode) ]]> </value>
in above code when 1 sql statement there working fine 2 insert statements not working fine. giving error "ora-00933: sql command not ended" . when inserting ; after first insert statement showing same error not able resolve this..
you can try wrapping 2 statements inside pl/sql anonymous block (make sure don't forget of required semi colons).
begin insert ...; insert ...; end;
technically, should treated single statement , should work.
bean id="mysqlitemwriter" class="org.springframework.batch.item.database.jdbcbatchitemwriter"> <property name="datasource" ref="datasource" /> <property name="sql"> <value> <![cdata[ begin insert lease (lease_id, contract_type, contract_number, lease_amount, description, create_date, register_date) values ( :leaseid, :contracttype, :contactnumber, :leaseamount, :description, :leasecreatedate, :leaseupdatedate); insert customer (customer_id ,first_name, last_name, surname, customer_number, record_code, source_system, birth_date,create_date, update_date,address,street,house_number, state, postal_code, country_code ) values ( :customerid , :firstname, :lastname ,:surname, :customernumber, :recordcode, :sourcesystem, :birthdate, :leasecreatedate, :leaseupdatedate, :address, :housenumber, :city, :state, :postalcode, :countrycode); end; ]]> </value>
Comments
Post a Comment