ResultSet result = null;
java.sql.Statement pst = conn.createStatement();
pst.executeUpdate("INSERT INTO sales_cust_branch (branch_code,debtor_no, br_name, branch_ref, br_address, area, area_details, salesman, sales_man_details, contact_name, default_inventory_location, inv_loc_details, tax_group_id, tax_group_details, sales_account, sales_discount_account,receivables_account, payment_discount_account, sales_account_details, sales_discount_acc_details, receivables_account_details, payment_discount_acc_details, default_ship_via, default_ship_via_details, disable_trans,br_post_address, group_no, group_details, notes, inactive ,company_id, user_id, login_ip,insert_date,pc_user) VALUES "
+ "(SALES_DEBTORS_BRANCH.nextval,'"+ debator_no + "','" + Branch_Name+ "','" + Branch_Short_Name + "','" + Billing_Add + "','" + Sales_Area + "','" + Sales_Area_Details + "','" + Sales_Person + "','" + Sales_Person_Details + "','" + Contact_Person + "','" + Def_Inv_Loc + "','" + Def_Inv_Loc_Details + "','" + Tax_Group + "','" + Tax_Group_Details + "','" + Sales_Ac_Id + "','" + Sales_Dis_Id + "','" + Sales_Rcv_Id + "','" + Sales_Py_Dis_Id + "','" + Sales_Account + "','" + Sales_Discount_Account + "','" + Accounts_Receiveable_Account + "','" + Promot_Payment_Discount_Account + "','" + Def_Ship_Com + "','" + Def_Ship_Com_Details+ "','" + 0 + "','" + Mailing_Add + "','" + Sales_Group_Id+ "','" + Sales_Group_Details + "','" + Br_General_Notes + "','" + I_S_Br + "','" + Dashboard.company_id + "','" + Dashboard.user_id + "','" + u.Get_Ip() + "',TO_DATE('" + u.todays_datetime()+ "', 'yyyy-mm-dd hh24:mi:ss'),'" + System.getProperty("user.name") + "')", new String [] {"branch_code"});
result = pst.getGeneratedKeys();
result.next();
branch_id = String.valueOf(result.getLong(1));
System.out.println(branch_id );
Result: 25