Several values of parameter of a procedure

Hi all
Here, I need to create a procedure and this procedure has a parameter for this setting, I need to pass multiple values separated by a ',' (comma)


Any help... Thanks in advance

Hello

Welcome to the forum!

See
http://www.Oracle-base.com/articles/Misc/DynamicInLists.php
http://tkyte.blogspot.com/2006/06/varying-in-lists.html

Tags: Database

Similar Questions

  • Spend multiple values with parameter of stored procedure

    CREATE TABLE VTEST_INSERT)

    NUMBER OF MY_ID,

    COLUMN1 VARCHAR2 (50)

    );

    -SELECT * FROM VTEST_INSERT;

    INSERT INTO VTEST_INSERT (MY_ID, COLUMN1) VALUES (1, 'TEST1');

    INSERT INTO VTEST_INSERT (MY_ID, COLUMN1) VALUES (2, "TEST2");

    INSERT INTO VTEST_INSERT (MY_ID, COLUMN1) VALUES (3, "TEST3");

    INSERT INTO VTEST_INSERT (MY_ID, COLUMN1) VALUES (4, "TEST4");

    INSERT INTO VTEST_INSERT (MY_ID, COLUMN1) VALUES (5, 'TEST5');

    INSERT INTO VTEST_INSERT (MY_ID, COLUMN1) VALUES (1, "TEST6");

    INSERT INTO VTEST_INSERT (MY_ID, COLUMN1) VALUES (2, 'TEST7');

    INSERT INTO VTEST_INSERT (MY_ID, COLUMN1) VALUES (3, "TEST8");

    INSERT INTO VTEST_INSERT (MY_ID, COLUMN1) VALUES (4, 'TEST9');

    INSERT INTO VTEST_INSERT (MY_ID, COLUMN1) VALUES (5, "TEST10");

    CREATE OR REPLACE

    PROCEDURE VTEST_INSERT_SP (vid in VARCHAR2, vname IN VARCHAR2)

    AS

    BEGIN

    DELETE FROM VTEST_INSERT WHERE MY_ID IN (vid);

    INSERT INTO VTEST_INSERT (MY_ID, COLUMN1) VALUES (vid, vname);

    END;

    /

    EXEC VTEST_INSERT_SP(1,'TEST999');

    This set works well above. But I want to be able to pass multiple values VNAME. so, something like:

    EXEC VTEST_INSERT_SP(1,'TEST999','TEST888','TEST777');

    any help is appreciated. Thank you.

    This would make many inserts each with the same vid and values of different VNAME.

    Try something like this

    1. SET SQLBLANKLINES
    2. ALTER SESSION SET PLSQL_WARNINGS = ' ENABLE: ALL ';
    3. DROP TABLE vtest_insert;
    4. CREATE TABLE vtest_insert (vid NUMBER, vname VARCHAR2 (20));
    5. INSERT ALL
    6. IN vtest_insert (vid, vname) VALUES (1, "yyyy")
    7. IN vtest_insert (vid, vname) VALUES (1, "bb")
    8. IN vtest_insert (vid, vname) VALUES (1, "cccccc")
    9. IN vtest_insert (vid, vname) VALUES (2, "ddd")
    10. IN vtest_insert (vid, vname) VALUES (2, 'ee')
    11. SELECT * FROM .dual 'PUBLIC '.
    12. SELECT * FROM vtest_insert;
    13. CREATE or REPLACE TYPE vnames_tab_ty IS TABLE OF VARCHAR2 (20)
    14. /
    15. DISPLAY ERRORS;
    16. CREATE OR REPLACE PROCEDURE vtest_insert_sp
    17. (
    18. p_vid IN vtest_insert.vid%TYPE,
    19. p_vnames IN vnames_tab_ty
    20. )
    21. DEFINE AUTHID
    22. IS
    23. BEGIN
    24. DELETE FROM vtest_insert WHERE the vid = p_vid;
    25. FORALL idx IN p_vnames. FIRST... p_vnames. LAST
    26. INSERT INTO vtest_insert (vid, vname) VALUES (p_vid, p_vnames (idx));
    27. END vtest_insert_sp;
    28. /
    29. DISPLAY ERRORS;
    30. >
    31. DECLARE
    32. Vnam vnames_tab_ty;
    33. vid vtest_insert.vid%TYPE.
    34. BEGIN
    35. BK.vid: = 1;
    36. BK.vnames: is vnames_tab_ty ('vn-01', 'vn-02', 'vn-03');.
    37. vtest_insert_sp (p_vid-online bk.vid, p_vnames-online bk.vnames).
    38. COMMIT;
    39. BK.vid: = 2;
    40. BK.vnames: is vnames_tab_ty ('vn-04', 'vn-05', 'vn-06', 'vn-07');.
    41. vtest_insert_sp (p_vid-online bk.vid, p_vnames-online bk.vnames).
    42. COMMIT;
    43. END;
    44. /
    45. SELECT * FROM vtest_insert;

    Which produces the following output

    Table created.

    5 rows created.

    VNAME VID

    ---------- --------------------

    1-aaaa

    1 bb

    1 cccccc

    2 ddd

    2 EA

    Type of creation.

    No errors.

    Created procedure.

    No errors.

    PL/SQL procedure successfully completed.

    VNAME VID

    ---------- --------------------

    1 VL-01

    1 VL-02

    1 VL-03

    2 vn-04

    2 vn-05

    2 vn-06

    2 vn-07

    7 selected lines.

    SQL >

    Kind regards

    Dariyoosh

  • pass values of parameter to the procedure stored in the URL, possible?

    Hi, everyone, our system is Apex4.0.2 in Linux CentOS 5 on Oracle 11 g 2, here is the procedure:

    create or replace procedure test_public (Cust_id integer)
    is

    Start
    owa_util.mime_header ("text/xml", FALSE);
    owa_util.mime_header ("application/octet", FALSE);
    -Close the HTTP header
    owa_util.http_header_close;

    HTP.p (DBMS_XMLGEN.getXML ("SELECT * FROM demo_orders where customer_id ='|")) cust_ID));
    end;

    +/+

    the call to the stored procedure is SUCCESSFUL when Test_public has no parameters, as:
    http://myserver/Apex/myschema.test_public (OK)
    the question is: I want to spend the 3 settings in my stored procedure (on production procedure), do not know how?

    Any suggestions are greatly appreciated

    create or replace procedure test_public (param1, param2 IN VARCHAR2, param3 in NUMBER IN number)

    http://myserver/apex/myschema.test_public?param1=¶m2=¶m3=
    
  • How to assign values to the nested table and passes as a parameter for the procedure?

    How to assign values to the nested table and passes as a parameter for the procedure?

    Here are the object and its type

    create or replace type test_object1 as an object
    (
    val1 varchar2 (50).
    val2 varchar2 (50).
    VARCHAR2 (50) val3
    );


    create or replace type test_type1 is table of the test_object1;


    create or replace type test_object2 as an object
    (
    val1 varchar2 (50).
    val2 varchar2 (50).
    VARCHAR2 (50) val3
    );


    create or replace type test_type2 is table of the 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 object type:

    create the 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 earlier2;


    -----------------------------------------------------------------------------------------------------------

    Here is the procedure that inserts values into the 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 .val1 (CRE),
    p_main_val1 .val2 (CRE),
    p_main_val1 .val3 (rec)
    )
    )
    test_type2 (test_object2 (p_main_val2 .val1 (CRE),
    p_main_val2 .val2 (CRE),
    p_main_val2 .val3 (rec)
    )
    )

    );

    END LOOP;

    commit;

    END INSERT_TEST_DATA;

    -------------------------------------------------------------------------------------------

    Here are the block anonymoys what values attributed to the object type and pass values in the procedure:

    Set serveroutput on;

    declare

    p_sl_num NUMBER: = 1001;
    p_description VARCHAR2 (50): = 'Test Val1;

    inval1 test_type1: = test_type1();
    inval2 test_type2: = test_type2();

    Start


    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;
    /
    Someone can correct me.

    Thank you
    Lavan

    Thanks for posting the DOF and the sample code but whenever you post provide your Oracle version 4-digit (result of SELECT * FROM V$ VERSION).
    >
    How to assign values to the nested table and passes as a parameter for the procedure?
    >
    Well you do almost everything bad that could be hurt.

    Here is the code that works to insert data into your table (the procedure is not even necessary).

    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 making reference to an element of nested Table Chapter 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 have the procedure because it is a simple INSERTION in the table you can do directly (see my above code)

    inval1(1).val1 := 'testx1';
    

    Since you have not yet created all the elements, there is no element 1 "inval1". You need 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 as "val1", "val2", and "val3".
    If you can not do

    inval1(1).val1 := 'testx1';
    

    You must 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 code example shows), but once you fill in the variables correctly it will work.

  • Pass a parameter to a procedure of inserting the order...?

    Hi all

    I have a requirement where I need to pass the input parameter of the procedure for the insert inside the procedure command...

    My procedure continues like that...

    PROCEDURE pmproc_1)

    A IN VARCHAR2,

    B IN VARCHAR2,

    C IN VARCHAR2

    )

    AS

    BEGIN

    INSERT INTO my_table

    (number , activity, fact )

    SELECT the number , activity, fact

    Of abcd_actv_tbl

    Activity WHERE =

    AND > = B

    AND number = C;

    COMMIT;

    NULL;

    END pmproc_1;

    My requirement is that I need to pass the input parameter C to a column in my table which is my_table

    so that it becomes...

    INSERT INTO my_table (number , activity, , (HERE I NEED to GET THE VALUE of 'C' ) )

    SELECT the number , activity, fact

    Of abcd_actv_tbl

    Activity WHERE =

    AND > = B

    AND number = C;

    Please let me know if I'm unclear...

    Thanks in advance...

    DEV

    Based on what you have provided, I would say that something as simple as:

    INSERT INTO my_table (number activity ,c_column )

    SELECT the number is, c

           Of abcd_actv_tbl

    Activity WHERE =

    AND > = B

    AND number = C;

  • the size of the out parameter in the procedure

    Hi all:

    I have a procedure in a pl/sql package like this:
    create or replace procedure MyProc (PRM_STR in VHARCHAR2, PRM_OUTSTR OUT VARCHAR2) is
    V_TEST VARCHAR2 (100)
    Start
    +...+
    V_STR: = SUBSTR (PRM_STR, 22, 31);
    V_TEST: = TRIM (V_STR);
    PRM_OUTSTR: = V_TEST;
    EXCEPTION
    WHILE OTHERS THEN
    +....+
    myproc end;

    When I run it, it always gives me an exception: ORA-06502: PL/SQL: digital or value error: character string buffer too small.
    Then I debug him:
    V_TEST: = TRIM (V_STR)
    is OK.
    While PRM_OUTSTR: = V_TEST, it throws this exception.

    I was confused, the out parameter in the procedure has a size? How can I set it?

    Please help me!
    Thank you very much!

    You must declare the size of the variable you use in the call to the procedure to be big enough.

    The output parameter itself may not be declared with a size:

    for example

    Your appeal should be something like the following:

    declare
    v_prmstr varchar2(4000)  :=  'Your input value';
    v_prmoutstr varchar2(4000);
    begin
    myproc(v_prmstr,v_prmoutstr) ;
    end;
    

    v_prmoutstr must be reported to be large enough to contain the value returned by the parameter
    PRM_OUTSTR

    added example variable
    Published by: Keith Jamieson on August 11, 2011 13:32

  • What is INSIDE and OUTSIDE in parameter of the procedure?

    Hello
    often IN, OUT and IN OUT are used with the parameter in the procedures and functions.
    This means pass by value, by reference, we did in programming c / c++?

    When you create a procedure or function, you can set parameters. There are three types of parameters that may be declared:

    1. - the parameter can be referenced by the procedure or function. The value of the parameter can not be overwritten by the procedure or function.
    2 - the parameter may not be referenced by the procedure or function, but the value of the parameter can be replaced by the procedure or function.
    3 AL '-the parameter can be referenced by the procedure or function and the value of the parameter can be replaced by the procedure or function.

  • How can I select several values for popup LOV

    Hello
    I need to select several values for popup lov. Is it possible to select several values from popup lov


    Concerning
    Veronica B

    Check your page now, added a javascript in shared components file > images and a css in the components share > cascading style sheets

    I used the plugin below
    http://www.erichynds.com/jQuery/jQuery-UI-MultiSelect-Widget/

  • procedure call with sys_refcursor as a parameter in the procedure

    Hello
    I tried the following procedure after sys_refcursor as parameter of a procedure,
    And confused about the procedure call
    CREATE OR REPLACE PROCEDURE test_ref (emp_cur IN sys_refcursor) IS
    emp_rec Z_emp%ROWTYPE;
    BEGIN
    LOOP
    FETCH emp_cur INTO emp_rec;
    EXIT WHEN emp_cur%NOTFOUND;
    dbms_output.put_line(emp_rec.ename ||' is a ' || emp_rec.job);
    END LOOP;
    END;
    How can I call the above procedure to get the data

    Thank you

    You must declare a variable sys_refcursor and open it with the necessary query and then pass that variable as a parameter to your procedure.

    Something like that.

    set serveroutput on
    
    declare
      my_cursor sys_refcursor;
    begin
      open my_cursor for select * from employee;
      test_ref (my_cursor);
    end;
    /
    
  • Sql statement variable gives several values

    Hello

    I have a variable that has sql statement and it gives several values and I want to use this variable in one of the filter of interface condition to filter the data in the source table (which has millions of records).

    some could let me know the best method to achieve this scenario.

    Appreciate your help.

    You are right. Yesterday, I don't think in this case where the data could be from a different server. But I completely forgot today.
    Ok. Here you can find how to use sys_connect_by_path

    http://asktom.Oracle.com/pls/asktom/f?p=100:11:0:P11_QUESTION_ID:907278700346567560

    Be careful with the size because I think that there is a limit to what can contain the variable ODI.

    After you have assessed the variable is how it could be used in the filter

    ITEM_TYPE_ID IN (#var_csv_id_list)

  • How the parameter of the procedure with the default table type?

    Hello!

    How the parameter of the procedure with the default table type?
    For example:
    type varchar2lType is table of varchar2(50) index by binary_integer;
    create or replace procedure test1
       (
        s1  varchar2(50)
        sa2 Varchar2Type
       )
    as
    begin
       dbms_output.put_line('yyxxyyy!');
    end;
    /
    Published by: bullbil on 16.01.2012 06:35

    If he should really be an associative array for some reason any (can't think why, but just for fun...) you could declare a dummy array in the packet header and specify as the default:

    create or replace package wr_test
    as
       type varchar2ltype is table of varchar2(50) index by pls_integer;
       g_dflt_varchar2l_tab varchar2ltype;
    
       procedure testit
          ( p_testarray varchar2ltype default g_dflt_varchar2l_tab );
    end wr_test;
    
    create or replace package body wr_test
    as
       procedure testit
          ( p_testarray varchar2ltype default g_dflt_varchar2l_tab )
       is
       begin
          dbms_output.put_line('p_testarray contains ' || p_testarray.count || ' elements');
       end testit;
    
    end wr_test;
    

    It is a bit of a hack, because it relies on a global variable that is exposed. A more orderly approach would overload the procedure so that a version does not have the table and another argument:

    create or replace package wr_test
    as
       type varchar2ltype is table of varchar2(50) index by pls_integer;
    
       procedure testit;
    
       procedure testit
          ( p_testarray varchar2ltype );
    
    end wr_test;
    
    create or replace package body wr_test
    as
    
       procedure testit
       is
          v_default_array varchar2ltype;
       begin
          testit(v_default_array);
       end testit;
    
       procedure testit
          ( p_testarray varchar2ltype )
       is
       begin
          dbms_output.put_line('p_testarray contains ' || p_testarray.count || ' elements');
       end testit;
    
    end wr_test;
    
  • Passing selection several values in a query

    I have a statement select mulit combines all the values selected by a: (item1:item2:item3) and so forth, to present that entry is passed to a query for results.

    I need to pass this value to a query using 'where X (value mutliselect) '.

    This will format the string correctly
    Select "' | Replace (: p1_port, ':', "'|) ',' ||'' ') ||'' ' the double

    and create output like > "ABU DHABI", "ANCHORAGE."

    If I take it out and run it in this query, I get results:

    SELECT distinct container_number,
    Description,
    container_seal,
    date_of_arrival
    OF apps.xahg_app_package_detail_v
    Destination WHERE ("ABU DHABI", "ANCHORAGE")

    But if I try to combine the 2 as this query:

    SELECT distinct container_number,
    Description,
    container_seal,
    date_of_arrival
    OF apps.xahg_app_package_detail_v
    WHERE IN destination (select "': replace (: p1_port, ':',"'|)) ',' ||'' ') ||'' (' double)

    or even this one:

    SELECT distinct container_number,
    Description,
    container_seal,
    date_of_arrival
    OF apps.xahg_app_package_detail_v
    WHERE IN destination ("': replace (: p1_port, ':',"'|)) ',' ||'' ') ||'' ')

    I will return no results... or a mistake by the way, I'm totally stumped here seems to be a fairly simple thing to make it work? It makes no sense, why would one hard-coded return values but parameter entries will not be... don't forget the hardcoded used n-cut-paste the results of the ' select "' | Replace (: p1_port, ':', "'|) ',' ||'' ') ||'' 'of the double' sample.

    is there something that I am missing?

    Thanks in advance,
    Jeremy

    Try this

    SELECT distinct container_number,
    Description,
    container_seal,
    date_of_arrival
    OF apps.xahg_app_package_detail_v
    WHERE INSTR (': ' |: p1_port |': ',' :'|| destination: ': ') > 0
    ;

    Just to clarify.

    ' :'|| : p1_port |': ' make sure your string is delimited by hyphens.

    ':'|| destination: ': ' make sure your string is delimited by hyphens.

    If your destination is the string INSTR will return a positive value, 0 otherwise. I also assumed that nothingness: P1_port or destination may include the ":" character.

  • Combine several values of rank in a line like comma delimeted string

    Hello

    I have a requirement to combine several values of rank in a line as the comma delimeted string as below

    INDEX_NAME COLUMN_NAME POSITION_COLONNE
    EMP_EMAIL_UK EMAIL 1
    EMP_EMP_ID_PK EMPLOYE_ID 1
    EMP_DEPARTMENT_IX DEPARTMENT_ID 1
    JOB_ID EMP_JOB_IX 1
    EMP_MANAGER_IX MANAGER_ID 1
    EMP_NAME_IX LAST_NAME 1
    EMP_NAME_IX FIRST_NAME 2
    I write in a SQL and the output I need is, for example EMP_NAME_IX LAST_NAME, FIRST_NAME.

    I can't write any function as well.

    http://www.Oracle-base.com/articles/Misc/StringAggregationTechniques.php

    SELECT index_name,
           ltrim(sys_Connect_by_path(column_name, ','), ',') column_names
      FROM (select index_name,
                   column_name,
                   row_number() over(partition by index_name order by column_position) rn
              from all_ind_columns
             WHERE table_owner = 'HR')
     WHERE connect_by_isleaf = 1
     START WITH rn = 1
    CONNECT BY PRIOR rn = rn - 1
           and prior index_name = index_name
    
  • Timestamp in passing as a parameter in a procedure

    Hi all
    I want to pass the timestamp as a parameter to a procedure... When I try to run it and to give time as parameters, it is throwing error date format picture ends before converting the entire input string... I'm not able to spend sysdate and systimestamp.


    Start

    Package.PROC_1 (sysdate, sysdate);

    end;

    for example:

    create or replace proc_1 (T_DATE timestamp, v_date2 timestamp) as

    Start

    Select * from emp where to_date(emp_date,'dd-mon-yyyy') between to_date(v_date,'dd-mon-yyyy') and to_Date (v_date2, 'dd-mon-yyyy');

    end proc_1;


    Here emp_date is timestamp.

    Hello

    You don't need to convert it to to_date as all data you transmit and comparing the column are of the same type (timestamp). So you can just put your condition
    emp_date between T_DATE and v_date2

    see you soon

    VT

  • Assiging the values of parameter in CASE

    Hi all
    I'm writing the Expression BOX in the following way.

    CASE WHEN entered. Field1 < = Input.Field2 then
    Input.Field1 = Input.Filed2
    ON THE OTHER
    Input.Field2
    END

    During the validation of Expression it throws the error. Could you tell me please me is possible to write the expression to assign values of parameter input/output field.
    If so, please explain. If this isn't the case, suggest me work around.
    Thank you very much
    See you soon!
    -MAK

    He likes to change...

    CASE WHEN input.Field1 <= Input.Field2 then
    Input.Field1
    ELSE
    Input.Field2
    END
    

    If you created this in the output of expression variable say 'out_1' and then
    so if the entry. Field1<= input.field2="" then="" value="" of="" out_1="" will="" be="" input.field1="" else="">

    See you soon
    Katia

Maybe you are looking for

  • Missing dependencies in Modbus vi

    I try to use the modbus_cfp - 180x_do.vi and modbus_cfp - 180x_di.vi on the site, but they are unable to find Error Handler.vi, \NI Modbus.lib\MB Command.ctl Modbus and Ethernet Master Query.vi \NI Modbus.lib\MB \PDA\PDA.  I am very new to this and h

  • Microsoft Education

    Hello I would like to know how I should do to be contact by a person responsible for Microsoft Education for schools I'm responsible? Area of Liège - Belgium. Foremost on the classical Office products - Sharepoint - Outlook. Thank you for your respon

  • Aspire 6930 recovery

    I had to change the hard drive on my Aspire 6930 running Vista. I installed a WD 320 GB drive in place of the original 250 GB drive. Using 3 recovery disks that I made when the computer is new, everything seemed to install ok. However, when the compu

  • BlackBerry Bond serious problems with the GPS on BB jump with OS 10.3.1

    Hello I have 3 problems with my BB jump; for 1 of it, I write here a solution. When I get on the maps of BB (installed by default) with location and a Wi - Fi enabled connection, my position still show that I'm somewhere in Basel (Switzerland), even

  • All of a sudden, I can't open a PNG file in layers.  I get a message file could not be found. Help!

    I work with multilayer files in photophop CS6 creating composite photograph.  All of a sudden, I can't open the PNG files.  I get a message that the file cannot be found when I try to open it.  Can someone help me please?