c++ - ORA-00917 如果将带有转义单引号的 SQL 语句传递给 OCIStmtExecute
问题描述
如果我尝试在 Oracle SQL Developer 中执行以下语句,我会成功。(注意第一个插入语句的最后一个值。)
BEGIN
INSERT INTO attr_value
(predef_class,
plan_nr,
key1,
key2,
key3,
key4,
key5,
type_id,
item_id,
access_type_id,
str_val)
VALUES (0,
0,
10000001,
1,
1,
1740,
0,
10242,
0,
10242,
'test''test');
INSERT INTO attr_value
(predef_class,
plan_nr,
key1,
key2,
key3,
key4,
key5,
type_id,
item_id,
access_type_id,
str_val)
VALUES (0,
0,
10000001,
1,
1,
1740,
0,
10248,
0,
10248,
'');
INSERT INTO attr_value
(predef_class,
plan_nr,
key1,
key2,
key3,
key4,
key5,
type_id,
item_id,
access_type_id,
dt_val)
VALUES (0,
0,
10000001,
1,
1,
1740,
0,
10237,
0,
10237,
'2000-01-01 00:00:00');
INSERT INTO attr_value
(predef_class,
plan_nr,
key1,
key2,
key3,
key4,
key5,
type_id,
item_id,
access_type_id,
float_val)
VALUES (0,
0,
10000001,
1,
1,
1740,
0,
10111,
0,
10111,
25.281797);
INSERT INTO attr_value
(predef_class,
plan_nr,
key1,
key2,
key3,
key4,
key5,
type_id,
item_id,
access_type_id,
in_val)
VALUES (0,
0,
10000001,
1,
1,
1740,
0,
10079,
0,
10079,
0);
END;
但是,如果我将相同的语句传递给 ociap.h 中定义的 OCIStmtExecute 函数,则相同的语句将失败,并出现 ORA-06550 'Statement ignored' 和 ORA-00917 'Missing comma'。
有没有人提示我如何克服这个问题?
问候,本
解决方案
推荐阅读
- android - 如何测试订阅的 Google Play 实时通知?
- javascript - click() 函数不适用于 onclick="try {if (isReadyToContinue()) {setBusyIndicator();} else {return false;}} catch (e) {;};"
- python - 在 InterruptionKey 时使用 psycopg2 终止未完成的 SQL 提交查询
- javascript - Tinymce - images_upload_handler - 验证最大文件大小
- json - Flutter/Dart JSON 和现有库类的序列化
- google-chrome - VSCode 调试器无法连接到 Karma 运行的 puppeteer 实例
- python - 如何调用具有需要调用其他函数的条件的函数
- matlab - 如何在位置 2 的 Matlab 索引上解决此问题超出数组范围?
- arangodb - Arangodb 找到条件最短路径
- node.js - 如何将 readFileSync 代码转换为 readFile?