--创建表
create table text
(
sid number not null primary key,
sname varchar(10),
school varchar(10)
)
--创建新增
create or replace procedure proc_insert
(
i_sid in number,
i_sname in varchar2,
i_school in varchar2
)
is
begin
insert into scott.text(sid,sname,school) values(i_sid,i_sname,i_school);
commit;
end;
--调用
call proc_insert(110,'静静','hello');
--创建更新
create or replace procedure proc_update
(
u_sid in nummber,
u_sname varchar2,
u_school varchar2
)
is
begin
update scott.text set sname=u_sname,school=u_school where sid=u_sid;
end;
--调用
call proc_update(110,'静静啊','纸张');
--创建查询
create or replace procedure proc_select
(
s_sid in number
)
is
s_sname varchar2;
s_school varchar2;
begin
select sname,school into s_sname,s_school from scott.text where sid=s_sid;
end;
--调用
call proc_select(110);
--创建删除
create or replace procedure proc_delete
(
d_sid in number
)
is
begin
delete from scott.text where sid=d_sid;
end;
--调用
call proc_delete(110);
这样写对么
哈哈哈69
相关分类