Array parameter to procedure

Hi
i want to pass an array to a procedure and get the employee details from emp table..
for that i tried the following way
CREATE OR REPLACE package pak as
type tp is table of emp.emp_type%type;
procedure procc (cur out sys_refcursor,emptype in tp);
end;
CREATE OR REPLACE package body pak as
procedure procc (cur out sys_refcursor ,emptype in tp)
is
begin
open cur for
     select * from emp where emp_type in(emptype);
end;
end;
but am getting the following error while compilation
PLS-00642: local collection types not allowed in SQL statements..
here emptype is an array..and i want to get all the detail of employee of the selected types..
please help me with this
regards
ben

why it is not supporting table.column%typeBecause COLUMN%TYPE is a piece of PL/SQL syntax not SQL syntax. So we cannot define a SQL type using COLUMN%TYPE. Unfortunately, in order to be able to use a Type in a SELECT * FROM TABLE() function it has to be a SQL type.
As for why SQL Types have this limitation, it is - like many other limitations of the CDT implementation - a product of the ability to use CDTs as column definitions. Consider the following scenario....
CREATE TABLE my_tab (col1 varchar2(18))
CREATE TYPE my_new_type AS OBJECT (attr1 my_tab.col1%TYPE);
CREATE TABLE my_obj_tab (col_a my_new_type)
INSERT INTO my_obj_tab VALUES ('This is not a date')
ALTER TABLE my_tab MODIFY col1 DATE
/Does Oracle have to validate every single usage of my_new_type to ensure that all its values are capable of date conversion? Of course not. It won't let us modify any column that contains data.
It's unfortunate that this has a knock-on effect on those of us who just want to use Types as programming constructs and not for storage but them's the breaks.
Cheers, APC

