Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7822091
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T07:49:39+00:00 2026-06-02T07:49:39+00:00

I have the below code which i have written to debug some information I

  • 0

I have the below code which i have written to debug some information

I want to call GLOBAL.INIT which needs to be called only once per user session

Hence i have used PLSQL table to cache the value and if the SID is different then again call GLOBAL.INIT but the caching is not working,Kindly help me

create or replace procedure dbg(message in VARCHAR2) is
  sid1 NUMBER;
  idx  NUMBER;
  Type sidcache is table of NUMBER index by binary_integer;
  sidcache1 sidcache;
  sid2      NUMBER;
begin

    select sid
      into sid1
      FROM v$session se
     where se.audsid = SYS_CONTEXT('userenv', 'sessionid');
    BEGIN
    sid2 := sidcache1(sid1);
  EXCEPTION
    WHEN no_data_found THEN
      sidcache1(sid1) := sid1;
      global.INIT('100', 'SYSTEM');
      dbms_output.put_line(1);
    WHEN OTHERS THEN
    dbms_output.put_line(sqlerrm);
  END;
  WRITE_DEBUG.pr_debug('LD', message);
end dbg;

EDIT#1:-

After trying Mike’s answer the same requirement was acheived using the below

create or replace procedure dbg(message in VARCHAR2) is
sid2      NUMBER;
BEGIN
  sid2 := WRITE_DEBUG.sidcache1(1);
EXCEPTION
  WHEN no_data_found THEN
    WRITE_DEBUG.sidcache1(1) := 1;
    global.INIT('100', 'DEBUG');
  WHEN OTHERS THEN
    dbms_output.put_line(sqlerrm);
END; 
WRITE_DEBUG.pr_debug('LD', message);
end dbg;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T07:49:42+00:00Added an answer on June 2, 2026 at 7:49 am

    By default PL/SQL variables are initialised each time the block is entered and the values are not carried across calls. This means that each time you call this procedure, the sidcache1 variable will be null.

    An easy way to get around this would be to declare sidcache1 as a variable in a package. Package variables are initialised once per session, with each session having their own unique set of variables. I don’t think you would even need to store the SID, a Boolean might even be sufficient to record if global.init has been called.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to know is below code correct ? I have following code which
I have pasted a code snip below that I have written which reads a
Hi I have written such a code below but it returns wrong output which
I have written some code which checks a site for broken links using the
I have written the java code below, which executes another java program named Newsworthy_RB.
I have a fiddle which displays date picker. same code i have written below
I have below code which overrides equals() and hashcode() methods. public boolean equals(Object obj)
I have the below code, which iterates over a list based on a custom
I have the below code for my a Dialog box for a which contains
I have below is the html code for TD which gets appended after matching

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.