Advertisement

06.03.2008 at 09:34AM PDT, ID: 23453766
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.5

SQL*Plus: Case statement in the WHERE clause or use something else?

Asked by globalwm in Oracle Product Info, Oracle 9.x, PL / SQL

I have a calculation in my WHERE clause:

((((a.SALES_PRICE - a.UNIT_COST)/a.UNIT_COST)*100)<15)

That throws an "divide by zero" error that I need to handle.

I was trying to use a CASE statement - but I haven't used one before in a WHERE clause and plus, the code is giving me this error:

CASE WHEN (a.UNIT_COST = 0) THEN (((a.SALES_PRICE - a.UNIT_COST)/a.SALES_PRICE)=1)
                                                                               *
ERROR at line 26:
ORA-00907: missing right parenthesis


Is there a better way to accomplish this? If not, what seems to be wrong with my syntax?

Thanks,Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
SELECT A.invoice_number, 
A.invoice_line_number, 
A.order_number, 
A.order_line_number, 
A.part_code, 
A.warehouse, 
A.unit_price, 
B.invoice_quantity, 
A.sales_price, 
A.unit_cost, 
A.delivery_address_code, 
A.salesperson_code, 
A.location, 
A.customer_number, 
C.customer_name, 
A.freight, 
A.sop_invoice_total_currency, 
A.SYS_CURRENCY_DATE 
FROM fin_prod.sales_order_invoice_lines A, 
fin_prod.sales_invoice_line_qtys B, 
fin_prod.customers C 
WHERE a.COMPANY_CODE = '1' AND 
a.DIVISION = '1' AND 
a.WAREHOUSE in ('S1','L1') and 
a.SALES_PRICE >0 AND 
CASE WHEN (a.UNIT_COST = 0) THEN (((a.SALES_PRICE - a.UNIT_COST)/a.SALES_PRICE)=1) 
ELSE ((((a.SALES_PRICE - a.UNIT_COST)/a.UNIT_COST)*100)<15) END 
and a.SYS_CURRENCY_DATE >= (SYSDATE-7) and 
a.company_code = b.company_code and 
a.division = b.division and 
a.invoice_number = b.invoice_number and 
a.invoice_line_number = b.invoice_line_number 
and c.COMPANY_CODE = '1' AND 
c.DIVISION = '1' and 
a.customer_number = c.customer_number 
ORDER BY SYS_CURRENCY_DATE DESC
[+][-]06.03.2008 at 12:00PM PDT, ID: 21703389

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.03.2008 at 12:02PM PDT, ID: 21703422

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.03.2008 at 12:06PM PDT, ID: 21703475

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.03.2008 at 12:15PM PDT, ID: 21703571

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.03.2008 at 12:26PM PDT, ID: 21703672

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.03.2008 at 12:42PM PDT, ID: 21703821

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.03.2008 at 12:51PM PDT, ID: 21703895

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.03.2008 at 12:58PM PDT, ID: 21703952

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.03.2008 at 01:17PM PDT, ID: 21704122

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.03.2008 at 01:19PM PDT, ID: 21704144

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.03.2008 at 01:34PM PDT, ID: 21704275

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.03.2008 at 01:50PM PDT, ID: 21704405

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.03.2008 at 01:53PM PDT, ID: 21704447

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.03.2008 at 01:58PM PDT, ID: 21704491

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.03.2008 at 01:59PM PDT, ID: 21704499

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.03.2008 at 02:02PM PDT, ID: 21704515

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.03.2008 at 02:03PM PDT, ID: 21704528

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Oracle Product Info, Oracle 9.x, PL / SQL
Sign Up Now!
Solution Provided By: sdstuber
Participating Experts: 3
Solution Grade: A
 
 
[+][-]06.03.2008 at 02:05PM PDT, ID: 21704543

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.03.2008 at 02:11PM PDT, ID: 21704591

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628