I have a stored procedure in my database which inserts data to 3 tables. The procedure is compiled correctly. I have tested it with PL/SQL DEVELOPER tool with sample data & it is working fine.In the code of stored procedure I have used a variable successCnt1 which counts the no. of successful insertion statements. This variable then assigned to successCnt. I am taking the value of this variable from code behind. If successCnt == 0 then an error is shown.Problem is when I am calling it from C# code behind the procedure returns successCnt == 0. Please show me where I have done wrong!! Thanks in advance.Table Schema:TBLTRAIN Schema: {TRAINID (VARCHAR2(5)), DATE1 (DATE) , AC2SEAT (NUMBER) ,AC3SEAT (NUMBER) , SLEEPERSEAT (NUMBER) ,ACCHAIRCARSEAT (NUMBER) ,SECONDSEAT (NUMBER)}TBLTRAINFARE Schema: {TRAINID (VARCHAR2(5)), CLASS (VARCHAR2(5)), FARE (NUMBER)}TBLTRAINDETAIL Schema: {TRAINID (VARCHAR2(5)) , FROM1 (VARCHAR2(15)), TO1 (VARCHAR2(15)) , TRAINNAME (VARCHAR2(15)) }The Procedure:\[code\]CREATE OR REPLACE PROCEDURE TrainInsertByParameter (p_ac2seat in number, p_ac3seat in number, p_ccseat in number, p_sleeperseat in number, p_secondseat in number, p_date1 in date, p_trainid in varchar2, p_fare in number, p_fromplace in varchar2, p_toplace in varchar2, p_class in varchar2, p_trainname in varchar2, p_successCnt out number) ISsuccessCnt1 number(6) NOT NULL := 0;rowUpdated1 number(6) NOT NULL := 0;rowUpdated2 number(6) NOT NULL := 0;rowUpdated3 number(6) NOT NULL := 0;BEGIN SAVEPOINT before; INSERT INTO tbltrain (ac2seat,ac3seat,acchaircarseat,sleeperseat,secondseat,date1,trainid) VALUES(p_ac2seat,p_ac3seat,p_ccseat,p_sleeperseat,p_secondseat,p_date1,p_trainid);rowUpdated1 := SQL%RowCount;successCnt1 := successCnt1 + 1; dbms_output.put_line('Successful Insertion tbltrain. count ='||successCnt1); dbms_output.put_line('Successful Insertion tbltrain. Row Updated ='||rowUpdated1); INSERT INTO tbltraindetail (trainid,trainname,from1,to1) VALUES(p_trainid,p_trainname,p_fromplace,p_toplace);rowUpdated2 := SQL%RowCount;successCnt1 := successCnt1 + 1; dbms_output.put_line('Successful Insertion tbltraindetail. count ='||successCnt1); dbms_output.put_line('Successful Insertion tbltraindetail. Row Updated= '||rowUpdated2);INSERT INTO tbltrainfare(trainid,class,fare) VALUES (p_trainid,p_class,p_fare);rowUpdated3 := SQL%RowCount;successCnt1 := successCnt1 + 1;p_successCnt := successCnt1; COMMIT; dbms_output.put_line('Successful Insertion tbltrainfare. count ='||p_successCnt); dbms_output.put_line('Successful Insertion tbltrainfare. Row Updated= '||rowUpdated3); EXCEPTION WHEN Others THEN successCnt1 := 0; p_successCnt := successCnt1; dbms_output.put_line('An error has occured. count ='||p_successCnt); ROLLBACK TO before;END;\[/code\]Calling Code of C# Code Behind (using Microsoft Visual Studio))\[code\]OracleConnection con1 = new OracleConnection(); con1.ConnectionString = ConfigurationManager.ConnectionStrings["myConnectionStringOracle"].ConnectionString; Int32 fare = Convert.ToInt32(txtFare.Value); String date1 = txtDate.Value.ToString(); String class1 = ddlClass.SelectedItem.Text.ToString(); String fromplace = txtFromPlace.Text.ToString(); String toplace = txtToPlace.Text.ToString(); String trainid = txtId1.Text.ToString(); String trainname = txtTrainName.Text.ToString(); Int32 ac2seat = Convert.ToInt32(txtAc2TierSeat.Value); Int32 ac3seat = Convert.ToInt32(txtAc3TierSeat.Value); Int32 ccseat = Convert.ToInt32(txtAcChairCarSeat.Value); Int32 sleeperseat = Convert.ToInt32(txtSleeperSeat.Value); Int32 secondseat = Convert.ToInt32(txtSecondSeat.Value); Int32 SuccessCnt; OracleCommand cmd = new OracleCommand(); cmd.Connection = con1; cmd.CommandText = "TrainInsertByParameter"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("p_ac2seat", OracleType.Number).Value = http://stackoverflow.com/questions/15730026/ac2seat; cmd.Parameters.Add("p_ac3seat", OracleType.Number).Value = http://stackoverflow.com/questions/15730026/ac3seat; cmd.Parameters.Add("p_ccseat", OracleType.Number).Value = http://stackoverflow.com/questions/15730026/ccseat; cmd.Parameters.Add("p_sleeperseat", OracleType.Number).Value = http://stackoverflow.com/questions/15730026/sleeperseat; cmd.Parameters.Add("p_secondseat", OracleType.Number).Value = http://stackoverflow.com/questions/15730026/secondseat; cmd.Parameters.Add("p_date1", OracleType.DateTime).Value = http://stackoverflow.com/questions/15730026/date1; cmd.Parameters.Add("p_trainid", OracleType.VarChar).Value = http://stackoverflow.com/questions/15730026/trainid; cmd.Parameters.Add("p_fare", OracleType.Number).Value = http://stackoverflow.com/questions/15730026/fare; cmd.Parameters.Add("p_fromplace", OracleType.VarChar).Value = http://stackoverflow.com/questions/15730026/fromplace; cmd.Parameters.Add("p_toplace", OracleType.VarChar).Value = http://stackoverflow.com/questions/15730026/toplace; cmd.Parameters.Add("p_class", OracleType.VarChar).Value = http://stackoverflow.com/questions/15730026/class1; cmd.Parameters.Add("p_trainname", OracleType.VarChar).Value = http://stackoverflow.com/questions/15730026/trainname; cmd.Parameters.Add("p_successCnt", OracleType.Number).Direction = ParameterDirection.Output; try { cmd.ExecuteNonQuery(); SuccessCnt = Convert.ToInt32(cmd.Parameters["p_successCnt"].Value); if (SuccessCnt == 0) { Page.ClientScript.RegisterStartupScript(this.GetType(), "Window", "alert('An error has occured. No data has been inserted. Please try again with valid data');", true); } else if (SuccessCnt > 0) { Page.ClientScript.RegisterStartupScript(this.GetType(), "Window", "alert('Data has been inserted successfully.');", true); } } catch (Exception ex) { }\[/code\]My Prob is here: While I am debugging, in if-else block (inside the try{} block) the control always go to the if(SuccessCnt==0){} section, because the procedure returns p_successCnt ==0 . What I am expecting the control goes to else if(SuccessCnt > 0){} block because the procedure should return p_successCnt ==3