Oracle SQL Developer: no se pueden ejecutar consultas utilizando el campo varchar como identificador

I'm new to using Oracle SQL Developer and to using an Oracle DB (have mainly used MySQL before)

Estoy tratando de hacer algo como:

select * from content_definition where content_id = "hhhh233";

Dónde content_id es:


Pero estoy obteniendo:

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

I'm not really understanding why this isn't working as I used to do queries like this all the time with MySQL. I have been searching on this but nothing seems to be for my specific use case. I would appreciate if anyone can set me in the right direction on this. Thanks

preguntado el 09 de marzo de 12 a las 23:03

You query works in MySQL because MySQL ignores a lot of the SQL standards for naming (and quoting) objects (at least in the default installation) -

2 Respuestas

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

select * from content_definition where content_id = 'hhhh233';

respondido 09 mar '12, 23:03

String delimiter in Oracle is a single quote ('), like this:

select * from content_definition where content_id = 'hhhh233';

Double quotes are only used for identifiers (e.g. column names and tables).

respondido 09 mar '12, 23:03

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.