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!

PLS-00382: expression is of wrong type

575197Sep 18 2012 — edited Sep 18 2012
Hi,

I am trying to write a routine that will bulk insert test data into a table. Values for table columns will be created dynamically.

Below is the simplified version of what I am trying to achieve.

I am getting PLS-00382: expression is of wrong type.

How do I accomplish this assignment?
declare

    type l_typ_tst_rec_tab        is table of varchar2(32767);
    l_v_tst_rec_tab               l_typ_tst_rec_tab   := l_typ_tst_rec_tab();
    
    type l_typ_tst_data_tab       is table of t_tst%rowtype;
    l_v_tst_data_tab              l_typ_tst_data_tab  := l_typ_tst_data_tab();
    
    l_v_rec_cnt               number := 5;
    
begin
    l_v_tst_rec_tab.extend(l_v_rec_cnt);
    l_v_tst_data_tab.extend(l_v_rec_cnt);
    
    for i in 1 .. l_v_rec_cnt 
    loop
    
        l_v_tst_rec_tab(i) := round(dbms_random.value(00000000,99999999))||','||dbms_random.string('A',44)||','||dbms_random.string('A',64);
        
    end loop;
    
    for j in 1..l_v_tst_rec_tab.count
    loop
    dbms_output.put_line('Start assignment');
        l_v_tst_data_tab(j) := l_v_tst_rec_tab(j);        -- This gives PLS-00382: expression is of wrong type   
    end loop;
        
    --This is what I want to achieve     
    /*forall k in 1..l_v_tst_data_tab.count
    
    insert into
        t_tst
    values
        (l_v_tst_data_tab(k)); */      
        
exception
when others then
    dbms_output.put_line('Inside Motherhood Exception: '||sqlerrm);         
    
end;        
Table Definition
create table t_tst
(
  id   number,
  key  varchar2(44),
  desc varchar2(64)
);
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 16 2012
Added on Sep 18 2012
10 comments
2,001 views