商品表:product
i. 产品ID:id
ii. 产品名称:name
iii. 产品规格型号:model要求 添加 商品,数量在100个以上。 产品名不能重复 id为主键 
create table product
(
 id number(4) primary key not null,
 name varchar(30) not null,
 model varchar(50))我这个oracle菜鸟,做给个详细代码,谢谢! 

解决方案 »

  1.   

    declare
       v_count number := 0;
    begin
       while v_count <= 100 loop
          execute immediate 
          'insert into product values('||v_count||', ''goods'''||v_count||', ''xxx'')';
          v_count := v_count + 1;
       end loop;
       
    end;
    /
      

  2.   


    说起添加多行数据,谢谢shiyiwan大哥,嘿嘿
      

  3.   

     v_count number := 0;要改成 v_count number := 1;
      

  4.   

    客气啥 wildwave.inthirties,他说的是100个以上嘛,写成1就变成100个了,呵呵