如何将记录添加到历史表 [英] How ato add record to history table
问题描述
我在oracle数据库中有2个表.
第一个表是名称,它具有列A,B,C
第二个表是NamesHistory,其中具有AH,BH,CH,HistoyDate列
我想将记录从表名移动到NamesHistory.A列中的数据将进入AH列,从B到BH等.
我想使用HistoyDate列来跟踪该记录在哪一天移到历史记录表.
最初,当未添加HistoyDatecolumn时,我使用了查询
将名称插入历史(AH,BH,CH)从名称中选择A,B,C;
现在在NamesHistory列中,我要插入SYSDATE.
有人可以告诉我该怎么做吗?
I have 2 tables in oracle database.
First table is Names and it has Columns A,B,C
Second table is NamesHistory which has columns AH,BH,CH,HistoyDate
I want to move record from table names to NamesHistory.Data from column A will go in column AH,from B to BH so on.
I want to use column HistoyDate, to trace at which date this record was moved to history table.
initially when HistoyDatecolumn was not added i used query
INSERT INTO NamesHistory (AH,BH,CH) SELECT A,B,C FROM Names;
Now in column NamesHistory i want to insert SYSDATE.
Can someone tell me how to do so?
推荐答案
hi,
在您的NamesHistory中添加HistoryDateColumn列后,请务必更新您的表.
整列将为空值.
然后简单地运行一条更新语句,如
更新NamesHistory设置HistoryDate = sysdate
hi ,
please do update your table , after adding the column HistoryDateColumn into your NamesHistory.
the entire column will have null values.
Then simple run one update statement like
update NamesHistory set HistoryDate = sysdate
这篇关于如何将记录添加到历史表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!