Aside from the invalid syntax using where
, you also need to escape the single quotes in your string by doubling them up:
A single quotation mark (') within the literal must be preceded by an escape character. To represent one single quotation mark within a literal, enter two single quotation marks.
so with a normal text literal:
insert into rule_master(rule) values('^[0-how #''ff#''9]+$')
^^ ^^
or you can use the alternative quoting mechanism syntax, if you can identify a quote_delimiter
character that will never appear in the value (or at least not immediately before a single quote); e.g. if you know @
will never appear you can use a pattern like:
values(q'@<your actual value>@')
i.e.:
insert into rule_master(rule) values(q'@^[0-how #'ff#'9]+$@')
^ ^ ^
If the where
part is supposed to be populating that column at the same time then the syntax would be more like:
insert into rule_master(rule_id, rule)
values(7, q'@^[0-how #'ff#'9]+$@')
and if a row with that ID already exists you should be using update
rather than insert
:
update rule_master
set rule = q'@^[0-how #'ff#'9]+$@'
where rule_id = 7
or perhaps merge
if you aren't sure.