cancel
Showing results for 
Search instead for 
Did you mean: 

java.sql.SQLException: ORA-00947: not enough values

Former Member
0 Kudos

Hi Experts,

i am creating an application on web dynpro java, i have created a form where user will fill in details and the data will get stored in oracle database.

while saving the form, i am getting this error:

Saving problem in Form. Contact System administrator

java.sql.SQLException: ORA-00947: not enough values

my sql query is :

queryinsert="insert into hsemonthly_report1(bgroup,bvertical,pvertical,site,months,years,key1,key2,key3,manhour1, manhour2,ip_emp1,ip_emp2,ip_emp3,ip_emp4,ip_con1,ip_con2,ip_con3,ip_con4,ip_cases,ip_injured,ip_totalman,ip_totalcost,ht_topic,ht_train_mth,ht_manhrs_mth,ht_toolbox_mth,ht_hours_mth,ht_inducted_mth,ht_manhrs_ca,ht_toolbox_ca,ht_hours_ca,ht_inducted_ca,lc_govt_mo,lc_penalties_mo,lc_cause_mo,lc_other_mo,lc_govt_co,lc_penalties_co,lc_cause_co,lc_other_co,PK_VALUE,euser, key4, key5,mh_total, incidence_performance1, incidence_performance2, lti_contractor, lti_total, ip_fy1, mdl_contractor, mdl_total, ip_fy2, fr_1, fr1_emp, fr2_con, fr_emp, fr_con, fr, sr1_emp, sr2_con, sr_1, sr_emp, sr_con, sr, capa_closed, comment1  )" +

                            " values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";

                PreparedStatement pstat=null;

                pstat=conn.prepareStatement(queryinsert);

                pstat.setString(1,(ele.getBusiness_group()));

                pstat.setString(2,(ele.getProjectname()));

                pstat.setString(3,(ele.getProjectvertical()));

                pstat.setString(4,(ele.getSite()));

                pstat.setString(5,(ele.getMonth()));

                pstat.setString(6,(ele.getYear()));

                pstat.setString(7,(key.getK1()));

                pstat.setString(8,(key.getK2()));

                pstat.setString(9,(key.getK3()));

                pstat.setString(10,(key.getK4()));

                pstat.setString(11,(key.getK5()));

                pstat.setFloat(10,(ele.getManhour1()));

                pstat.setFloat(11,(ele.getManhour2()));

                pstat.setFloat(10,(ele.getMH_Total()));

                pstat.setInt(12,(inc.getEmp_m1()));

                pstat.setInt(13,(inc.getEmp_m2()));

                pstat.setInt(14,(inc.getEmp_m3()));

                pstat.setInt(15,(inc.getEmp_m4()));

                pstat.setInt(16,(inc.getCon_m1()));

                pstat.setInt(17,(inc.getCon_m2()));

                pstat.setInt(18,(inc.getCon_m3()));

                pstat.setInt(19,(inc.getCon_m4()));

                pstat.setInt(20,(inc.getM1()));

                pstat.setInt(21,(inc.getM2()));

                pstat.setInt(22,(inc.getM3()));

                pstat.setInt(23,(inc.getM4()));

                pstat.setString(24,(tra.getTopic()));

                pstat.setInt(25,(tra.getM1()));

                pstat.setInt(26,(tra.getM2()));

                pstat.setInt(27,(tra.getM3()));

                pstat.setInt(28,(tra.getM4()));

                pstat.setInt(29,(tra.getM5()));

                pstat.setString(30,(tra.getC1()));

                pstat.setString(31,(tra.getC2()));

                pstat.setString(32,(tra.getC3()));

                pstat.setString(33,(tra.getC4()));

                pstat.setInt(34,(leg.getM1()));

                pstat.setInt(35,(leg.getM2()));

                pstat.setInt(36,(leg.getM3()));

                pstat.setInt(37,(leg.getM4()));

                pstat.setString(38,(leg.getC1()));

                pstat.setString(39,(leg.getC2()));

                pstat.setString(40,(leg.getC3()));

                pstat.setString(41,(leg.getC4()));

                pstat.setString(42,pk);

                pstat.setString(43,euser);

                pstat.setFloat(44,(ele.getIncident_performance1()));

                pstat.setFloat(45,(ele.getIncident_performance2()));

                pstat.setFloat(46,(ele.getLti_contractor()));

                pstat.setFloat(47,(ele.getLti_total()));

                pstat.setFloat(48,(ele.getIp_fy1()));

                pstat.setFloat(49,(ele.getIp_fy2()));

                pstat.setFloat(50,(ele.getMdl_contractor()));

                pstat.setFloat(51,(ele.getMdl_total()));

                pstat.setFloat(52,(ele.getFr_1()));

                pstat.setFloat(53,(ele.getFr1_emp()));

                pstat.setFloat(54,(ele.getFr2con()));

                pstat.setFloat(55,(ele.getFr_emp()));

                pstat.setFloat(56,(ele.getFr_con()));

                pstat.setFloat(57,(ele.getFr()));

                pstat.setFloat(58,(ele.getSr1_emp()));

                pstat.setFloat(59,(ele.getSr2_con()));

                pstat.setFloat(60,(ele.getSr_1()));

                pstat.setFloat(61,(ele.getSr_emp()));

                pstat.setFloat(62,(ele.getSr_con()));

                pstat.setFloat(63,(ele.getSr()));

                pstat.setFloat(64,(ele.getCapa_closed()));

                pstat.setString(65,(inc.getComment1()));

please help me out guys.

Accepted Solutions (1)

Accepted Solutions (1)

former_member182374
Active Contributor
0 Kudos

Hi,

The error says the the number of ? is not equals to the number of parameters you set.

It seems you missed something with your copy/paste (-:

pstat.setString(10,(key.getK4())); 

pstat.setString(11,(key.getK5()));

pstat.setFloat(10,(ele.getManhour1()));

pstat.setFloat(11,(ele.getManhour2()));

pstat.setFloat(10,(ele.getMH_Total()));

Check the above lines in your code.

Regards,

Omri

Former Member
0 Kudos

hi again,

my issue got resolved but I am again getting this error:

Saving Problem in form. contact your system administrator

java.sql.SQLException:ORA-01722: invalid number.

please help me out with this

Answers (0)