Oracle SQL Developer - Unable to execute queries using varchar field as id

I am new to using Oracle SQL Developer and using Oracle DB (mostly used MySQL before)

I am trying to do something like:

select * from content_definition where content_id = "hhhh233";

      

Where content_id

:

VARCHAR2(1000 BYTE)

      

But I am getting:

ORA-00904: "hhhh233": invalid identifier
00904. 00000 -  "%s: invalid identifier"
*Cause:    
*Action:
Error at Line: 1 Column: 52

      

I don't understand why this doesn't work as I have always done queries like this with MySQL. I have searched for this but nothing seems to match my specific use case. I would appreciate it if someone could set me in the right direction. Thanks to

+3


source to share


2 answers


You need to use single quotes for character data; double quotes stand for identifiers and aliases:



select * from content_definition where content_id = 'hhhh233';

      

+5


source


The Oracle string separator is a single quote ('), for example:

select * from content_definition where content_id = 'hhhh233';

      



Double quotes are only used for identifiers (for example, column and table names).

+3


source







All Articles