Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> newbie sql question

newbie sql question

From: Vic Smyth <vicsmyth_at_megsinet.net>
Date: Sun, 11 Apr 1999 16:43:43 -0700
Message-ID: <371133AF.AAB@megsinet.net>


Hi,

I'm doing a project for class using Oracle Sqlplus and am stuck on a problem. I've created a view and am trying to query the view but get an error message. Any help would be appreaciated!

Here's what I have, the error message is below.

Vic

To reply to email remove the "myth" from the address.

SQL> CREATE VIEW TEMPX AS
  2 SELECT INVOICE.CUS_CODE "C_Code", COUNT(DISTINCT INVOICE.INV_NUMBER)"Inv_Nu
m",
  3 SUM(LINE_UNITS*LINE_PRICE)"SumOfLine"   4 FROM INVOICE, LINE
  5 WHERE INVOICE.INV_NUMBER = LINE.INV_NUMBER   6 GROUP BY INVOICE.CUS_CODE; View created.

SQL> select * from tempx;

C_Cod Inv_Num SumOfLine
----- --------- ---------

10011         3       444
10012         1    153.85
10014         2    422.77
10015         1     34.97
10018         1     70.44

SQL> DESCRIBE TEMPX;
 Name                            Null?    Type
 ------------------------------- -------- ----
 C_Code                          NOT NULL CHAR(5)
 Inv_Num                                  NUMBER
 SumOfLine                                NUMBER

SQL> SELECT SUM(Inv_Num),SUM(SumOfLine),MIN(SumOfLine),   2 MAX(SumOfLine),AVG(SumOfLine)
  3 FROM TEMPX;
MAX(SumOfLine),AVG(SumOfLine)

                   *

ERROR at line 2:
ORA-00904: invalid column name

SQL> Received on Sun Apr 11 1999 - 18:43:43 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US