Mar 7, 2008

Working with Procedures

CREATE OR REPLACE PROCEDURE archive_orders
(cust_id IN NUMBER
,retention IN NUMBER) IS
BEGIN
DELETE orders
WHERE customer = cust_id
AND order_date < SYSDATE - retention;
INSERT INTO maint_log
(action, action_date, who) VALUES
('archive orders '||retention||' for '||cust_id
,SYSDATE ,USER);
END;

EXEC DBMS_OUTPUT.PUT_LINE('Hello world!');
CALL DBMS_OUTPUT.PUT_LINE('Hello world!');

1 comment:

Anonymous said...

Hello. This post is likeable, and your blog is very interesting, congratulations :-). I will add in my blogroll =). If possible gives a last there on my blog, it is about the Smartphone, I hope you enjoy. The address is http://smartphone-brasil.blogspot.com. A hug.