对表上的Update命令进行calrification

时间:2017-02-06 19:03:12

标签: sql oracle

当我更新下表的emailcontent列时,电子邮件内容列被复制,这是我用来更新的命令,不确定更新命令是否导致重复。以下是我在订单中所做的步骤。

CREATE TABLE notifications
(
  notifymessagetype  VARCHAR2(50 BYTE),
  emailcontent      NCLOB,
  order      NUMBER,
)

INSERT into notifications (notifymessagetype,emailcontent, order) values ('emailbody','*****PLEASE DO NOT REPLY TO THIS EMAIL ******','1')
INSERT into notifications (notifymessagetype,emailcontent, order) values ('emailbody','OrderName','2')
INSERT into notifications (notifymessagetype,emailcontent, order) values ('emailbody','OrderCode','3')
INSERT into notifications (notifymessagetype,emailcontent, order) values ('emailbody','OrderDate','4')
INSERT into notifications (notifymessagetype,emailcontent, order) values ('emailbody','OrderType','5')
INSERT into notifications (notifymessagetype,emailcontent, order) values ('emailbody','OrderNumber','6')

然后我改变了表并添加了一个列并在其中插入了一个值

ALTER TABLE  notifications
RENAME COLUMN emailcontent TO emailcontent_OLD;

ALTER TABLE  notifications
ADD COLUMN emailcontent NCLOB;

UPDATE notifications SET emailcontent  = emailcontent_OLD; 

INSERT into notifications (notifymessagetype, emailcontent_OLD,order,emailcontent) values ('emailbody','The Order has been emailed','7','The Order has been emailed')
更新命令前的

表:1

更新命令后的

表:2

0 个答案:

没有答案