0

Sql use ' ' to inclued the value which needed to insert.

What if need to insert the value with '-->for example: G'day

Insert into words values ("G'day", "Yes"," Nice to meet you");

Got error message:

  1. 00000 - "column not allowed here"

*Cause:
*Action:

There are no Cause and Action mentioned here.

AAlex
  • 63
  • 8
  • But I got the answer that different from the former answer. otherwise, I googled it, can not find it. Also, I express in a different 'question' title. – AAlex May 17 '18 at 14:20

1 Answers1

1

Text literals are enclosed in single quotes, not double quotes; all of your values are being interpreted as identifiers, and the context means they're seen as column identifiers (names), hence the error.

So the short answer is to change the double quotes to single quotes:

Insert into words values ('G'day', 'Yes',' Nice to meet you');

but as your values actually contain single quotes, you either need to escape those by doubling them up:

Insert into words values ('G''day', 'Yes',' Nice to meet you');

or use the alternative quoting mechanism (described in the documentation linked to above), with a delimiter that won't appear in the actual text, e.g:

Insert into words values (q'[G'day]', 'Yes',' Nice to meet you');
Alex Poole
  • 183,384
  • 11
  • 179
  • 318