Announcement Announcement Module
Collapse
No announcement yet.
Calling a stored procedure with a list as inputt Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Calling a stored procedure with a list as inputt

    Hi

    I'm trying to call a procedure that takes a list as input.

    Code:
    create or replace
    PACKAGE BODY Matrikkel_test2 IS
    PROCEDURE Testproc( p_MatrikkelTab  in out  MatrikkelTab,
                        p_status        out     varchar2)
    IS
    
    Begin
     dbms_output.put_line('starter Matrikkel_test2');
    -- Initiering
    
      IF p_MatrikkelTab.count != 0 THEN
         FOR i in p_MatrikkelTab.FIRST..p_MatrikkelTab.LAST
             LOOP
                  dbms_output.put_line(p_MatrikkelTab(i).lnr||' '||p_MatrikkelTab(i).tekst);
             END LOOP;
      END IF;
    dbms_output.put_line('Matrikkel_test2 avsluttet');
    
    end testproc;
    As you can see it does not yet do anything usefull
    MatrikkelTab and Matrikkelrec is defined as follows:

    Code:
    CREATE TYPE Matrikkelrec AS OBJECT (
                    lnr                                  varchar2(5),
                    tekst                             varchar2(50));
    /
    
    CREATE TYPE MatrikkelTab
      AS TABLE OF Matrikkelrec ;
    /
    I have made a procedure to test the above code:

    Code:
    PROCEDURE matrikkel_test_start
    IS
    
    p_MatrikkelTab     MatrikkelTab;
    p_MatrikkelRec     MatrikkelRec;
    p_status varchar2(3);
    
    i PLS_integer;
    
    Begin
    
     dbms_output.put_line('starter');
    -- Initiering
                 i:=0;
                 p_MatrikkelTab:=maTRIKKELtAB();
                 p_MatrikkelTab.EXTEND; 
                 i:=1;
    
                 p_MatrikkelTab(i) := MAtrikkelRec('A','A tekst');
    dbms_output.put_line('ETTER 1. P┼FYLL');
                 p_MatrikkelTab.EXTEND; 
                 i:=i + 1;
                 p_MatrikkelTab(i) := MAtrikkelRec('B','B tekst');
    dbms_output.put_line('ETTER 2. P┼FYLL');
                 i:=i + 1;
                 p_MatrikkelTab.EXTEND;
                 p_MatrikkelTab(i) := MAtrikkelRec('C','C tekst');
    dbms_output.put_line('ETTER 3. P┼FYLL');
    
     matrikkel_test2.Testproc(      p_MatrikkelTab,p_status);
             
    dbms_output.put_line('slutter');
    
    end matrikkel_test_start;
    It just populates the MatrikkelTab table, and starts the Testproc.

    I need to do what matrikkel_test_start does here, but in java, using Spring. After a long day googling I have not become much smarter, so any help would be very useful.

    -Henrik
Working...
X