Skip to Main Content
  • Questions
  • owa_cookie -- i don't see it in the cookies.txt file

Breadcrumb

Question and Answer

Tom Kyte

Thanks for the question, KK.

Asked: June 28, 2000 - 5:50 am UTC

Last updated: March 01, 2004 - 12:33 pm UTC

Version: 2.2

Viewed 1000+ times

You Asked

I would like to use the package "owa_cookie" to
set and get cookie, but when I write:
"owa_cookie.send('test','value')"
the procedure is executed successfully.
However, when I edit the cookie.txt, nothing is written.

and Tom said...

Cookies by default are session based. Only cookies that have some expiration date associated with them would be stored permanently. By default, cookies with no expiration go away when you close the browser. Those cookies that go away when you close the browser are never written to the cookies.txt file.

Send the optional third parameter to send() -- the expiration date.

Rating

  (4 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

Expring the Cookie

Ray White, February 25, 2003 - 3:53 pm UTC

I am having a problem with the session cookie expiring. IE not there after a few minutes.

I set it without any date
Each http request reads it and re-writes it
I can use the app navigating to and frow without any problem. If I let it sit for a few minutes bingo the cookie is gone and the session cannot be established.

Note1: 8.17 using either IIS with oracle plugin or Apache with mod-plsql plugin
Note2 : All PLSQL genned HTML
Note3: All Packages are genned exactly the same


any ideas?

Tom Kyte
February 25, 2003 - 8:38 pm UTC

got an example?

cookies

ray, March 28, 2003 - 1:44 pm UTC

Sorry I didnt reply to this earlier, I guess I lost the thread but I found my problem.
No problem with the session cookie expiring as first thought. Thanks

if no cookie, no app for you

robert, March 01, 2004 - 12:22 pm UTC

package body wict is
-----------
BEGIN
utl_timer.capture;
IF g_sess_cookie_val IS NULL THEN
g_sess_cookie_val := cookies.get_wict_session_cookie;
END IF;
END wict;

------
Tom, I check for cookie in the body init section...is there a way to just exit completely from within this section if no cookie set ?

thanks

Tom Kyte
March 01, 2004 - 12:33 pm UTC

raise_application_error() will do that.

cant set cookie - gets displayed on the page

A reader, May 30, 2007 - 11:51 am UTC

Tom, I am having the same problem - cookie does not get set. I do have an exparation date. Here is what my proc looks like:

PROCEDURE P_SetCookie IS
v_cookie owa_cookie.cookie;
v_uuid RAW(16);
BEGIN
--Call fun-n to get UUID (basically selects sys_guid()
-- from dual.
v_uuid := F_ReturnUUID();

v_cookie := owa_cookie.get('SSO_EFA');

--FALSE value in mime_header keeps the header open
--so we can insert the cookie into the header section
owa_util.mime_header('text/html', FALSE);

--This cookie will expire every 5 seconds --5/24/60/60
OWA_COOKIE.SEND('SSO_EFA',v_uuid, sysdate + 5/24/60/60
, '/', '.odu.edu');
owa_util.http_header_close;

htp.para;

htp.bold( 'Value of cookie ' || v_cookie.num_vals );

htp.para;

IF (v_cookie.num_vals > 0)
THEN
htp.bold( 'cookie is set and is ' || v_cookie.vals(1) );
ELSE
htp.p( 'cookie is not set' );
END IF;


END P_SetCookie;

I call this procedure b4 I do any logic on my page. The cookie does not get set, as I get "Cookie is not set" with a cookie value of 0. Also, for some reason I get the following printed on top of the page:

Content-type: text/html; charset=ISO-8859-1 Set-Cookie: SSO_EFA=31B27C9DF94663EBE0440000BEA958CA; expires=Wednesday, 30-May-2007 19:17:56 GMT; path=/; domain=.odu.edu;
Value of cookie 0

To me it looks like the cookie never gets into a header and maybe that is why it does not get set? I have no idea if this is even the problem or if it is, how to put it into the header. Please advise. Thank you!

More to Explore

PL/SQL demos

Check out more PL/SQL tutorials on our LiveSQL tool.

PL/SQL docs

PL/SQL reference manual from the Oracle documentation library