0

I learnt SQL in SSMS, but I'm using Oracle (Version 21.4.3.063) and have written a standard select ALL statement, which is surprisingly giving me an error!

Does anyone know why this query would produce an error?

The table name definitely exists!

Select * from TTLS532100; 

The error I get is this (the code is preceded by comments):

Error starting at line : 5 in command - select * from TTLS532100

Error at Command Line : 6 Column : 6

Error report - SQL Error: ORA-00942: table or view does not exist 00942. 00000 - "table or view does not exist" *Cause:
*Action:

Mr 2017
  • 103
  • 2
  • 6
  • 15
  • *Which* error? Query itself looks OK. – Littlefoot Aug 16 '22 at 12:04
  • You're most likely missing permissions. Don't confuse the Oracle database engine and Oracle SQL Developer the sort of database IDE. – Mat Aug 16 '22 at 12:04
  • @Littlefoot thanks for responding. I've just added in the error message. Thank you in advance. – Mr 2017 Aug 16 '22 at 12:09
  • @Mat that's an interesting comment - how can I verify missing permissions? Also, for context, I've been able to run other queries without a problem.... – Mr 2017 Aug 16 '22 at 12:10
  • Oracle error is pretty specific - that table either doesn't exist, or - if it exists - you (i.e. the currently logged user) don't have permission to select from it. – Littlefoot Aug 16 '22 at 12:10
  • 3
    You may need to prefix the table name with the schema name (ex: SELECT * FROM YourSchema.TTLS532100). – dcp Aug 16 '22 at 12:12
  • Alternatively do a CREATE TABLE xxx to look where the table is created. Some schema likely. – Joop Eggen Aug 16 '22 at 12:14
  • you need to check if the table exists in another schema then you should add the schema name to the table name OR check if the table exists in your logging schema by selecting from the view "USER_TABLES" – M.Youssef Aug 16 '22 at 12:27
  • @dcp - thank you! What you suggested worked! I've never ever had to do that before with select statements! So this is something new that I've learnt! So thank you for that tip! You've saved a lot of time! – Mr 2017 Aug 16 '22 at 12:58
  • 1
    Does this answer your question? [SQL Error: ORA-00942 table or view does not exist](https://stackoverflow.com/questions/16129912/sql-error-ora-00942-table-or-view-does-not-exist) – OldProgrammer Aug 16 '22 at 13:53

0 Answers0