创建:
create or replace procedure p_inputParam(input_id IN student0.id%TYPE) is --IN 表示输入参数
--声明变量
v_id student0.id%TYPE;
v_name student0.name%TYPE;
v_class student0.class%TYPE;
begin
--查询student0表中参数赋值给声明变量;
select id,name,class into v_id,v_name,v_class from student0 where id = input_id;
dbms_output.put_line(v_id||'-----'||v_name||'------'||v_class);
end p_inputParam;
执行一
SQL> exec p_inputParam(1);
PL/SQL 过程已成功完成。
SQL> set serveroutput on;
SQL> exec p_inputParam(1);
1-----黄晓明------一年级
PL/SQL 过程已成功完成。
SQL>
执行二
-- Created on 2021/3/17 by 柴英兵
declare
-- Local variables here
i integer;
begin
-- Test statements here
p_inputparam(1);
end;
SQL> select * from student0;
ID NAME AGE SEX
-------------------- -------------------- -------------------- --------------
CLASS
--------------------
1 黄晓明 40 30-12月-99
一年级
2 刘德华 59 30-12月-99
二年级
3 杨颖 40 15-3月 -21
一年级
【oracle】存储过程11有输入参数的存储过程
猜你喜欢
转载自blog.csdn.net/weixin_40074861/article/details/121855105
今日推荐
周排行