Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Global variables in a package

Global variables in a package

From: AleX <korrozia_at_my-deja.com>
Date: Tue, 29 Jun 1999 01:07:29 GMT
Message-ID: <7l968b$1n9$1@nnrp1.deja.com>


 Hello all,

need to get this answered.

I'm on Oracle 8.0.5. I'm writing a package in which I need to have several global variables to hold some values. I need to have individual procedures access the variables when needed. However, I'm running into a weird problem. The session_seed variable gets initialized every time another procedure is accessed. In other words, it gets assigned a new value by the accessor function whenever a new procedure is being called. How can I control it? How do global variables behave in the package? Here's a sample of my code..

Package Body PRESENTATION_BUILDER IS

   procedure start_screen
   is

   begin

   htp.formOpen ('presentation_builder.session_archive');
   htp.p('Enter your username');
   htp.formText (cname=>'user_name');
   htp.nl;
   htp.p ('Enter your password');
   htp.formpassword (cname=>'user_password');
   htp.formsubmit;
   htp.formclose;

   end start_screen;

   procedure session_archive
   (user_name IN varchar2,
    user_password in varchar2)
    is
    cursor c_user_list is
    select uname, upass from fenriz.user_list;

    credentials_good boolean:=false;
    temp number(10);
    begin

    for v_data in c_user_list loop

    if upper(v_data.uname)=upper(user_name) and upper(v_data.upass)=upper(user_password) then

     credentials_good:=true;
    end if;
    end loop;

      if credentials_good=true then
        temp:=get_session_seed;
        htp.p ('You may proceed to the ');
        htp.anchor2 ('starting_frame_set?current_seed='||temp, 'Builder
menu');
        else
         htp.p ('Please go back and re-enter your credentials');
      end if;



    end session_archive;

   PROCEDURE starting_frame_set

     (current_seed in number default null)
     IS
   BEGIN
      if current_seed=session_seed then
       do_frame;
   else
      htp.p (current_seed||' '||session_seed||' '||seed_change_count);
      htp.para;
       htp.p ('Please go back and re-enter your credentials');
       end if;

   END starting_frame_set;

[snipping some code]

 function get_session_seed
 return number
 is
 begin

    return session_seed;
 end get_session_seed;

 procedure init_session_seed
 is
 begin

      session_seed := random.rndint (100000);

 end init_session_seed;

begin

init_session_seed;

END; --

                 Alex Shterenberg


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't. Received on Mon Jun 28 1999 - 20:07:29 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US