Re: invalid relational error, please help

From: Charles Hooper <hooperc2000_at_yahoo.com>
Date: Fri, 4 Jan 2008 19:01:58 -0800 (PST)
Message-ID: <3b9702b6-9412-4599-93f5-d903724142be@q39g2000hsf.googlegroups.com>


On Jan 4, 9:44 pm, Totti <saliba.toufic.geo..._at_gmail.com> wrote:
> Thnak you Mr. Morgan for your notice;
> here is the whole thing:
>
> SQL> SELECT TO_CHAR(purinv.Inv_Date,'mm')
> MONTH ,TO_CHAR(purinv.Inv_Date,'YYYY') YEAR,
>   2  SUM(DECODE(PROD.category,'Special',prod.unit_price * sales.qty ,
> 0)) AS "Special",
>   3  SUM(DECODE(PROD.category,'Base',prod.unit_price * sales.qty , 0))
> AS "Base",
>   4  SUM(DECODE(PROD.category,'Common',prod.unit_price * sales.qty ,
> 0)) AS "Common"
>   5  from prod, sales, purinv
>   6  where sales.prod_code = prod.code and Prod.category ('Special',
> 'Base', 'Common')
>   7  and purch.inv_code = purinv.code
>   8  group by
> TO_CHAR(purinv.Inv_Date,'mm') ,TO_CHAR(purinv.Inv_Date,'YYYY')
>   9  order by
> TO_CHAR(purinv.Inv_Date,'YYYY'),TO_CHAR(purinv.Inv_Date,'mm');
> and purch.inv_code = purinv.code
> *
> ERROR at line 7:
> ORA-00920: invalid relational operator

The error is pointing at the line:
"and purch.inv_code = purinv.code"

Your FROM clause is "from prod, sales, purinv". Oracle does not know where to find purch.inv_code, as purch is not one of the tables in the FROM clause.

Charles Hooper
IT Manager/Oracle DBA
K&M Machine-Fabricating, Inc. Received on Fri Jan 04 2008 - 21:01:58 CST

Original text of this message