Procedimientos en Oracle
CREATE OR REPLACE PROCEDURE USP_INSERT_MARCA(cod IN char, nom IN varchar2, des IN varchar2) IS BEGIN INSERT INTO MARCA(codmarca,nombre,descripcion) VALUES(cod,nom,des); COMMIT; EXCEPTION WHEN OTHERS THEN ROLLBACK; END USP_INSERT_MARCA; --ejecutando BEGIN USP_INSERT_MARCA('M05','AKITA','PROCEDENCIA CHINA'); END; CREATE OR REPLACE PROCEDURE USP_UPDATE_MARCA(nom IN varchar2, des IN varchar2, cod IN char) IS Begin UPDATE MARCA SET nombre=nom, descripcion=des WHERE codmarca=cod; COMMIT; EXCEPTION WHEN OTHERS THEN ROLLBACK; End USP_UPDATE_MARCA; --ejecutando BEGIN USP_UPDATE_MARCA('ACER','MADE IN CHINA','M04'); END; CREATE OR REPLACE PROCEDURE USP_DELETE_MARCA(cod IN char) IS BEGIN DELETE FROM MARCA WHERE codmarca=cod; COMMIT; EXCEPTION WHEN OTHERS THEN ROLLBACK; END; --ejecutando BEGIN USP_DELETE_MARCA('M02'); END; --By Ing. Jhonatan Abal Mejia