我有两个表具有以下字段:更新表的多个列
表1:OTNAME 表2:SNCODE,描述文本
我想表2的两列添加到表1和更新列。我的查询是:
alter table table1 add sncode integer
alter table table1 add description_text varchar2(30)
update table1 set
sncode,description_text = (SELECT sncode, description_text
FROM table2, table1
WHERE SUBSTR (otname, INSTR (otname,'.', 1, 3)
+ 1,
INSTR (otname, '.', 1, 4)
- INSTR (otname,'.', 1, 3)
- 1)
= sncode)
我得到一个错误:ORA 00927-缺少等于操作符,指向我的更新语句的第二行。感谢有人能指引我走向正确的方向。
问候,
新手
不,这是关于甲骨文。这个问题没有明确提到,但它是用oracle和oracle10g标记的。 – nagul 2009-08-05 10:25:22
我正在使用Oracle 10g。我得到一个错误:“SQL命令没有正确结束” – novice 2009-08-05 10:26:36
sncode之后似乎有一个额外的paranthesis?运行该命令作为`select t1.sncode,t1.description_text from table2..`来首先了解什么是错误的。进一步细分where子句,最终你会发现错误的位。即尝试`从table2`选择substr(...)等等。 – nagul 2009-08-05 11:19:51