I am coding in SQL Developer for Oracle database and I have a simple query as follows:
select distinct location from Conference where name like '%SIGMOD%' and year >= 2003 and year <= 2008;
When I run the query by itself, I get the expected correct result. But when I run it as part of a script I get this error:
Error starting at line : 1 in command -
select distinct location from Conference where name like ‘%SIGMOD%’ and year >= 2003 and year <= 2008
Error at Command Line : 1 Column : 58
Error report -
SQL Error: ORA-00911: invalid character
00911. 00000 - "invalid character"
*Cause: identifiers may not start with any ASCII character other than
letters and numbers. $#_ are also allowed after the first
character. Identifiers enclosed by doublequotes may contain
any character other than a doublequote. Alternative quotes
(q'#...#') cannot use spaces, tabs, or carriage returns as
delimiters. For all other contexts, consult the SQL Language
Reference Manual.
I'm not sure what is going on.
EDIT:
Even if I change the part of the query to where name = 'SIGMOD', I still get the same error.
EDIT 2:
Silly me, I ran that query incorrectly. where name = 'SIGMOD' does get rid of the error. However, I wonder why I can't use the like statement in the original question?
like ‘%SIGMOD%’-- should be a single quote.'is different than‘.likevs=, but rather those apostrophes look off to me. If it runs without that part, you'll know that's the issue.