文档介绍:of accountability, redress of orders and prohibitions. Strengthening the honesty and self-discipline of leading cadres headers ability to resist
of accountability, redress of orders and prohibitions. Strengthening the honesty and self-discipline of leading cadres honesty in politics and education work, enhance leaders ability to resist
实验二《自动编号问题》
实验学时: 2 实验地点: 实验日期:
一、实验目的
存储过程的综合练习。
二、实验内容
医院门诊挂号,要求号连续,并且退的号要能重用。每次挂号向号表中插入一条记录,退号从号表中删除一条记录,请设计一个方案来实现。
可以考虑sequence
挂号、退号均使用存储过程
create table hos_rec(
id number(10) primary key, --连续号
section varchar2(20), --挂号科室
register_date date --挂号日期
);
三、实验步骤
1、创建表
create table hospital(
id number(10) not null,
section varchar2(20), --挂号科室
register_date date );
2、创建sequence
of accountability, redress of orders and prohibitions. Strengthening the honesty and self-discipline of leading cadres honesty in politics and education work, enhance leaders ability to resist
of accountability, redress of orders and prohibitions. Strengthening the honesty and self-discipline of leading cadres honesty in politics and education work, enhance leaders ability to resist
of accountability, redress of orders and prohibitions. Strengthening the honesty and self-discipline of leading cadres honesty in politics and education work, enhance leaders ability to resist
CREATE SEQUENCE id_Sequence
minvalue 1
nomaxvalue
INCREMENT BY 1 -- 每次加几个
START WITH 1 -- 从1开始计数
NOCYCLE ; -- 一直累加,不循环
3、创建插入记录的存储过程
create or replace procedure insert_hospital(new_section varchar2)
is
new_date date;
new_id number(10);
id_temp number(10) :=1;
cursor id_cursor is select id from hospital;
of accountability, redress of orders and prohibitions. Strengthening the honesty and self-discipline of leading cadres honesty in politics and education work, enhance leaders ability to resist
of accountability, redress of orders and prohibitions. Strengthening the hones