Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How can I find out PGA usage?

unknown-879931Jan 30 2015 — edited Feb 1 2015

Hi All,

I am trying to measure PGA usage. In other words, how packages can consume PGA memory. Therefore I wrote the following code.I am wondering what happen on PGA memory after the following code run? I want to compare before and after.

So, which table should I query?

By the way which tag should I use for PL/SQL code? {code} this doesn't work?

create or replace
package pga_pkg
is

function get_emp_name(emp_id employees.employee_id%type) return employees.first_name%type;

end pga_pkg;

create or replace
package body pga_pkg
is

  type my_type is table of employees.first_name%type
  index by pls_integer;
 
  my_arr my_type;

  function get_emp_name(emp_id employees.employee_id%type)
  return employees.first_name%type
  is
  begin
 
    return my_arr(emp_id);
   
    exception
      when no_data_found then
      return NULL;
  end get_emp_name;

begin

  for rec in (select employee_id, first_name from employees)
  loop
    my_arr(rec.employee_id) := rec.first_name;
  end loop;
  dbms_output.put_line('Constructor...');

end pga_pkg;

Thanks in advance.

This post has been answered by S27 on Feb 1 2015
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 1 2015
Added on Jan 30 2015
5 comments
30,209 views