表名能找到,
select * from all_tables where table_name like '%522600%'然后再改
但字段就找不到。
select * from all_tables where table_name like '%522600%'然后再改
但字段就找不到。
解决方案 »
- 关于ORA-39082。请问谁有metalink账号,能否帮我查下这个错误:Doc ID:460267.1
- linux导出oracle下所有对象!
- 菜鸟总是遭遇各种拦路。。。写了个存储过程,怎么在oracle里调用
- sql语句分析..Oracle
- Oracle Report Builder的汇总问问题
- 数据类型
- 求救:存储过程可能存在语法冲突?
- 一个关于long类型的问题?
- 初学者 我在创建一个表空间,然后在这个表空间上创建表,出错,提示:超出表空间'GZGL'的空间限量 (在线等待)
- 如何在sql plus中查看对象(table、index)的存储参数pctfree、pctUsed等?
- 请教:如何数据库启动同时自动启动ctxsrv?
- 求解
create or replace procedure p_test
is
v_owner varchar2(128);
v_tab varchar2(128);
v_col varchar2(128);
--取出所有的用户表,只要用户创建的
cursor cur_tab is select owner,table_name from all_tables where owner in('创建的所有用户名');
--取出所有用户字段,只要用户创建的
cursor cur_col(l_tab varchar2,l_owner varchar2) is select column_name from all_tab_columns where table_name=l_tab and owner=l_owner;
v_sql varchar2(4000);
begin
--遍历表
for c_tab in cur_tab loop
v_owner:=c_tab.owner;
v_tab:=c_tab.table_name;
--遍历每张表的所有字段,查看是否有值为522600的字段,如果有,更新为522601
open cur_col(v_tab,v_owner);
loop
fetch cur_col into v_col;
exit when cur_col%notfound;
v_sql:='update '||v_owner||'.'||v_tab||' set '||v_col||'=''522601'' where '||v_col||'=(select '||v_col||' from '||v_owner||'.'||v_tab||' where '||v_col||'=''522600'')';
execute immediate v_sql;
end loop;
end loop;
exception
when others then
dbms_output.put_line(SQLCODE||':'||SQLERRM);
end;
就是这个意思不过得先试试
以前没用过两个游标(是欠套吧?)