2 Replies - 941 Views - Last Post: 16 June 2013 - 11:51 PM Rate Topic: -----

#1 ak4744710  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 128
  • Joined: 30-January 13

Invalid identifier in SQL*Plus Oracle 10g syntax error? HELP

Posted 16 June 2013 - 11:38 PM

I am working on a assignment and our teacher is not available right now. He has gave us a templet to use but mine is not working so I have even tried to rewrite it my self to get it to work with no luck. I am new to this and it may be a simple fix but I do not have the knowledge yet to know what to do either. Please bare with me if I am saying things out of context or leaving anything out as this is only my second week working with SQL. The problem is when I use this templet it returns the error
ERROR at line 5:
ORA-00904: "ORDERDATE": invalid identifier

the templet I have from my professor is as follows;

Quote

set linesize 80
set pagesize 30
SELECT title, name, fname, lname
FROM books JOIN bookauthor USING(isbn)
JOIN author USING(authorid)
JOIN publisher USING(pubid)
WHERE orderdate BETWEEN '01-APR-05' AND '04-APR-05';

I have tried to change it to = to and ! = to date and all sorts of different syntax I could think off all with no correct result.

Also thought I should add if I run the query without the WHERE clause it displays all the records fine.

Is This A Good Question/Topic? 0
  • +

Replies To: Invalid identifier in SQL*Plus Oracle 10g syntax error? HELP

#2 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3512
  • View blog
  • Posts: 10,137
  • Joined: 08-June 10

Re: Invalid identifier in SQL*Plus Oracle 10g syntax error? HELP

Posted 16 June 2013 - 11:46 PM

you need to define, which table orderdate is from, e.g. books.orderdate.
Was This Post Helpful? 0
  • +
  • -

#3 ak4744710  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 128
  • Joined: 30-January 13

Re: Invalid identifier in SQL*Plus Oracle 10g syntax error? HELP

Posted 16 June 2013 - 11:51 PM

View PostDormilich, on 17 June 2013 - 01:46 AM, said:

you need to define, which table orderdate is from, e.g. books.orderdate.

Thank you for your help I am not sure if I did something else wrong but it is still not working I tried
set linesize 80
set pagesize 30
SELECT title, name, fname, lname
FROM books JOIN bookauthor USING(isbn)
JOIN author USING(authorid)
JOIN publisher USING(pubid)
WHERE orders.orderdate BETWEEN '01-APR-05' AND '04-APR-05';
Now I get this error;
WHERE orders.orderdate BETWEEN '01-APR-05' AND '04-APR-05'
*
ERROR at line 5:
ORA-00904: "ORDERS"."ORDERDATE": invalid identifier
Not sure if I did it correct but the table it is in is orders
I tried with order instead of orders and it shows
*
ERROR at line 5:
ORA-00936: missing expression
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1