0

可能重复:
Oracle - 使用内部连接更新语句

在 SQL Server Developer Edition 中,我想用另一个表中的值和变量来更新列。

表中sa_tran_itemref_no6字段显示"NYN" ,其他表apo_rms_i_item_placeSORTIMENTSGRUPP_KOD字段显示10

我想更新表sa_tran_itemref_no6字段为"NYN10"

我的查询

UPDATE sa_tran_item 
SET ref_no6 = "ref_no6" + "a.SORTIMENTSGRUPP_KOD" 
FROM apo_rms_i_item_place a, sa_tran_item 
WHERE a.varnummer in  (select item from item_master where item_number_type='MANL' and PRIMARY_REF_ITEM_IND = 'Y' and item_parent in 
(select  ITEM from sa_tran_item where  error_ind = 'Y' and tran_seq_no in 
(select tran_seq_no from sa_error where tran_seq_in ='49910349001'  error_code like 'ACG_NOT_FOUND') ));
4

1 回答 1

0

在oralce 中,双管道||用于连接字符串值。您可以使用更新

SET ref_no6 = ref_no6 || TO_CHAR(a.SORTIMENTSGRUPP_KOD)

如果列SORTIMENTSGRUPP_KOD是整数类型并且

SET ref_no6 = ref_no6 || a.SORTIMENTSGRUPP_KOD

如果它是字符串/varchar2 类型。

于 2013-01-14T10:46:16.230 回答