Friday, December 2, 2016

Create PROCEDURE


CREATE TABLE CUSTOMER (
NAME VARCHAR2(20),  
GENDER VARCHAR2(7),  
ADDRESS VARCHAR2(100));

/*create a producter inert*/


CREATE OR REPLACE PROCEDURE INSERTValue (
p_name CUSTOMER.NAME%TYPE,
p_gender CUSTOMER.GENDER%TYPE,
p_address CUSTOMER.ADDRESS%TYPE)  
IS
BEGIN
INSERT INTO CUSTOMER (NAME, GENDER, ADDRESS)
VALUES (p_name, p_gender, p_address);
COMMIT;
END;

/* Excuted Producter*/
BEGIN
   INSERTValue('&p','&m','&l');
END;


select * from CUSTOMER



CREATE OR REPLACE PROCEDURE UPDATEcustomer (  
p_name IN CUSTOMER.NAME%TYPE,
p_gender IN CUSTOMER.GENDER%TYPE,
p_address IN CUSTOMER.ADDRESS%TYPE)
IS
BEGIN
UPDATE CUSTOMER SET NAME=p_name, GENDER=p_gender, ADDRESS=p_address WHERE NAME=p_name;
COMMIT;
END;

/*DELETE Customer procedure*/

CREATE OR REPLACE PROCEDURE DELETEcustomer (  
p_name IN CUSTOMER3.NAME%TYPE)
IS
BEGIN
DELETE FROM CUSTOMER WHERE NAME=p_name;
END;


No comments:

Post a Comment