Oracle Stored Procedure to select from multiple procedures, Array as IN parameter and 1 dynamic condition based on the length of the array element -
i have 3 procedures return different columns values insert in same table.
all procedures take array parameter , values of array can of 2 type. if type name = "tin" , if type 2 name = "tan".
ex:
array = {a,b,b,a}; if(a){ name="tin" }else{ name="tan" }
how write procedure values passing array , 1 more condition based length of array element.
set serveroutput on create or replace type arrtype varray(200) of varchar2(50); / created create or replace procedure arrtest (arr_in arrtype) begin in 1..arr_in.count loop if(arr_in(i)='a') dbms_output.put_line('tin'); elsif(arr_in(i)='b') dbms_output.put_line('tan'); else dbms_output.put_line('neither tin nor tan'); end if; end loop; end; / procedure created sql> declare 2 array1 arrtype; 3 begin 4 array1 := arrtype(); 5 array1.extend(3); 6 array1(1) := 'a'; 7 array1(2) := 'b'; 8 array1(3) := 'c'; 9 arrtest(array1); 10 end; 11 / tin tan neither tin nor tan
Comments
Post a Comment