aka_krakur
Active Member
- Joined
- Jan 31, 2006
- Messages
- 438
Can anyone please take a look at this SQL Statement and tell me why it doesn't work in Excel Query?
I have tried everything; and I'm about to just come to the determination that Excel cannot handle the criteria in this query.
Only thing that makes it frustrating, is when I create the query (tables, joins, criteria, fields, etc) the first time, it works fine. It's when I go back into edit the query that everything falls apart. I have tried contacting Oracle and they're not sure, because I used a couple tools of theres that goes through step by step through the SQL statement and it came back with no errors and even gives me all the data I need. Problem is I have to do this in Excel because I have written a VBA program that has to update the query before it goes through the rest of the steps. Also, I have to validate the VBA program and part of that vaildation is to go back in and edit the query; and, since it fails at this point, I really need to resolve why it's not working at this point.
Please help if you can.
Thanks
Code:
SELECT a_compl_summary.incident_number, a_compl_summary.case_number,
a_compl_summary.part_sequence, a_compl_summary.part_number,
a_compl_summary.lot_number, a_compl_summary.alert_date,
a_compl_summary.entry_date, a_compl_summary.NAME,
a_compl_summary.MONTH, a_compl_summary.product_family,
a_compl_summary.complaint, a_compl_summary.reportable,
a_compl_summary.product_returned, a_compl_summary.case_desc,
a_compl_summary.failure_invest_desc, a_compl_summary.lhr_search,
a_compl_summary.root_cause, a_compl_summary.corrective_action,
a_compl_summary.region,
rp_qa_reported_device_codes.reported_device_code,
rp_qa_reported_device_codes.reported_dev_clarification,
rp_qa_reported_device_codes.reported_dev_code_desc,
rp_qa_patient_codes.patient_code,
rp_qa_patient_codes.patient_code_clarif,
rp_qa_patient_codes.patient_code_severity,
rp_qa_patient_codes.description
FROM chsuser.a_compl_summary,
chsuser.rp_qa_patient_codes,
chsuser.rp_qa_reported_device_codes
WHERE ( (a_compl_summary.product_division = 'CP')
AND ( a_compl_summary.entry_date >= :date1
AND a_compl_summary.entry_date <= :date2
)
AND ( a_compl_summary.product_family LIKE :pf1
OR a_compl_summary.product_family LIKE :pf2
OR a_compl_summary.product_family LIKE :pf3
OR a_compl_summary.product_family LIKE :pf4
OR a_compl_summary.product_family LIKE :pf5
)
AND (a_compl_summary.region = :r1)
AND ( a_compl_summary.NAME = :c1
OR a_compl_summary.NAME = :c2
OR a_compl_summary.NAME = :c3
OR a_compl_summary.NAME = :c4
OR a_compl_summary.NAME = :c5
)
AND (a_compl_summary.complaint = :yorn)
AND ( rp_qa_reported_device_codes.reported_dev_clarification LIKE
:cl1
OR rp_qa_reported_device_codes.reported_dev_clarification LIKE
:cl2
OR rp_qa_reported_device_codes.reported_dev_clarification LIKE
:cl3
OR rp_qa_reported_device_codes.reported_dev_clarification LIKE
:cl4
OR rp_qa_reported_device_codes.reported_dev_clarification LIKE
:cl5
)
AND (rp_qa_reported_device_codes.reported_dev_clarification NOT LIKE
:dc1
)
AND (a_compl_summary.incident_number =
rp_qa_patient_codes.incident_number
)
AND (a_compl_summary.case_number = rp_qa_patient_codes.case_number)
AND (a_compl_summary.part_sequence = rp_qa_patient_codes.part_sequence
)
AND (a_compl_summary.incident_number =
rp_qa_reported_device_codes.incident_number
)
AND (a_compl_summary.case_number =
rp_qa_reported_device_codes.case_number
)
AND (a_compl_summary.part_sequence =
rp_qa_reported_device_codes.part_sequence
)
AND (rp_qa_reported_device_codes.incident_number =
rp_qa_patient_codes.incident_number
)
AND (rp_qa_reported_device_codes.case_number =
rp_qa_patient_codes.case_number
)
AND (rp_qa_reported_device_codes.part_sequence =
rp_qa_patient_codes.part_sequence
)
)
I have tried everything; and I'm about to just come to the determination that Excel cannot handle the criteria in this query.
Only thing that makes it frustrating, is when I create the query (tables, joins, criteria, fields, etc) the first time, it works fine. It's when I go back into edit the query that everything falls apart. I have tried contacting Oracle and they're not sure, because I used a couple tools of theres that goes through step by step through the SQL statement and it came back with no errors and even gives me all the data I need. Problem is I have to do this in Excel because I have written a VBA program that has to update the query before it goes through the rest of the steps. Also, I have to validate the VBA program and part of that vaildation is to go back in and edit the query; and, since it fails at this point, I really need to resolve why it's not working at this point.
Please help if you can.
Thanks