Skip to main content

sequence + trigger

create sequence seq_peserta
increment by 1
start with 0001
maxvalue 9999;

create or replace trigger bef_ins_row_peserta
before insert on peserta
for each row
begin
if inserting then
if (:new.id_peserta is NULL) then
select 'PS'||seq_peserta.nextval into :new.id_peserta from dual;
else
raise_application_error(-20103,'wrong initial status');
end if;
end if;
end;
/

insert into peserta values('','rahmat','pga56','085228725252');

================================================
create sequence seq_pengajar
increment by 1
start with 0001
maxvalue 9999;

create or replace trigger bef_ins_row_pengajar
before insert on pengajar
for each row
begin
if inserting then
if (:new.id_pengajar is NULL) then
select 'PG'||seq_pengajar.nextval into :new.id_pengajar from dual;
else
raise_application_error(-20103,'wrong initial status');
end if;
end if;
end;
/
=================================================
create sequence seq_ruang
increment by 1
start with 0001
maxvalue 9999;

create or replace trigger bef_ins_row_ruang
before insert on ruang
for each row
begin
if inserting then
if (:new.id_ruang is NULL) then
select 'RU'||seq_ruang.nextval into :new.id_ruang from dual;
else
raise_application_error(-20103,'wrong initial status');
end if;
end if;
end;
/
======================================
create sequence seq_kursus
increment by 1
start with 0001
maxvalue 9999;

create or replace trigger bef_ins_row_kursus
before insert on kursus
for each row
begin
if inserting then
if (:new.id_kursus is NULL) then
select 'KU'||seq_kursus.nextval into :new.id_kursus from dual;
else
raise_application_error(-20103,'wrong initial status');
end if;
end if;
end;
/
===========================
create sequence seq_jadwal
increment by 1
start with 0001
maxvalue 9999;

create or replace trigger bef_ins_row_jadwal
before insert on jadwal
for each row
begin
if inserting then
if (:new.id_jadwal is NULL) then
select 'JA'||seq_jadwal.nextval into :new.id_jadwal from dual;
else
raise_application_error(-20103,'wrong initial status');
end if;
end if;
end;
/
=========================================
create or replace trigger bef_ins_row_kuota_kursus
before insert on kursus
for each row
begin
if inserting then
if (:new.id_kursus is NULL) then
select 'KU'||seq_kursus.nextval into :new.id_kursus from dual;
else
raise_application_error(-20103,'wrong initial status');
end if;
end if;
end;
/

Comments

Popular posts from this blog

Pilah pilih Webhosting

Bingung pilih webhosting? mau beli hosting dimana? sama.. kadang terlalu banyak pilihan itu malah menyulitkan, alhasil dicobain lah satu per satu. Jadi ini beberapa hosting yang pernah saya coba. (diurutkan berdasarkan waktu pertama nyoba) 1. qwords 2. masterwebnet 3. dracoola 4. dhyhost 5. idwebhost agak susah klo nyuruh nge rank, karena dari masing2 hosting yang dicoba ini tujuan nya beda2. ada yang cuma buat masang joomla, wordpress blog, wordpress portofolio dan online shop. Yang paling susah sih pas buat online shop, karena banyak install plugins dan, di hosting A jalan, di hosting B gak jalan,. lumayan tricky.. Tapi klo di rata2 nilai kepuasan sih sebenarnya yang paling atas adalah dracoola, dari segi loading website yang di host disana cepat, problemnya waktu itu cuma website blog ini yang sepi pengunjung dan tanpa plugins aneh2. jadi mungkin penilaian agak kurang fair. so silakan dicoba saja. Dari segi customer service mungkin yang menang adalah dhyhost, lumayan cep

Tipus

kamis 4 des telat makan, br mkan jm setengah 2, trus pas kul rpl jam 2 rasanya dah puyenk2 gitu sorenya q minta dianterin priksa k rs.. dikasuh obat jumat, sabtu dah membaik lah... minggu dah lumyan senin fit, k jakarta dech... selasa pagi da rapt jam 6, wah rasane dah g karuan... hanis tu kuliah dengan bdan yg cukup lemes... pulang trus makan, trus tidur (mbolos kuliah, untunge g ada dosen) bangun lumyan lah, meski msh g enak bdan slasa sore nganterin temenku k bec, wah rasane wes ndak jelas nih... yenk2an tenan g tau sadara apa tidak pas jalan ksana... wes ra karuan rabu malem da rapat d sekre. wah pas rapat rasane dah menggigil q tanya temennku katanya biasa ajah.. ndak dingin lha kok q kedinginan pulang langsung pake selimut, jaket tebel dan ndak bsa tidur.. pikira aneh2, tugas lah, lpj lah, peristiwa masa lalu lah pagi br bsa tidur, dan gak kuliah dech siangnya q minta temenku k rs lagi dan cek darah dan positif tipes 1/160 untung trombosit msh bgus 187rbu yo wes lah istirahat da

How to Find User Computer Name

open command promt (cmd) and the type "net user" It will show a list of your user from your computer. This command is important when you want to access network sharing computer and then you ask user and password from that computer. If you fill the user with "administrator" its not work, you must fill with real user. You can find with that command.