INPUT DATA DENGAN PROCEDURE
mysql> create table hoho( nama
varchar(10), alamat varchar(10));
Query OK, 0 rows affected (0.13 sec)
mysql> delimiter #
mysql> create procedure isi( in nama
varchar(10), alamat varchar(10))
-> begin
-> insert into hoho values(nama, alamat);
-> end #
Query OK, 0 rows affected (0.02 sec)
call
isi("Didi","Sleman");
call isi("Fera","Abarawa");
call
isi("Rara","Jogja");
mysql> select * from hoho;
+------+---------+
| nama | alamat |
+------+---------+
| Fera | Abarawa |
| Rara | Jogja |
| Didi | Sleman |
+------+---------+
HAPUS DATA DENGAN PROCEDURE
mysql> delimiter #
mysql> create procedure hapus_data(in par_nama
varchar(10))
->
begin
->
delete from hoho where nama=par_nama;
->
end#
Query OK, 0 rows affected (0.00 sec)
Mysql> delimiter ;
Call hapus_data(“Didi”);
mysql> select * from hoho;
+------+---------+
| nama | alamat
|
+------+---------+
| Fera | Abarawa |
| Rara | Jogja
|
+------+---------+
0 komentar :
Posting Komentar