Similar Messages

  • Passing array to the procedure in parameter

    Hi
    I tried the following code,
    Where my aim is to split the comma separated values and insert into an array, and then pass that array to another procedure in a package
    CREATE OR REPLACE PACKAGE PAK_SPLIT_TEST AS
    PROCEDURE PROC_SPLIT(IN_LIST  VARCHAR2) ;
    END;
    CREATE OR REPLACE PACKAGE PAK_SPLIT_TEST AS
    PROCEDURE PROC_SPLIT(IN_LIST  VARCHAR2) ;
    END;
    CREATE OR REPLACE PACKAGE PAK_SPLIT_TEST
    AS
       PROCEDURE PROC_SPLIT (IN_LIST VARCHAR2);
    END;
    CREATE OR REPLACE PACKAGE BODY PAK_SPLIT_TEST
    AS
       PROCEDURE PROC_REM_LIST (p_array l_data)
       IS
       BEGIN
          FOR i IN 1 .. p_array.COUNT
          LOOP
             DBMS_OUTPUT.put_line (p_array (i));
          END LOOP;
       END;
       PROCEDURE PROC_SPLIT (IN_LIST VARCHAR2)
       IS
          TYPE SPLIT_array IS TABLE OF VARCHAR2 (4000)
                                 INDEX BY BINARY_INTEGER;
          l_data   SPLIT_array;
          l_txt    LONG := '100,200,300,400,500,600';
          l_str    LONG := IN_LIST || ',';
          l_n      NUMBER;
       BEGIN
          BEGIN
             l_data.delete;
             LOOP
                l_n := INSTR (l_str, ',');
                EXIT WHEN NVL (l_n, 0) = 0;
                l_data (l_data.COUNT + 1) := SUBSTR (l_str, 1, l_n - 1);
                l_str := SUBSTR (l_str, l_n + 1);
             END LOOP;
             PROC_REM_LIST (l_data);
          END;
       END;
    SELECT *FROM USER_ERRORSI'm getting the following error at line no. 30
    PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following:
       begin end function package pragma procedure formCould you please help me in this
    Thanks,
    Smile

    Give this a shot:
    CREATE OR REPLACE PACKAGE BODY PAK_SPLIT_TEST
    AS
          TYPE SPLIT_array IS TABLE OF VARCHAR2 (4000)
                                 INDEX BY BINARY_INTEGER;
       PROCEDURE PROC_REM_LIST (p_array SPLIT_array)
       IS
       BEGIN
          FOR i IN 1 .. p_array.COUNT
          LOOP
             DBMS_OUTPUT.put_line (p_array (i));
          END LOOP;
       END;
       PROCEDURE PROC_SPLIT (IN_LIST VARCHAR2)
       IS
          l_data   SPLIT_array;
          l_txt    LONG := '100,200,300,400,500,600';
          l_str    LONG := IN_LIST || ',';
          l_n      NUMBER;
       BEGIN
          BEGIN
             l_data.delete;
             LOOP
                l_n := INSTR (l_str, ',');
                EXIT WHEN NVL (l_n, 0) = 0;
                l_data (l_data.COUNT + 1) := SUBSTR (l_str, 1, l_n - 1);
                l_str := SUBSTR (l_str, l_n + 1);
             END LOOP;
             PROC_REM_LIST (l_data);
          END;
       END;
    END pak_split_test;
    /PROC_REM_LIST was expecting a PL/SQL type of L_DATA. You have not defined that type anywhere (e.g. in your package spec, body, or in SQL). I move the declaration from PROC_SPLIT to your package body and it compiles.
    Hope this helps!

  • ARRAYS in stored procedures?

    is it possible to have an ARRAY be passed as an In and/or Out
    Parameter in a stored procedure call? if so then can someone
    please show me how? (ie what do i register as the Out, etc.) or
    do i have to use a resultset to access it?
    null

    Artie (guest) wrote:
    : is it possible to have an ARRAY be passed as an In and/or Out
    : Parameter in a stored procedure call? if so then can someone
    : please show me how? (ie what do i register as the Out, etc.)
    or
    : do i have to use a resultset to access it?
    Yes u can pass array to a procedure.
    I have created a package that stores the array
    definition, and the procedure by name abc which takes an array as
    out parameter (script proc1.sql)
    and the second script proc2.sql calls the procedure abc and
    prints some result
    /*File proc1.sql*/
    /*IT creates the package T with the definition of array
    and passes to the procedure*/
    CREATE OR REPLACE PACKAGE T as
    TYPE arr_type is table of number index by binary_integer;
    test_array arr_type;
    END;
    CREATE OR REPLACE PROCEDURE abc(t OUT T.arr_type ) IS
    begin
    for i in 1..10
    loop
    t(i) := i ;
    end loop;
    end abc;
    /*End of Program proc1.sql*/
    /*Program proc2.sql*/
    /*This file calls the procedure abc and prints the result*/
    declare
    test_array T.arr_type;
    begin
    abc(test_array);
    for i in 1..10 loop
    dbms_output.put_line('Result '

  • Passing a html array to a procedure then to another procedure

    Hi Sir,
    Passing an array from html to procedure can be done by having html form elements with same name and a IN parameter in procedure that uses OWA_UTIL.IDENT_ARR as the datatype.
    What if from the receiving procedure A, I want to pass the array further to another procedure B:
    1)How should I write the statement to pass?
    2)How should I declare the parameter in procedure B?
    Please advise.
    Thanks.

    Hi Sir,
    Passing an array from html to procedure can be done by having html form elements with same name and a IN parameter in procedure that uses OWA_UTIL.IDENT_ARR as the datatype.
    What if from the receiving procedure A, I want to pass the array further to another procedure B:
    1)How should I write the statement to pass?
    2)How should I declare the parameter in procedure B?
    Please advise.
    Thanks.

  • How to pass value in array to another procedure?

    Hello.
    I have created application by Developer form9i.
    And I have some problem about passing value in array to another procedure.
    My code is :
    PROCEDURE p_add_array (col_no in number,
    col_val in varchar2) IS     
    type xrecord is record(col number,vcol varchar2(1000));
    xrec xrecord;
    type varraytype is varying array(42) of xrecord;     
    xvartab varraytype := varraytype();
    alert number;
    BEGIN
    set_application_property(cursor_style,'busy');
    xrec.col := col_no;
    xrec.vcol := col_val;
    xvartab.extend(1);
    xvartab(col) := xrec;
    EXCEPTION
    when others then
    set_application_property(cursor_style,'default');
    alert := f_show_alert('!Error ORA-'||
    to_char(DBMS_ERROR_CODE)||' '||
    substr(DBMS_ERROR_TEXT,1,240),
    'al_stop');          
    END;
    And I want to have
    PROCEDURE p_print_arrey is
    BEGIN
    END;
    So how to bring value of xvartab( ) in p_add_array to use in p_print_array?
    Anybody please help me solve this ploblem.

    Hi,
    Instead of declaring the array locally within the procedure (i.e. p_add_array), define it in the package specification (i.e. Under Program Units).
    -- Shailender Mehta --

  • How to execute the parametered stored procedure in sql *plus ?

    how to execute the parametered stored procedure in sql *plus ?
    my storedprocedure format
    CREATE OR REPLACE PROCEDURE SMS_SELECTMPLOYEE
    (empDOB out date, empEmpName out varchar2)
    thanks & regards
    mk_mur

    Oh, sorry... making many reading-too-fast mistakes today...
    You can't declare date variables in SQL*Plus (seel help var), but you can cast to varchar2:
    TEST> CREATE OR REPLACE PROCEDURE SMS_SELECTMPLOYEE (empDOB out date, empEmpName out varchar2) IS
      2  d date := sysdate;
      3  e varchar2(10) := 'bob';
      4  begin
      5  empdob := d;
      6  empempname := e;
      7  end;
      8  /
    Procedure created.
    TEST> var d varchar2(30)
    TEST> var n varchar2(30)
    TEST> call  SMS_SELECTMPLOYEE(:d,:n);
    Call completed.
    TEST> print d n
    D
    11/07/06
    N
    bobYoann.

  • How to assign Values to nested table and pass as parameter to procedure?

    How to assign Values to nested table and pass as parameter to procedure?
    Below is the Object and its type
    create or replace type test_object1 as object
    val1 varchar2(50),
    val2 varchar2(50),
         val3 varchar2(50)
    create or replace type test_type1 is table of test_object1;
    create or replace type test_object2 as object
    val1 varchar2(50),
    val2 varchar2(50),
         val3 varchar2(50)
    create or replace type test_type2 is table of test_object2;
    GRANT ALL ON test_object1 TO PUBLIC;
    GRANT ALL ON test_type1 TO PUBLIC;
    GRANT ALL ON test_object2 TO PUBLIC;
    GRANT ALL ON test_type2 TO PUBLIC;
    here is the table made of object type:
    create table test_object_tpe
    sl_num NUMBER,
    description VARCHAR2(100),
    main_val1 test_type1,
    main_val2 test_type2
    NESTED TABLE main_val1 STORE AS tot1
    NESTED TABLE main_val2 STORE AS tot2;
    here is the procedure which inserts values into nested table:
    PROCEDURE INSERT_TEST_DATA(sl_num IN NUMBER,
    description IN VARCHAR2,
    p_main_val1 IN test_type1,
    p_main_val2 IN test_type2
    IS
    BEGIN
    FOR rec in p_main_val1.first..p_main_val1.last
    LOOP
    INSERT INTO xxdl.test_object_tpe
    sl_num,
    description,
    main_val1,
    main_val2
    VALUES
    sl_num
    ,description
    ,test_type1 (test_object1(
    p_main_val1(rec).val1,
                                       p_main_val1(rec).val2,
    p_main_val1(rec).val3
    ,test_type2 (test_object2( p_main_val2(rec).val1,
                        p_main_val2(rec).val2,
                        p_main_val2(rec).val3
    END LOOP;
    commit;
    END INSERT_TEST_DATA;
    here is the anonymoys block which assigns values to the object type and pass values into the procedure:
    set serveroutput on;
    declare
    p_sl_num NUMBER := 1001;
    p_description VARCHAR2(50) := 'Testing Val1';
    inval1 test_type1 := test_type1();
    inval2 test_type2 := test_type2();
    begin
    inval1(1).val1 := 'testx1';
    inval1(1).val2 := 'testx2';
    inval1(1).val3 := 'testx3';
    inval2(1).val1 := 'testy1';
    inval2(1).val2 := 'testy2';
    inval2(1).val3 := 'testy3';
    CSI_PKG.INSERT_TEST_DATA(sl_num => p_sl_num,
    description => p_description,
    p_main_val1 => inval1,
    p_main_val2 => inval2
    end;
    Can anybody correct me.
    Thanks,
    Lavan

    Thanks for posting the DDL and sample code but whenever you post provide your 4 digit Oracle version (result of SELECT * FROM V$VERSION).
    >
    How to assign Values to nested table and pass as parameter to procedure?
    >
    Well you are doing almost everything wrong that could be done wrong.
    Here is code that works to insert data into your table (the procedure isn't even needed).
    declare
    p_sl_num NUMBER := 1001;
    p_description VARCHAR2(50) := 'Testing Val1';
    inval1 test_type1 := test_type1();
    inval2 test_type2 := test_type2();
    begin
    inval1.extend();
    inval1(1) := test_object1('testx1', 'testx2', 'testx3');
    inval2.extend();
    inval2(1) := test_object2('testy1', 'testy2', 'testy3');
    INSERT INTO test_object_tpe
    sl_num,
    description,
    main_val1,
    main_val2
    VALUES
    (p_sl_num, p_description, inval1, inval2);
    commit;
    end;
    /See Example 5-15 Referencing a Nested Table Element in Chap 5 Using PL/SQL Collections and Records in the PL/SQL doc
    http://docs.oracle.com/cd/B28359_01/appdev.111/b28370/collections.htm#CJABEBEA
    1. You don't even need the procedure since all it does is a simple INSERT into the table which you can do directly (see my code above)
    inval1(1).val1 := 'testx1';There is no element one (1) of 'inval1' since you haven't created any elements yet. You need to EXTEND the collection to add an element
    inval1.extend();And then there is an empty element but 'inval1' is a container for objects of type 'test_object1' not for scalars like 'val1', 'val2', and 'val3'.
    So you can't do
    inval1(1).val1 := 'testx1';You have to create an instance of 'test_object1'
    inval1(1) := test_object1('testx1', 'testx2', 'testx3');And so on for the other collection
    You don't need the procedure (as my sample code shows) but once you populate the variables properly it will work.

  • How to pass ARRAY to Oracle Procedure

    Hi
    We are using BC4J with JSP in our project. We need to send an Array to the procedure.
    Could somebody provide some info as how this can be achieved.

    A while back, I used a SQLJ client to call a Java (also SQLJ) stored procedure and I needed to pass an array of strings to the procedure. I did something like this:
    Java Class that was loaded in DB:
    public class MyClass
    // method that the stored procedure uses
    public static void CALL_DOSTUFF(String a,
    oracle.sql.ARRAY b,
    oracle.sql.ARRAY c)
    String[] bb = (String[])b.getArray();
    String[] cc = (String[])c.getArray();
    doStuff(a,bb,cc);
    public static void doStuff(String a,
    String[] b,
    String[] c)
    // process the input
    In the database I added the type:
    create or replace type STR_ARRAY as table of varchar2(20);
    and the procedure:
    create or replace procedure CALL_DOSTUFF(a varchar2,
    b STR_ARRAY,
    c STR_ARRAY)
    as
    language java
    name 'MyClass.CALL_DOSTUFF(java.lang.String,
    oracle.sql.ARRAY,
    oracle.sql.ARRAY)';
    I then used jpub to publish a STR_ARRAY.java file. I compiled this and used it with my SQLJ client to call to the stored procedure. The STR_ARRAY constructor takes a String[], so you do something like this in the SQLJ client:
    String x = "X";
    String y = {"y1","y2"};
    String z = {"z1","z2"};
    STR_ARRAY y1 = new STR_ARRAY(y);
    STR_ARRAY z1 = new STR_ARRAY(z);
    #sql {CALL CALL_DOSTUFF(:x,:y1,:z1)};
    Hope this helps.

  • How to use array as parameter in procedure

    Hello,
    I am using Oracle SQL Developer 1.5.5
    I wanted to write a procedure which does insert into table.
    It should take 2 parameters.How to take array as parameter?
    One is a array of strings ('abc','def','erg') and another is a varchar ('abc').
    How to do this?
    Can somebody pls give a small example?
    Thanks
    Edited by: user13305573 on Aug 5, 2010 11:27 PM

    Hello,
    I am sorry if u didnt get my point.
    My req is i am using Orcale SQL Developer.
    Db is Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
    I want to write a procedure which will be called from a java file.
    The parameter to that procedure will be a arr(array of strings) and username(varchar).
    I want to insert that data into a tableA.
    like if parameters are
    (abc01,edfg02,efg03) as arr and honey as username
    then it should insert 3 rows to the tableA
    abc01 honey
    edfg02 honey
    efg03 honey
    Thanks
    Edited by: user13305573 on Aug 5, 2010 11:54 PM

  • Trying to pass array to stored procedure in a loop using bind variable

    All,
    I'm having trouble figuring out if I can do the following:
    I have a stored procedure as follows:
    create procedure enque_f826_utility_q (inpayload IN f826_utility_payload, msgid out RAW) is
    enqopt dbms_aq.enqueue_options_t;
    mprop dbms_aq.message_properties_t;
    begin
    dbms_aq.enqueue(queue_name=>'f826_utility_queue',
    enqueue_options=>enqopt,
    message_properties=>mprop,
    payload=>inpayload,
    msgid=>msgid);
    end;
    The above compiles cleanly.
    The first parameter "inpayload" a database type something like the following:
    create or replace type f826_utility_payload as object
    2 (
    3 YEAR NUMBER(4,0),
    4 MONTH NUMBER(2,0),
    83 MUSTHAVE CHAR(1)
    84 );
    I'd like to call the stored procedure enque_f826_utility_q in a loop passing to it
    each time, new values in the inpayload parameter.
    My questions are:
    First, I'm not sure in php, how to construct the first parameter which is a database type.
    Can I just make an associative array variable with the keys of the array the same as the columns of the database type shown above and then pass that array to the stored procedure?
    Second, is it possible to parse a statement that calls the enque_f826_utility_q procedure using bind variables and then execute the call to the stored procedure in a loop passing new bind variables each time?
    I've tried something like the following but it's not working:
    $conn = oci_pconnect (....);
    $stmt = "select * from f826_utility";
    $stid = oci_parse($conn, $sqlstmt);
    $r = oci_execute($stid, OCI_DEFAULT);
    $row = array();
    $msgid = "";
    $enqstmt = "call enque_f826_utility_q(:RID,:MID)";
    $enqstid = oci_parse($conn, $sqlstmt);
    oci_bind_by_name($enqstid, ":RID", $row); /* line 57 */
    oci_bind_by_name($enqstid, ":MID", $msgid);
    while ($row = oci_fetch_array($stid, OCI_RETURN_NULLS+OCI_ASSOC))
    ++$rowcnt;
    if (! oci_execute($enqstid)) /* line 65 */
    echo "Error";
    exit;
    When I run this, I get the following:
    PHP Notice: Array to string conversion in C:\Temp\enqueue_f826_utility.php on l
    ine 57
    Entering loop to process records from F826_UTIITY table
    PHP Notice: Array to string conversion in C:\Temp\enqueue_f826_utility.php on l
    ine 65
    PHP Warning: oci_execute(): ORA-06553: PLS-306: wrong number or types of argume
    nts in call to 'ENQUE_F826_UTILITY_Q' in C:\Temp\enqueue_f826_utility.php on lin
    e 65
    PHP Notice: Undefined variable: msgnum in C:\Temp\enqueue_f826_utility.php on l
    ine 68
    Error during oci_execute of statement select * from F826_UTILITY
    Exiting!

    Thanks for the reply.
    I took a look at this article. What it appears to describe is
    a calling a stored procedure that takes a collection type which is an array.
    Does anyone from Oracle know if I can pass other database type definitions to a stored procedure from PHP?
    I have a type defined in my database similar to the following which is not
    an array but a record of various fields. This type corresponds to a payload
    of an advanced queue payload type. I have a stored procedure which will take as it's input, a payload type of this structure and then enqueue it to a queue.
    So I want to be able to pass a database type similar to the following type definition from within PHP. Can anyone from Oracle verify whether or not this is possible?
    create or replace type f826_utility_payload as object
    YEAR NUMBER(4,0),
    MONTH NUMBER(2,0),
    UTILITY_ID NUMBER(10,0),
    SUBMIT_FAIL_BY VARCHAR2(30),
    MUSTHAVE CHAR(1)
    );

  • Problem in Varray as parameter to procedure

    Hi All,
    I have created a type AS
    CREATE OR REPLACE TYPE v_tmp_array IS VARRAY(100) OF NUMBER;I am passing array as parameter to oracle procedure from java front end . how to pass whole array in SQL where condition Is it possible to archive it?
    CREATE OR REPLACE PROCEDURE Proc_Varry_Para(p_array IN v_tmp_array, v_tmp OUT  REF CURSOR)
    AS
        BEGIN
    BMS_OUTPUT.PUT_LINE( 'begin' );
    SELECT * FROM ADDRESS WHERE ADDR_ID = p_array; --- need to pass whole array value  in where condition.
    OPEN v_tmp FOR v_sql_text;
        END;
    /Thanks & Regards
    Sami

    SELECT *
      FROM ADDRESS, TABLE (p_array) t
    WHERE ADDR_ID = t.COLUMN_VALUE;

  • Passing multidimensional array to plsql procedure

    hi ,
    is there any way to pass a two dimensional array of different data types to plsql procedure as a parameter?
    In other words, is it possible to pass a set or records or a datatable as a single parameter to plsql procedure?
    Because I am using a dataset selected with odp.net in my client and I am modifying the data in different datatables contained in the dataset.At the moment, the modified datatables are saved by seperating each column as a sepearate array and passing each column array as a seperate parameter to a stored procedure. But, I would like to change it in a way to pass each datatable as a single parameter to the stored procedure.
    I would appreciate any solution/suggestion/hint in regard to this problem
    thanks in advance,
    Prabhakar.

    If your Java array is of a base type (String, int, etc.) and you are using the OCI driver, you can use OracleCallableStatement.setPlSqlTable(). (I'm doing this from memory so the method name may be slightly different.)
    The method takes a Java array and converts it to a PL/SQL table before passing it to the stored procedure.

  • Get first entry of a table (return parameter of procedure)

    Hello Community,
    I created a procedure with a couple of projections and one join.
    The procedure returns the result as a parameter (o_result).
    In the calling procedure, I get the result.
    But I need to do further processing based on the first row of the result.
    Is this possible with SAP Hana SQL Script?
    Many thanks in advance.
    Regards, Rolf

    Hi Rolf,
    Your question is not very clear. May be you explain what you want to achieve after getting first entry of table.
    In your calling procedure you would make a call and bind the output table like this
    call proc1 ( :input_param, output_tab);
    On the returing output_tab you could just write something like
    output_top1 = select top 1 * from :output_tab;
    You could use this table for whatever processing you want to do further.
    If you want to get values into some scalar variables that is also possible.
    e.g
    declare lv_column1 nvarchar(10);
    select column1 into lv_column1 from :output_top1;
    Thanks
    Sagar

  • How to append input array parameter to a conditon in where clause

    CREATE OR REPLACE PROCEDURE file_upload(p_array_code IN DIAG_CODE,p_desc_code IN DIAG_CODE_DESC,p_code_result OUT DIAG_CODE_TABLE) IS
    v_count NUMBER;
    v_range1 VARCHAR2(8);
    v_range2 VARCHAR2(8);
    l_count pls_integer := 0;
    l_diag_code_table1 DIAG_CODE_TABLE;
    l_diag_code_table2 DIAG_CODE_TABLE;
    l_loop_diag_code_table1 DIAG_CODE_TABLE;
    l_loop_diag_code_table2 DIAG_CODE_TABLE;
    BEGIN
    l_loop_diag_code_table1 := diag_code_table();
    l_loop_diag_code_table2 := diag_code_table();
    FOR i IN 1..p_array_code.count
    LOOP
    SELECT diag_code_rec(d.icd9_pcs_text_href,
    d.icd9_procedure_deci_code,
    d.icd9_procedure_long_desc,
    d.icd9_pcs_gem_flag_desc,
    g.gem_icd9_icd10pcs_flag,
    dc.icd10_procedure_code,
    dc.icd10_procedure_long_desc)
    BULK COLLECT INTO l_diag_code_table2
    FROM icd9_procedure_codes d,
    icd10_procedure_codes dc ,
    gem_icd9_icd10pcs g
    WHERE d.icd9_procedure_code=g.gem_icd9_pcs_code
    AND g.gem_icd10_pcs_code=dc.icd10_procedure_code(+)
    AND d.ICD9_PROCEDURE_code like p_array_code(i)||'%' ;
    FOR j IN 1..l_diag_code_table1.count
    LOOP
    l_loop_diag_code_table1.extend;
    l_loop_diag_code_table1 (l_loop_diag_code_table1.last):= l_diag_code_table1(j) ;
    END LOOP;
    END LOOP;
    p_code_result := l_loop_diag_code_table1 ;
    END;
    DIAG_CODE_DESC is declared as type
    create or replace type DIAG_CODE_DESC as table of varchar2(300);
    p_desc_code contains array of keywords
    I need to add one more condition to the above select query using the p_desc_code as
    (regexp_like(S.ICD9_PROCEDURE_LONG_DESC, '(p_desc_code (1)') AND regexp_like(S.ICD9_PROCEDURE_LONG_DESC, '(p_desc_code (2))' and ... upto inpu array limit.
    Could anyone help me through in writing the above the sql with the additional condition?
    I would really appreciate the help.
    Thanks,
    in advance

    Below are the requirements:
    A file will be uploaded from front end .
    Data from the file will be sent as arrays from java code:
    Two types of data
    1. values from file
    2. array of string values
    data format from file
    1.Sample data
    1000
    2000
    3000
    4000
    array of strings upto 5 strings limiy
    2.'abc','def',..upto 5
    Both the input values are varchar.
    create table ICD9_PROCEDURE_CODES(
    ICD9_Procedure_Code          Varchar2(6)     Primary Key,
    ICD9_Procedure_Deci_Code     Varchar2(7),     
    ICD9_Procedure_Long_Desc     Varchar2(300),     
    ICD9_Procedure_Short_Desc     Varchar2(100),     
    ICD9_PCS_Gem_Flag_Desc          Varchar2(500),     
    ICD9_Version               Varchar2(10));     
    insert into icd9_procedure_code(ICD9_PROCEDURE_CODE , ICD9_PROCEDURE_DECI_CODE,
    ICD9_PCS_TEXT_HREF, ICD9_PCS_GEM_FLAG_DESC)
    values(0441 ,04.41 ,Decompression trigem ,Scenaroio0 ,Scenario0:text_href)
    insert into icd9_procedure_code(ICD9_PROCEDURE_CODE , ICD9_PROCEDURE_DECI_CODE,
    ICD9_PCS_TEXT_HREF, ICD9_PCS_GEM_FLAG_DESC)
    0442, 04.42 ,Other carnial Cran ,Scenario1 ,Scenario1: text_href)
    create table ICD10_PROCEDURE_CODES(
    ICD10_PCS_Order_Num               Varchar2(7),     
    ICD10_Procedure_Code               Varchar2(8)     Primary Key,
    ICD10_Procedure_Decimal_Code          Varchar2(9),     
    ICD10_PCS_Code_Header               Number(1),     
    ICD10_Procedure_Short_Desc     Varchar2(60),
    ICD10_Procedure_Long_Desc     Varchar2(300),     
    ICD10_PCS_Gem_Flag_Description          Varchar2(500),     
    Version               Varchar2(10),
    insert into icd10_procedure_codes
    ( ICD10_PROCEDURE_CODE, ICD10_PROCEDURE_LONG_DESC, ICD10_PCS_TEXT_HREF, ICD10_PCS_GEM_FLAG_DESCRIPTION)
    values
    (00NK0ZZ,00N.K0ZZ, Release Nerve, Scenario0, Scenario0:text_href
    00NK3ZZ, 00N.K3ZZ,Diabetes Neuropathy, Scenario11, Scenario11: text_href
    00NK4ZZ, 00NK.4ZZ,Nerve disorder, Scenario12 ,Scenario12: text_href
    create table GEM_ICD9_ICD10PCS(
    GEM_ICD9_PCS_Code          Varchar2(6),
    GEM_ICD10_PCS_Code          Varchar2(8),     
    GEM_ICD9_ICD10PCS_Flag          Number(5),     
    GEM_Version          Varchar2(10),
    constaraint GEM_ICD9_ICD10PCS_PK PRIMARY KEY (GEM_ICD9_PCS_Code,GEM_ICD10_PCS_Code,GEM_ICD9_ICD10PCS_Flag))
    insert into gem_icd9_icd10pcs (GEM_ICD9_PCS_Code,GEM_ICD10_PCS_Code,GEM_Version)
    values
    ('0441','00NK0ZZ','10000');
    ('0441','00NK3ZZ','10000');
    ('0441','00NK4ZZ','10000');
    Thanks for looking into this thread

  • Using Parameterized Arrays in Stored Procedure

    I tried following code to pass array value to stored procedure but its giving error, as I am new to this procedure, please advise what am I missing ?
    Best Regards,
    Luqman
    My code is as below.
    CREATE TYPE num_array AS table of number;
    create or replace procedure give_me_an_array
    ( p_array in num_array )
    as
    begin
    for i in 1 .. p_array.count
    loop
    dbms_output.put_line( p_array(i) );
    end loop;
    end give_me_an_array;
    declare
    mdata num_array;
    begin
    mdata(1) := 1234;
    mdata(2) := 10;
    give_me_an_array(mdata);
    end;

    Hi Satya,
    Now I got it, thanks,
    Can you please advise, if I use the same stored procedure for EMP Table and use my array values to retrieve the selected EMPNo
    I tried following but I could not succeed.
    When I compile the stored procedure, error occurs:
    "inconsistent datatypes: expected NUMBER got NUM_ARRAY"
    for example:
    CREATE TYPE NUM_ARRAY AS TABLE OF NUMBER;
    Create or Replace Package TB_Data
    Is Type CV_Type Is REF CURSOR;
    END TB_DATA;
    Create or Replace Stored Procedure give_me_an_array
    (CV IN OUT TB_DATA.CV_TYPE,
    MEmpNo In Num_Array)
    Is
    Begin
    Open CV for
    Select * from EMP
    Where Empno in MEmpNo;
    End myProc;
    declare
    mdata num_array:=num_array(7839,7844);
    begin
    give_me_an_array(mdata);
    end;
    Best Regards,
    Luqman

Maybe you are looking for

  • Contract account not found and replicated to ISU

    Hi Experts, Our users created s3 contract account in the Production system. But upon searching for 2 of them they are not able to find these two contract accounts in CRM as well on ISU side.I have also checked the queues and Bdocs if any one of them

  • IE 8 Thin App package in not working on system with IE 10 installed

    We have published IE8 thin app package for our users. But today I noticed that after upgrading IE browser to version 10 it is not working. when we launch the application on system with IE 8 than it is working fine. It crashes on systems with IE10. An

  • HELP: Files and Applications are being deleted of my mac

    Hi guys, So yesterday I was listening to music in iTunes and suddenly all thee songs, bar 17, had an exclamation mark next to them. I went to folder to locate them and every single file had gone. The folders were there but no .mp3. Then a whole load

  • Issue with Bluetooth

    Hello, I try to connect a speaker in bluetooth. My phone find the device, on Devices list I have only one item: "OVC3860" paired. When I click on this device, a message appears: "Only one audio device can be connected at a time". But in Devices list

  • 3.6 would re-open prior tabs after hard shut-down - How can I get 4.0 to remember them?

    I installed 4.0 hoping that it would not freeze anymore as 3.6 often did. However, 4.0 freezes too. But that's not my problem. Instead: How can I get 4.0 to remember the tabs that were open when I close Firefox in Windows Task Manager? - like 3.6 was