我有大量的Oracle DB更新列表。这是一些生产支持工作。
我的示例更新是这样的
update XYZ
set name = 'abb',
job = 'mgr'
where joining_date = to_date('2015-02-11'
and job_id in (....list of job_id this can be anywhere in 1000s...);
update XYZ
set name = 'jab',
job = 'appdev'
where joining_date = to_date('2016-03-10'
and job_id in (....list of job_id this can be anywhere in 1000s...);
根据加入日期和job_ids,有几个更新。这个列表不胜枚举。
这里真正缺少的是日期格式 'yyyy-mm-dd'
.我正在使用UltraEdit。这是我的客户提供的唯一编辑器。我必须将此日期格式附加到日期中。
我尝试使用正则表达式查找和替换
查找 [0-9]
将",年-月-日"
如果我这样做,日期中的最后一个数字也会被替换。
我有SQL开发人员,如果我们能在SQL开发人员中实现这一目标,那也很棒。
如果我正确理解了这个问题,您正在寻找一种将文本'yyyy-mm-dd'
附加到所有date
语句的方法,以便 2 个示例如下所示:
update XYZ
set name = 'abb',
job = 'mgr'
where joining_date = to_date('2015-02-11','yyyy-mm-dd')
and job_id in (....list of job_id this can be anywhere in 1000s...);
update XYZ
set name = 'jab',
job = 'appdev'
where joining_date = to_date('2016-03-10','yyyy-mm-dd')
and job_id in (....list of job_id this can be anywhere in 1000s...);
如果正确,您可以使用以下选项执行"搜索和替换"操作:
- 查找内容:
to_date(('[-0-9]*')
- 替换为:
to_date($1,'yyyy-mm-dd')
- 选中正则表达式并选择 Perl