Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ORA-03113: End-of-file on communication

Status
Not open for further replies.

ridhirao22

Programmer
Aug 27, 2010
140
0
0
US
Hi, I have been struggling to get this code work for me and don't know what is wrong. I keep getting this error ORA-03113: End-of-file on communication. This is causing by using the distinct in the count. I remove the distinct it works but the data is wrong. Thanks in advance! RR
Using Oracle 11g

SELECT TRUNC (oh.orderdate) Orderdate,
DECODE ( (p.brand), 'FACTORY', 'F', 'R') brand,
(CASE WHEN (OH.COUNTRY IS NULL) THEN (A.COUNTRY) ELSE OH.COUNTRY END)
COUNTRY,
NVL (
COUNT (
DISTINCT (CASE
WHEN OH.PROMOTIONCODE NOT IN
(SELECT TO_CHAR (EMPLOYEE_ID) FROM EMPLOYEE)
THEN
ordernum
END)),
0)
PROMO_ORDERS
FROM ORDER_HEADERS OH,
ORDER_LINES OL,
PRODUCTS P,
ADDRESS A
WHERE OH.ORD_ID = OL.ORD_ID
AND OH.ADD_ID = A.ADD_ID
AND OL.PRD_ID = P.PRD_ID
AND OH.ORDERDATE >= TRUNC (SYSDATE) - 1
AND Ol.ORDERlineDATE >= TRUNC (SYSDATE) - 1
GROUP BY TRUNC (oh.orderdate),
DECODE ( (p.brand), 'FACTORY', 'F', 'R'),
(CASE WHEN (OH.COUNTRY IS NULL) THEN (A.COUNTRY) ELSE OH.COUNTRY END)
 
There's one thing that strikes me right away, and that is the NVL(COUNT.... part of the statement.
If one counts anything, the answer can never be null. The count might be zero or some other number, but it will never be null.
Thus the NVL(COUNT is pointless and may be part of the trouble.

Can you post the create table statement for the table you're selecting from, and insert statements to add a few records.
Then if you say what you're trying to obtain functionally, we can probably help more.

Regards

T
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top