手机收费系统_计费收费系统
手机收费系统由刀豆文库小编整理,希望给你工作、学习、生活带来方便,猜你可能喜欢“计费收费系统”。
表空间
Create tablespace cellphone
Datafile 'd:cellphone.dbf'
Size 20m autoextend on next 20m
Maxsize 200m;
用户信息表
create table users(id numberprimary key,username varchar2(10)not null,personid varchar2(18)not null,phone varchar2(13),addre varchar2(50))tablespace cellphone;
create sequence se_users
minvalue 1 maxvalue 999999
increment by 1
start with 1
cache 20
noorder cycle;
create or replace trigger tr_users
before upsert on users
for each row
when(new.id is null)
begin
select se_users.nextval into :new.id from dual;
end;
手机信息
create table card(id number not null,userid number references users(id),cellphone varchar(14)not null constraint card_uk unique,opendate date not null,openmoney number not null constraint openmoney_checkcheck(openmoney>0), remainder number not null constraint remainder_checkcheck(remainder>0),paword varchar2(6)not null constraint paword_check check(paword=111111), conditioned number)tablespace cellphone;
alter table card modify opendate default sysdate;
create sequence se_card
minvalue 1 maxvalue 999999
increment by 1
start with 1
cache 20
noorder cycle;
create or replace trigger tr_card
before upsert on card
for each row
when(new.id is null)
begin
select se_card.nextval into :new.id from dual;end;
手机状态表
create table condition(id number not null,cname varchar2(20)not null,constraint condition_pk primary key(id))tablespace cellphone;
create sequence se_condition
minvalue 1 maxvalue 999999
increment by 1
start with 1
cache 20
noorder cycle;
create or replace trigger tri_condition
before insert on condition
for each row
when(new.id is null)
begin
select se_condition.nextval into :new.id from dual;end;