Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Regex 在oracle中使用引用因子的insert语句出现问题_Regex_Oracle_Oracle11g_Insert - Fatal编程技术网

Regex 在oracle中使用引用因子的insert语句出现问题

Regex 在oracle中使用引用因子的insert语句出现问题,regex,oracle,oracle11g,insert,Regex,Oracle,Oracle11g,Insert,我被一个oracle insert语句打动了。我有一个名为“BATCH”的表,它有两列S_NO,DATA,我有一个字符串值,其中包含所有特殊字符。例如,在“数据”列中,我有这样的值(这是需要插入的重要[批处理])。我基本上使用var char值的引用因子 insert into BATCH(SNO,DATA) VALUES(1,q'[This is the important [batch]'s which need to be inserted]') ; 当我触发这个insert语句时,or

我被一个oracle insert语句打动了。我有一个名为“BATCH”的表,它有两列S_NO,DATA,我有一个字符串值,其中包含所有特殊字符。例如,在“数据”列中,我有这样的值(这是需要插入的重要[批处理])。我基本上使用var char值的引用因子

insert into BATCH(SNO,DATA)
VALUES(1,q'[This is the important [batch]'s which need to be inserted]') ;
当我触发这个insert语句时,oracle抛出了一个名为missing comma的错误。原因是在名为batch的单词后面的字符串(q'[这是重要的[batch]'s]')中,在该单词的旁边我有(]'),这表示oracle这是列数据的结尾。如果我使用引用因子,如何处理此类数据


提前感谢。

您可以更改报价分隔符:

insert into BATCH(SNO,DATA)
VALUES(1,q'{This is the important [batch]'s which need to be inserted}');

如果我有这样的数据(这是需要插入的重要的[batch}),那么oracle会将错误作为无效字符串抛出

然后,您需要将quote DELIMER更改为最不可能是原始字符串的一部分的字符,如
~| ^
或任何其他适合您的字符

insert into BATCH(SNO,DATA)
VALUES(1,Nq'|This is the important [batch]'s which need to be inserted}|') ;

感谢您的快速响应。如果我有这样的数据(这是需要插入的重要[batch}),则oracle会将错误作为无效字符串抛出。@SanthoshPogaku您可以从大量引号分隔符中进行选择。。批次,当然可以?(如果是,这些是重要的批次。我想我也更喜欢此处的批次。)