尝试插入表时出现"ORA-00922:选项丢失或无效" [英] “ORA-00922: missing or invalid option” when trying to insert into table

查看:110
本文介绍了尝试插入表时出现"ORA-00922:选项丢失或无效"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在oracle sql developer中运行SQL查询时,它可以工作,但是在jdbc中,此查询不起作用,并捕获到java.sql.SQLSyntaxErrorException:ORA-00922:缺少或无效的选项.有人可以帮我吗?下面是我的查询

When i run SQL query in oracle sql developer it is work, but in jdbc this query doesn't work and catch the java.sql.SQLSyntaxErrorException: ORA-00922: missing or invalid option. Could anyone help me ? There is my query below

CREATE GLOBAL TEMPORARY TABLE MY_TABLE (
    ID VARCHAR2(30 BYTE) PRIMARY KEY, 
    NAME VARCHAR2(20 BYTE));
INSERT INTO MY_TABLE (
    ID, NAME)
VALUES ('My_Id' , 'My_Name' );

推荐答案

这只是一个快速的猜测,因为我没有可用的Oracle来证明它,但是使用MyBatis(基于JDBC)时,我的行为与最后一个;.请尝试在您的JDBC查询中将其删除.

It is just a quick guess, because I have no oracle available to proof it, but with MyBatis (which is based on JDBC) I had this behavior with the last ;. Please try to remove it in your JDBC query.

请在第一条语句中创建临时表,然后在第二条语句中添加数据.

Please create the temporary table in a first statement, then in a second statement add your data.

这篇关于尝试插入表时出现"ORA-00922:选项丢失或无效"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