我的表格如下:
SYS_ID SUB_NET_ID NODE_NAME NODE_ID NODE_EQ_NO NODE_VAR_NO TEMP_ID EQUIP_TYPE EQ_ID VAR_ID VAR_OBJECT VAR_NAME VAR_SUBSET VAR_SET CALC_VAR_TYPE DATA_TYPE DOF
15 1 BLEND 1 13 21 16 5 0 BLEND DEMAND SELF BLEND_OUT VAR CONTINOUS
15 1 BLEND 1 14 6 16 6 0 BLEND DEMAND BLEND BLEND VAR CONTINOUS
15 1 DEST 2 5 2 4 7 0 DEST DEMAND SELF DEST_IN VAR CONTINOUS
15 1 DEST 2 1 3 4 1 0 DEST DEMAND UNDEF DEST_IN VAR CONTINOUS
15 1 DEST 2 4 6 4 4 0 DEST MFLOW SELF DEST_IN VAR CONTINOUS
15 1 SALK 5 6 5 13 4 0 SALK MFLOW SELF SALK_OUT VAR binary
15 1 SPEN 7 8 4 13 6 0 SPEN MFLOW SELF SPEN_OUT VAR integer
我想将data_type列更新为1,其中data_type是连续的,并更新为0,其中它是二进制等等......任何建议
答案 0 :(得分:3)
UPDATE my_tbl SET data_type =
CASE data_type
WHEN 'continous' THEN '0'
WHEN 'binary' THEN '1'
-- more options
ELSE data_type -- to retain original string if no substitute is listed
END;
你知道数据类型仍然不是数字,但它之前的字符串类型是什么,对吗?