Monday, February 11, 2008

Oracle 10g: Guideline Create Update SP

CREATE OR REPLACE PACKAGE [Package Name] IS

TYPE [cursor name] is ref cursor;
PROCEDURE [sp_updateprocedure]
(
[input parameter 1] IN INTEGER,
[input parameter 2] IN INTEGER,
[input parameter 3] IN INTEGER,
[input parameter 4] IN INTEGER
);

END [Package Name];
/


CREATE OR REPLACE PACKAGE BODY [Package Name] IS
PROCEDURE [sp_updateprocedure]
(
[input parameter 1] IN INTEGER,
[input parameter 2] IN INTEGER,
[input parameter 3] IN INTEGER,
[input parameter 4] IN INTEGER
)
AS
BEGIN
UPDATE [table name]
SET
[table name].[fieldname 1] = [input parameter 1],
[table name].[fieldname 2] = [input parameter 2]
WHERE [table name].[fieldname 2] = [input parameter 3];
END;


END [Package Name];
/

No comments: