Home > Database > Mysql Tutorial > Oracle中循环语句的触发器

Oracle中循环语句的触发器

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-07 17:24:18
Original
1124 people have browsed it

Oracle中循环语句--loop, 是plsql中最简单的循环语句,这种循环语句以loop开头,以end loop 结尾,这种循环至少会被执行一次,就

Oracle中循环语句--loop
 是plsql中最简单的循环语句,这种循环语句以loop开头,,以end loop 结尾,这种循环至少会被执行一次
就是说先循环一次在去判断

案例:
请编写一个过程,可输入用户,并循环添加10个用户到user表中,用户的编号从1开始

create or replace procedure chenchuang2 (name varchar2) is
 --定义  :=表示赋值
  v_num number:=1;
 begin
 loop
 insert into users values (v_num,name);
--判断是否退出循环
  exit where  v_num:=10;
  v_num:=v_num+1;
end loop;
end;

----------------------------------------------------------循环语句---while循环

while和在java中用法是一样的  是先判断

create or replace procedure chenchuang2 (name varchar2) is
 --定义  :=表示赋值
  v_num number:=11;
 begin
    while v_num insert into users values (v_num,name);
--判断是否退出循环
  exit where  v_num:=10;
  v_num:=v_num+1;
end loop;
end;

linux

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template