Java报00933异常,java - java.sql.SQLSyntaxErrorException:ORA-00933:INSERT INTO SELECT的SQL命令未正确结束 - 堆栈内存溢...

我有一个下面的查询,它需要通过使用列作为键来选择一行并返回生成的键。

INSERT INTO t_tpms_cc_request

(process_identifier,

request_source_id,

amount,

etc_account_id,

retry_count,

status,

store_identifier,

version_no,

next_process_time,

composite_transaction_id,

payment_id,

processed_time,

replenishment_id,

pay_type,

agency_id,

response_code,

file_id,

request_date,

auth_file_id,

auth_date_time,

merc_file_id,

merc_date_time,

cc_num,

cc_expiration_date,

merchant_id,

ext_sys_ref,

encrypt_cc_number,

cc_month_cd,

cc_year_cd,

orig_txn_ref,

auth_code,

avs_code,

cvv_code)

SELECT CC.process_identifier,

CC.request_source_id,

CC.amount,

CC.etc_account_id,

CC.retry_count,

CC.status,

CC.store_identifier,

CC.version_no,

CC.next_process_time,

CC.composite_transaction_id,

CC.payment_id,

CC.processed_time,

CC.replenishment_id,

CC.pay_type,

CC.agency_id,

CC.response_code,

CC.file_id,

CC.request_date,

CC.auth_file_id,

CC.auth_date_time,

CC.merc_file_id,

CC.merc_date_time,

CC.cc_num,

CC.cc_expiration_date,

CC.merchant_id,

CC.ext_sys_ref,

CC.encrypt_cc_number,

CC.cc_month_cd,

CC.cc_year_cd,

CC.orig_txn_ref,

CC.auth_code,

CC.avs_code,

CC.cvv_code

FROM t_tpms_cc_request CC

WHERE CC.order_id = ?

而且,我编写了下面的java代码来做到这一点:

String key[] = {"order_id"};

DataSource ds = null;

Connection con = null;

ResultSet rs = null;

try {

ds = jdbcTemplate.getDataSource();

con = ds.getConnection();

PreparedStatement ps =

con.prepareStatement(insertCCRequest.trim(), key);

ps.setString(1, OrderId);

int i= ps.executeUpdate();

rs = ps.getGeneratedKeys();

if (rs.next()) {

return rs.getString(1);

}

} catch (SQLException e) {

logger.debug("SQL exception in RebillDao.insertCCrequest()

method..!! ");

logger.debug("Exception cause: "+e.getMessage());

e.printStackTrace();

throw e;

}

finally {

if(con!=null){

con.close();

}

}

return "";

当我运行它时,出现以下异常:

java.sql.SQLSyntaxErrorException: ORA-00933: SQL command not properly ended

请告诉我解决方法。

另外,使用JDk 1.6和ojdbc6-11.2.0.4.jar

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值