select table_name from all_tables where owner = "Foo owner"; 

This request for some reason generates an error:

invalid identifier Foo owner found.

What is this nonsense? why is the constant string suddenly wrong !? Put single quotes and it worked. What kind of nonsense.

  • You have seen queries in mysql, there are often column names enclosed in reverse apostrophes. In ms sql, column names are enclosed in square brackets. And in oracle, double quotes are used for this purpose. To set text constants, only single quotes are used. - Mike

1 answer 1

That's right:

 select table_name from all_tables where owner = 'Foo owner'; 

Strings are framed with a single quote. In this case, Oracle is looking for a column named "Foo owner"

  • and if I want to compare it with a constant string - voipp
  • The string is framed by single quotes. 'Foo' row, "Foo" column or table name or something else - Viktorov
  • @voipp I understand that you pointed out that to search for a constant string literal, you should use a record of the form where varChar2FieldName = 'SomeString'; and the next entry will be similar to the previous one where "varChar2FieldName" = 'SomeString'; - StateItPrimitive
  • @StateItPrimitive yes, I need a constant string. Single quotes are not constant. Constant is double. - voipp
  • Are we talking about Oracle sql? If yes, then I do not understand what a constant and non-constant string is in this context. If we are talking about something else, then explain what we are talking about - Viktorov