Description: Create a procedure called set_cookie that sets a cookie for the name and value passed in using OWA_COOKIE.SEND. The expiration date is optional. If it is supplied, the cookie will be set as a persistent cookie by the browser, with the expiration date supplied. If no expiration date is supplied, then the default value of NULL will be used, making it a session-level cookie. Session-level cookies cease to exist when the browser is closed.
CREATE OR REPLACE PROCEDURE set_cookie
(p_cookie_name IN VARCHAR2,
p_cookie_value IN VARCHAR2,
p_expires IN DATE DEFAULT NULL)
IS
--------------------------------------------------------
-- FILENAME: set_cookie
-- FILEDATE: 01.20.2003
-- CREATED BY: Susan Boardman
-- DESCRIPTION: Sets cookie with parameters passed in.
-- URL : set_cookie
--------------------------------------------------------
BEGIN
OWA_UTIL.mime_header(bclose_header=>FALSE);
OWA_COOKIE.SEND(p_cookie_name,
p_cookie_value,
p_expires);
OWA_UTIL.http_header_close;
END;