我的数据库(Oracle 11g)中有一个大表,我想更新表中的列,其中包含特定的数字.
我想通过设置此列的每个值的前缀infront来更新它.
示例(SpecificNumber为int且PK,Value1为Varchar2,因此是最后一列):
实际数据:
[SpecificNumber] [Value1] [column2gettingupdated]
[1] 123456789 Test text
[2] 123456789102 sth text2
[3] 12233 text test3
未来数据(在我的sql之后):
[SpecificNumber] [Value1] [column2gettingupdated]
[1] 123456789 Test PREFIX-text
[2] 123456789102 sth PREFIX-text2
[3] 12233 text PREFIX-test3
所以我想的是:
Update table
set column2gettingupdated=("prefix"+
(select column2gettingupdated from table where SpecificNumber = '12233')
)
where SpecificNumber = '12233';
但是这给了我一个ORA-00904:“p”:无效的标识符错误.
如果我试试这个:
Update table
set column2gettingupdated=("prefix"+
(select column2gettingupdated from table where SpecificNumber = '12233')
)
where SpecificNumber = '12233';
我收到一个ORA-01722:无效的数字错误.
这甚至可能吗?已经感谢您的帮助!