1.创建一个Oracle存储过程,设置一个参数n
然后执行这个存储过程传一个参数n,执行后输出5遍hello world
注:存储过程中使用for循环,执行使用exec
2.创建一个序列(初值为1030,步进为1),
然后使用这个序列给emp表插入2条数据
(要求写出序列的创建语句和插入数据的语句)
然后执行这个存储过程传一个参数n,执行后输出5遍hello world
注:存储过程中使用for循环,执行使用exec
create or replace procedure Hello(n in number)
is begin
for i in 1..n loop
dbms_output.put_line('hello world');
end loop;
end;
/
--打开输出
set serveroutput on;
--执行该函数
execute Hello(5);
2.创建一个序列(初值为1030,步进为1),
然后使用这个序列给emp表插入2条数据
(要求写出序列的创建语句和插入数据的语句)
create sequence myse increment by 1 start with 1030;
insert into emp_xxx values(myse.nextval,'张无忌','Manager',10000,2000,'12-7月-10',1005,10);
本文介绍如何在Oracle中创建一个存储过程,该过程接受一个整数参数并输出指定次数的'helloworld'。同时,文章还展示了如何创建一个序列,并利用此序列来为emp表插入带有特定初始值的数据。
1682

被折叠的 条评论
为什么被折叠?



