Skip to main content

This article explains that in SQL, character literals should be enclosed with single quotes, rather than double quotes.

Problem:

This SQL statement returned an ORA-00904 error (invalid column name):

EXEC SQL
      SELECT COL1
      INTO :HOSTVAR
      FROM TABLENAME
      WHERE COL2 = "VALUE"
END-EXEC

Resolution:

In SQL, character literals should be enclosed within single quotes, rather than double quotes. The above statement should therefore be changed to read:

EXEC SQL
      SELECT COL1
      INTO :HOSTVAR
      FROM TABLENAME
      WHERE COL2 = 'VALUE'
END-EXEC

Old KB# 14045