sql - “SQL 命令未正确结束” - 插入语句
问题描述
运行语句时出现以下错误,
[sql] Failed to execute:
INSERT INTO REPORT (
ID
, CI
, TECHNOLOGY
, MAJOR_VERSION
, MINOR_VERSION
, PATCH_LEVEL
, INSTALL_DATE
, INSTALLED_BY
, TASK ) values (
REPORT_ID_SEQ.nextval
, 'host1'
, 'Apple card'
, 'N/A'
, 'N/A'
, '12233'
, SYSTIMESTAMP
, 'test@gmail.com'
, '' ) FROM dual
执行 SQL 脚本时出错:java.sql.SQLSyntaxErrorException:ORA-00933:SQL 命令未正确结束
解决方案
最后你不需要from dual
,你没有使用任何 SELECT 语句。
您可以执行SELECT
或VALUES
插入值:
使用选择
INSERT INTO report
(
id,
ci,
technology,
major_version,
minor_version,
patch_level,
install_date,
installed_by,
task
)
SELECT
report_id_seq.nextval,
'host1',
'Apple card',
'N/A',
'N/A',
'12233',
systimestamp,
'test@gmail.com',
''
from dual;
使用价值观
INSERT INTO report
(
id,
ci,
technology,
major_version,
minor_version,
patch_level,
install_date,
installed_by,
task
)
VALUES
(
report_id_seq.nextval,
'host1',
'Apple card',
'N/A',
'N/A',
'12233',
systimestamp,
'test@gmail.com',
''
) ;
推荐阅读
- node.js - 被crontab启动后退出脚本
- javascript - 救援组/Petfinder jQuery API 请求
- python - Pytest 基于 mark.parameterize 值选择测试?
- python - python - 文件夹名称中的空格
- javascript - resx 文件字符串编码错误
- php - 如何从表中获取“id”到模态以使用 php 将其删除
- javascript - 根据用户指定的过滤器仅返回用户指定的列
- node.js - 运行 npm run dev 时 babel-watch server.js 失败
- symfony - 如何在 Symfony 中获取所有翻译消息域
- python - 难以找到csv文件的总和