Assigning object type in plsql

I need your help to know how to assign the object type through a string in PLSQL
Below is the problem description:

I first created the object types as below:

create or replace type picu_obj is  object(Customer_ID varchar2(32767),Customer_Name varchar2(32767),Server_Name varchar2(32767),Time_stamp varchar2(32767));
create or replace type picu_obj_tab is table of picu_obj;

and I have a PLSQL block as below:

declare
 l_str1 varchar2(1000);
  l_str2 varchar2(10000);
   l_newstr1_1 varchar2(10000);
   picu_var picu_obj_tab;
   cursor c1cudetails
  is
    select item,current_value
    from
      (select rownum,
        last_value(category ignore nulls) over (order by rownum) category ,
        last_value(item ignore nulls) over (order by rownum) item,
        current_value
      from pi_perfdata_new
      order by rownum
      )
  where upper(category) like '%CUSTOMER%DETAILS%' ;
  type cudet is table of c1cudetails%rowtype index by pls_integer;
  l_cudet cudet;
begin
/* create dynamic string for items */
  open c1cudetails;
       fetch c1cudetails bulk collect into l_cudet limit 50;
       for i in l_cudet.first..l_cudet.last loop

       l_str1:=l_str1||','||''''||l_cudet(i).current_value||'''';
       l_str2:=trim(leading ',' from l_str1);
       l_newstr1_1:='picu_obj_tab(picu_obj('||l_str2||'))';
       end loop;
      --  dbms_output.put_line(''||l_newstr1_1||'');
     -- picu_var := l_newstr1_1;
   close c1cudetails;
  end;

For the string "l_newstr1_1" following value is retruned from above PLSQL block
picu_obj_tab(picu_obj('CSCO5','DXRTYE','PI22-pro-333','2015-07-22-22:48:56'))

Now I want to assign the above result to variable “picu_var” which I have declared.

Basically I need to convert to the following during runtime.

picu_var := picu_obj_tab(picu_obj('CSCO5','DXRTYE','PI22-pro-333','2015-07-22-22:48:56'))

How to achieve the same?

Please suggest how to initialize the object type variable to the string values.


Download assigning.object.type.in.plsql.zip
Direct Link


Download


Download assigning.object.type.in.plsql.zip
Mediafire


Download


Download assigning.object.type.in.plsql.zip
Filedropper


Download


Download assigning.object.type.in.plsql.zip
Mightyupload


Download


Download assigning.object.type.in.plsql.zip
Depositfiles


Download

Both comments and pings are currently closed.

Comments are closed.