1

I am trying to self educate myself in SQL in order to better use databases at work. I am currently trying to code an SQL query in Oracle Application Express that will provide me with a report for management, however I am receiving the following error message:

ORA-01747: invalid user.table.column, table.column, or column specification

I have spent countless hours searching for the bug and doing research and I am getting nowhere, which is quite frustrating as I feel its probably something rather easy. My research has shown me that the probable cause of my error is that I have tried to reference a column name, but the column name used is a reserved word in Oracle. Unfortunately, I am having trouble pinpointing what exactly... Please see below for the code:

SELECT Channel.Channel_Number, Supplier.Supplier_Name, package.Package_Name, Program.Program_name, Rating.Rating_Code, Weekly_Guide.ShowTime
    FROM Channel, Supplier, package, Program, Rating, weekly_guide, channel_package
    Where weekly_guide.date = ''
        AND channel.channel_number = weekly_guide.channel_number
        AND weekly_guide.Program_ID = Program.Program_ID
        AND channel.channel_number = channel_package.channel_number
        AND channel_package.package_ID = package.package_ID
        AND Program.rating_code = rating.rating_code
        AND Program_list.Program_ID = Program.Program_ID
        AND Program_list.list_ID = list.list_id
        AND list.supplier_ID = Supplier.supplier_ID
5
  • You refer to list.list_id and list.supplier_ID, but you don't have list in the FROM clause. Commented Dec 19, 2013 at 3:24
  • You also don't have Program_list in the FROM clause. Commented Dec 19, 2013 at 3:24
  • 4
    You should learn ANSI JOIN syntax instead of the old syntax of listing multiple tables in the FROM clause. Commented Dec 19, 2013 at 3:25
  • Thank you @Barmar ! I apologize for the rookie mistake. Commented Dec 19, 2013 at 3:32
  • Apex is for developing web applications, but for testing SQL and PL/SQL I recommend using a tool like Oracle SQL Developer. Commented Dec 19, 2013 at 5:09

1 Answer 1

2

It's most likely date from your Where clause. You'll need to wrap the reserved word in quotes. The name will then be case sensitive, so make sure you have the correct case for date in your query

SELECT Channel.Channel_Number, Supplier.Supplier_Name, package.Package_Name, Program.Program_name, Rating.Rating_Code, Weekly_Guide.ShowTime
FROM Channel, Supplier, package, Program, Rating, weekly_guide, channel_package
Where weekly_guide."date" = ''
    AND channel.channel_number = weekly_guide.channel_number
    AND weekly_guide.Program_ID = Program.Program_ID
    AND channel.channel_number = channel_package.channel_number
    AND channel_package.package_ID = package.package_ID
    AND Program.rating_code = rating.rating_code
    AND Program_list.Program_ID = Program.Program_ID
    AND Program_list.list_ID = list.list_id
    AND list.supplier_ID = Supplier.supplier_ID
Sign up to request clarification or add additional context in comments.

2 Comments

Thank you for your comment. Your solution successfully got rid of the error! However, I am still receiving "ORA-00942: table or view does not exist" message. Working on it as we speak.
@BillyCode Fixing the list of tables in FROM should solve that new error.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.