首页 新闻 赞助 找找看

Oracle游标如何动态遍历表的所有行的每一列值,目的是判断,是否包含邮件的@符号

0
悬赏园豆:30 [待解决问题]

declare
cursor cursor_table is select * from FD_D1H10;
row_table FD_D1H10%Rowtype;
--numb number(7,2):=0;
begin
open cursor_table;
loop
fetch cursor_table into row_table;
exit when cursor_table%notfound;

     declare
       cursor cursor_column is select COLUMN_NAME from user_tab_columns  t where t.table_name  = 'FD_D1H10';
       row_column user_tab_columns.COLUMN_NAME%type;
     begin
       open cursor_column;
       loop
         fetch cursor_column into row_column;
         exit when cursor_column%notfound;
         --numb := numb + 1;
         --此处如何实现啊:dbms_output.put_line(row_table.DH161);
       end loop;
       close cursor_column;
     end;

end loop;
close cursor_table;
end;

pecool的主页 pecool | 初学一级 | 园豆:14
提问于:2020-04-10 14:49
< >
分享
所有回答(1)
0

我做的话 循环遍历表的列拼接sql语句成
select * from T t
where t.Field1 like '%@%'
or t.Field2 like '%@%'
....
如果要精确到哪一行 那一列的话 我觉得用代码更容易一些

摩尼酸奶 | 园豆:308 (菜鸟二级) | 2020-04-10 15:49

不止一个表,是要洗出数据库里所有的表数据是否包含@符号

支持(0) 反对(0) pecool | 园豆:14 (初学一级) | 2020-04-10 17:41

@pecool: 这个需求有点妖啊 没想到太好的办法 就是循环表 循环字段了 要求不精确的话直接导出数据脚本搜索 哈哈

支持(0) 反对(0) 摩尼酸奶 | 园豆:308 (菜鸟二级) | 2020-04-10 18:03

@摩尼酸奶: 肯定是有办法的,dbms_sql貌似可以,我正在研究。

支持(0) 反对(0) pecool | 园豆:14 (初学一级) | 2020-04-13 09:33
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册