Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
im having issues with this.
kindly look into this code and assist.
thanks

What I have tried:

C#
try
                {
                    string query = "SELECT uetc.team_codes, LPAD (papf.employee_number, 5, 0) staff_id,papf.full_name full_name, papf.email_address,LPAD (papf1.employee_number, 5, 0) supervisor_id,papf1.full_name supervisor_name, papf1.email_address, hl.location_code, SUBSTR (hl.location_code, 1, 3) branch_code, SUBSTR (hl.location_code, 6) branch_name, hl.loc_information15 region_name, hl.loc_information14 zone_name  FROM per_all_people_f papf, per_all_assignments_f paaf, per_grades pg, per_jobs pj, hr_locations_all hl, hr_all_organization_units haou, per_all_people_f papf1, per_all_assignments_f paaf1, per_grades pg1, per_jobs pj1, hr_locations_all hl1,  hr_all_organization_units haou1, ub_emp_team_codes_new uetc  WHERE papf.person_id = paaf.person_id AND papf.current_employee_flag = 'Y' AND SYSDATE BETWEEN papf.effective_start_date AND papf.effective_end_date AND paaf.primary_flag = 'Y'  AND papf.employee_number < 7000 AND papf.employee_number <> 00000 AND SYSDATE BETWEEN paaf.effective_start_date AND paaf.effective_end_date  AND paaf.grade_id = pg.grade_id(+) AND paaf.job_id = pj.job_id(+)  AND paaf.location_id = hl.location_id(+)  AND paaf.organization_id = haou.organization_id(+) AND paaf.supervisor_id = papf1.person_id(+)  AND papf1.person_id = paaf1.person_id(+) AND papf1.current_employee_flag(+) = 'Y' AND SYSDATE BETWEEN papf1.effective_start_date(+) AND papf1.effective_end_date(+) AND paaf1.primary_flag(+) = 'Y' AND SYSDATE BETWEEN paaf1.effective_start_date(+) AND paaf1.effective_end_date(+) AND paaf1.grade_id = pg1.grade_id(+) AND paaf1.job_id = pj1.job_id(+)  AND paaf1.location_id = hl1.location_id(+) AND paaf1.organization_id = haou1.organization_id(+) AND papf.person_id = uetc.person_id(+) AND uetc.person_id(+) = papf.person_id  AND papf.employee_number = @staff_id";
                    OracleCommand OraC = new OracleCommand(query, OracleConn);
                    OraC.CommandType = CommandType.Text;
                    OraC.Parameters.Add(new OracleParameter("@staff_id", OracleDbType.Varchar2)).Value = staffid;
                    //OraC.Parameters.Add(new OracleParameter("SESSION_ID", OracleDbType.Varchar2)).Value = SessionID;
                    //OraC.Parameters.Add(new OracleParameter("V_RESULT", OracleDbType.Varchar2, 32767)).Direction = ParameterDirection.Output;


                    //OracleDataReader dr = OraC.ExecuteNonQuery();
                    OracleDataReader dr = OraC.ExecuteReader();
                    while (dr.Read())
                    {
                        SupervisorEmail = dr["EMAIL_ADDRESS_1"].ToString();
                        StaffEmail = dr["EMAIL_ADDRESS"].ToString();
                        string id = dr["STAFF_ID"].ToString();
                    }

                }
                catch (Exception ex)
                {

                    ex.Message.ToString();
                }
                finally
                {
                    OracleConn.Close();
                } 
Posted
Updated 27-Jul-16 3:59am
v2
Comments
Richard Deeming 27-Jul-16 9:58am    
Are we supposed to guess what "issues" you're having?

Click "Improve question" and update your question with a proper description of the problem. Include the full details of any errors - you might want to start by removing the catch block that's currently swallowing all exceptions silently.

1 solution

The first problem is that you are writing the same way you would write it for queries against a SQL Server which won't work. I wrote a post about this a little while ago. Feel free to have a look: .Net Oracle Queries
 
Share this answer
 
Comments
Emmablakes 27-Jul-16 11:09am    
Thanks Foothill.....your article on oracle queries killed it completely.....that was all i needed to resolve my problem.....thanks thanks thanks
Foothill 27-Jul-16 11:11am    
No problem. Glad I could help. It took me a few days to work it out the first time.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900