sql将一个表中的某一列数据更新到另一个表中
代码如下updateaseta.latesprice=b.amountfromT_CONDETAILEDa,(selectb.amountfromt_tempb)bwhe...
代码如下
update a set a.latesprice = b.amount from T_CONDETAILED a,(select b.amount from t_temp b) b where b.conNo=a.conNumber)
报的错误是:
Caused by: java.sql.SQLException: ORA-00933: SQL command not properly ended
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:111)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:330)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:287)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:744)
at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:206)
at oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:956)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1169)
at oracle.jdbc.driver.OracleStatement.executeInternal(OracleStatement.java:1695)
at oracle.jdbc.driver.OracleStatement.execute(OracleStatement.java:1661)
at com.kingdee.bos.sql.shell.KDStatement.execute(KDStatement.java:360)
at com.apusic.jdbc.adapter.StatementHandle.execute(Unknown Source)
at com.kingdee.eas.util.app.DbUtil.execute(DbUtil.java:255)
... 21 more
帮帮忙,我看了好久不知错在哪
update a set a.latesprice = b.amount from T_CONDETAILED a,(select b.amount from t_temp b) b where b.conNo=a.conNumber 展开
update a set a.latesprice = b.amount from T_CONDETAILED a,(select b.amount from t_temp b) b where b.conNo=a.conNumber)
报的错误是:
Caused by: java.sql.SQLException: ORA-00933: SQL command not properly ended
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:111)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:330)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:287)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:744)
at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:206)
at oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:956)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1169)
at oracle.jdbc.driver.OracleStatement.executeInternal(OracleStatement.java:1695)
at oracle.jdbc.driver.OracleStatement.execute(OracleStatement.java:1661)
at com.kingdee.bos.sql.shell.KDStatement.execute(KDStatement.java:360)
at com.apusic.jdbc.adapter.StatementHandle.execute(Unknown Source)
at com.kingdee.eas.util.app.DbUtil.execute(DbUtil.java:255)
... 21 more
帮帮忙,我看了好久不知错在哪
update a set a.latesprice = b.amount from T_CONDETAILED a,(select b.amount from t_temp b) b where b.conNo=a.conNumber 展开
4个回答
展开全部
方法如图:
SQL语言:
结构化查询语言(英文简称:SQL)是一种特殊目的的编程语言,是一种数据库查询和程序设计语言,用于存取数据以及查询、更新和管理关系数据库系统;同时也是数据库脚本文件的扩展名。
结构化查询语言是高级的非过程化编程语言,允许用户在高层数据结构上工作。它不要求用户指定对数据的存放方法,也不需要用户了解具体的数据存放方式,所以具有完全不同底层结构的不同 数据库系统,,可以使用相同的结构化查询语言作为数据输入与管理的接口。结构化查询语言语句可以嵌套,这使它具有极大的灵活性和强大的功能。
1986年10月,美国国家标准协会对SQL进行规范后,以此作为关系式数据库管理系统的标准语言(ANSI X3. 135-1986),1987年得到国际标准组织的支持下成为国际标准。结构化查询语言有五种数据类型: 字符型、文本型、数值型、逻辑型和日期型。
展开全部
--正确SQL
update a
set a.latesprice = (select b.amount
from t_temp b
where b.conNo = a.conNumber)
where a.conNumber in (select b.conNo from t_temp b )
;
--测试数据 临时表
create table temp_x as
select 1 as c_id, 1.1 as c_amount from dual
union all
select 2 as c_id, 1.2 as c_amount from dual
;
create table temp_y as
select 1 as c_id, 1.43 as c_amount from dual
union all
select 2 as c_id, 1.44 as c_amount from dual
;
--测试更新语句
update temp_x a
set a.c_amount = (select b.c_amount
from temp_y b
where b.c_id = a.c_id)
where a.c_id in (select b.c_id from temp_y b)
;
--查询更新结果
select * from temp_x
update a
set a.latesprice = (select b.amount
from t_temp b
where b.conNo = a.conNumber)
where a.conNumber in (select b.conNo from t_temp b )
;
--测试数据 临时表
create table temp_x as
select 1 as c_id, 1.1 as c_amount from dual
union all
select 2 as c_id, 1.2 as c_amount from dual
;
create table temp_y as
select 1 as c_id, 1.43 as c_amount from dual
union all
select 2 as c_id, 1.44 as c_amount from dual
;
--测试更新语句
update temp_x a
set a.c_amount = (select b.c_amount
from temp_y b
where b.c_id = a.c_id)
where a.c_id in (select b.c_id from temp_y b)
;
--查询更新结果
select * from temp_x
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Oracle数据库没有update from 语句,这是SQLServer里面的,就不要想这个了,Oracle可以用另外的方式实现。
我根据你的语句改了下
update T_CONDETAILED a set a.latesprice = (select b.amount from t_temp b where b.conNo=a.conNumber)
你可以试试
我根据你的语句改了下
update T_CONDETAILED a set a.latesprice = (select b.amount from t_temp b where b.conNo=a.conNumber)
你可以试试
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
UPDATE T_CONDETAILED
SET latesprice=t_temp.amount
FROM t_temp
WHERE T_CONDETAILED.conNumber=t_temp.conNo
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询