17,377
社区成员
发帖
与我相关
我的任务
分享
--可以采用动态SQL,你的表名为: CDR
--1.不带条件更新
declare
v_sql varchar2(200);
begin
v_sql := 'update cdr set day' || to_char(sysdate,'dd') || ' = zhhuye';
execute immediate v_sql;
commit;
end;
/
--2.带条件更新
declare
v_sql varchar2(200);
begin
v_sql := 'update cdr set day' || to_char(sysdate,'dd') || ' = zhhuye where ....';
execute immediate v_sql;
commit;
end;
/
-- 使用动态 SQL
declare
v_sql varchar2(100);
begin
v_sql := 'update t set day' || to_char(sysdate,'dd') || ' = hehhao where ....';
execute immediate v_sql;
end;
-- 如果你用程序实现,也是直接拼接。