ZKX's LAB

oracle or 重复数据 Oracle 如何查询相同的数据

2021-04-03知识3

oracle 随机生成12位不重复数据,求高手写个存储过程。高分!!! create or replace procedure insert_random_Code(maxNum in number)asv_code number;v_count number;i number;begini:=0;for i in 0.maxNum-1 loopselect trunc(dbms_random.value(100000000000,1000000000000))into v_code from dual;select count(*)into v_count from code_table_01 where code=v_code;if v_count=0 thenselect count(*)into v_count from code_table_02 where code=v_code;if v_count=0 theninsert into code_table_02(code)values(v_code);i:=i+1;end if;end if;end loop;if i=maxNum thencommit;elsifroolback;end if;end;求推荐 求采纳e799bee5baa6e997aee7ad94e4b893e5b19e31333330343830 求赞

ORACLE数据库视图里面判断当某字段值重复就判断另一字段是否等于特定值,如何实现 如我有一个表tb_a,字段id,name,值ac-01,x ac-02,s ac-03,m 表tb_b 字段 fk c_value 值 。

Oracle 从一个表导入到另一个表。重复的数据照样导入,但是在导入的表中有一个列,重复的数据就变成1 create or replace procedure a_biscursor mycuris select a.name,a.sex from a,b where a.name=b.name and a.sex=b.sex;vname a.name%type;vsex a.sex%type;beginopen mycur;loopfetch mycur into vname,vsex;exit when mycur%notfound;insert into b(name,sex,flag)values(vname,vsex,1);end loop;close mycur;insert into b(name,sex)select a.name,a.sex from a where a.name not in(select b.name from b)or sex not in(select b.sex from b);end;

#oracle or 重复数据

随机阅读

qrcode
访问手机版