How to accept the array as a parameter of stored procedure

Hi, this is the scenario

the java team send me a table of numbers as an input for my procedure.

the size of the array can be dynamic... I do not know the size

what I have to do is

I have to write a procedure that must accept this table as parameter
crosses of the first element of the array too the end of the array to each value in the table

and get on a table for this value and remove this line in the table

How can I do?

Please suggest

concerning
REDA

Published by: raj_fresher on May 7, 2009 11:42

Raj,

Here is the code

--This is you will create
create or replace type TYP_PHONES as table of Varchar2(15) ;
/
--- This will be your procedure
create or replace
procedure give_me_an_array1( p_array in TYP_PHONES )
as
begin
-- Do whatever you want to with the data you get
for i in 1 .. p_array.count
loop
dbms_output.put_line( p_array(i) );
end loop;
end;
/

Tell your guy java to define this table as below

String[] intArray= {"john","miller","scott"};
ArrayDescriptor descriptor =ArrayDescriptor.createDescriptor( "TYP_PHONES", conn );
ARRAY array_to_pass = new ARRAY( descriptor, conn, intArray );

* [Full active code | http://db-oracl.blogspot.com/2009/05/passing-arrays-from-java.html] *.

SS

Tags: Database

Similar Questions

  • How to get the list of parameters of a stored procedure in Oracle?

    I'm calling an Oracle stored procedure and use the OCIBindByPos for each parameter.
    Example:
    /* Do the bind for date, using OCIIOV */
    OCIBindByPos (stmthp, &bindhp2, errhp, 2, (void *)&bvec[0], 
                  sizeof(buf_1[0]), SQLT_STR, 
                  (void *)inddate, (ub2 *)alendate, (ub2 *)rcodedate, 0,
                  (ub4 *)0,  OCI_IOV);
    In this case, its necessary for a list of the parameters of the stored procedure, information such as type and the input/output parameter, etc.

    I can get the parameters of a stored procedure using the DESCRIBE statement.
    Example:
    SQL> DESCRIBE SP_GETCITIES
    PROCEDURE SP_GETCITIES
     Argument Name                  Type          In/Out Default?
     ---------------------- --------------------- ------ --------
     STATE_KEY              VARCHAR2               IN
     FECHA                  DATE                   IN
     RC1                    REF CURSOR             OUT
    
    SQL>
    Is there a better way to get the name, type, input/output for each parameter of an Oracle stored procedure, using the BEAK?

    Best regards.

    Antonio García (Mexico)

    Hi Antonio,.

    Take a look at "Describing metadata schema" in the programmer's Guide. He has this kind of information, which may be enough to get you going in the right direction. The guide is here:

    http://download.Oracle.com/docs/CD/E11882_01/AppDev.112/e10646/oci06des.htm#i446492

    In particular, see the code example in the section "describing the stored procedure.

    Kind regards

    Mark

  • How to accept the invitation to Skype manager?

    Hi, anyone here who can help me how to accept the invitation to Skype manager?

    Please help me?

  • How to generate the array Diagnostic Utility ADU for Esxi server

    How to run Diagnostic Utility ADU or HP Insight Diagnostics HP Insight Diagnostics table to collect the status tables and logs data FRO an Esxi Server

    How to generate the array Diagnostic Utility ADU for Esxi server

    Example:

    Download the package .vib here: http://vibsdepot.hp.com/hpq/feb2013/esxi-5x-vibs/hpacucli/hpacucli-9.40-12.0.vib

    and place it on a store of data seen by the host...

    Install it using the CLI:

    software esxcli vib install d vmfs/volumes //hpacucli-9.40-12.0.vib

    Now run it:

    ~ # cd/opt/hp/hpacucli/bin

    / opt/HP/hpacucli/bin # . / hpacucli

    HP Array Configuration Utility CLI 9.40.12.0

    Detection of controllers... Fact.

    Type 'help' for a list of supported commands.

    Type "exit" to close the console.

    => ctrl all diag file=/tmp/my_ADUreport.zip ris = on = on zip xml = on

    Generation of diagnostic report... done

    -Online output

    / opt/HP/hpacucli/bin #.

    my_ADUreport.zip in / tmp can now be downloaded from the host...

    It could be that useful...

    / Rubeck

  • How to accept the General conditions

    Can how I accept terms and conditions? My iPad and my phone ask me ' apple media services terms and conditions have changed.

    before proceeding, you must read and agree to the new terms and conditions

    ccancel/ok

    then nothing

    Hey lindafromnewark,

    I ran into something like this before, and usually a reset will solve the issue.

    You can watch notrestart your iPhone, iPad or iPod touch to see how to reboot your device.

    I'm sure that this will solve your problem.

    See you soon.

  • How to pass the Visa Resource Name parameter to labview dll in labwindows/cvi

    Hello world

    I build a dll of labview, the prototype is: double getchannelpower (double f, uintptr_t * VISAResourceName);

    I don't know how to go from VISAResourceName to this function.

    Is it related to the ViPSession paremeter in function viOpen(REES ViSession, rn ViRsrc, ViAccessMode am, ViUInt32 ti,ViPSession vi)?

    BRs,

    lotusky

    Hey, guys:

    I figured out how to pass the parameter.

    In labview, you must replace the control of visa with string control. In this way, the generated dll function at the entrance of the string type.

    I hope this will help others!

    lotusky

  • How to convert the array of integer to string

    Hi, I'm trying to convert the table of 32-bit integers to a string. For ex: If the array contains {1234, 4567, 8, 9} I need string like {00.00, 34,12, 00, 00, 45, 67,...}

    How to do this one.

    Help, please

    Thank you best regards &,.

    Harish. G.

    Hi Haris,

    use the above solution as it seems you really want figures BCD...

    Or this slightly improved version:

  • How to accept the end user license agreement in adobe reader?

    I've just updated the OS on my iMac from OS to OS 10.9.4 10.6.8. Safari has been updated to version 7.0.5. When I try to open a pdf file in Safari, I get a notice that:

    Before display PDF documents in the browser, you must launch Adobe Reader and accept the end user license agreement, and then quit and relaunch the browser.

    I was not able to find a way to accept the end user license agreement. How can I do that.

    Can I open a PDF in Chrome without any problem.

    Thank you

    Don Monroe

    I've solved this by removing Adobe Reader and re - download. Thank you.

    Don

  • How to get the standard deviation of parameter curve nonlinear

    Hello, I tried to understand (as here in the forum) how to obtain the standard deviation for the parameters of a nonlinear curve (Lev - Mar). The most interesting I found was on the Matrix of Covariance. Here the most reliable information came from DSPGuy (Message 8). But in the example VI it first takes the square root of the diagonal elements of the covariance matrix, and then multiplies these values with the RMSE (using the 'appropriateness' VI) to get the standard deviation of the parameters. In the thread, out of time, that it has been said that one has first to multiply the diagonal elements with the MSE directly from the Lev-Mar-VI.

    And another question is always there for me. That came in the previous mentioned thread:

    What is the DOF?

    a: N_MeasPoints - N_FittingParameters

    b: N_MeasPoints - (N_FittitngParameters - 1).

    If I understand the help for the 'appropriateness' VI a: must also be right, as the DSPGuy States. But I always thought that b: should suit like Peter Vijn2 said in the previously mentioned thread.

    Best thanks in advance

    Wolfgang

    Adding to the Christian post.

    1. If our documentation is incorrect, so let's fix it.

    2. I checked our source code for the CLN in the goodness of Fit.vi implements the DOF as our States to help.  They agree.  As the Christian States, if a different definition is appropriate for a given application, then you have the option to provide this value for the DOF.  I would add that the results that we return to the example related to the original message of Wolfgang tally with the results that the NIST certifies this problem to 8 decimal places.

    3 the form Christian mentioned, old implementation of Lev - Mar had an entry called "gap".  We have mapped to a weight using weight = (1/STD dev.) ^ 2 Christian to map the weight gap is therefore exactly what we used before.

    -Jim

  • How to pass an array as a parameter to a stored procedure

    Hi all
    I want to pass the name of a table as a parameter in a stored procedure, which will be used for cursors, etc..
    But when I pass the parameter and I compile the S.P. he gives me error (error: table exist not...)

    Any help?

    Thanks in advance, Marco

    Cannot open a cursor explicit when it comes to the dynamic table names or parameters. This is because the explicit and implicit cursors seek real table names since they are static.
    Here your name of the table is dynamic, so u need to use dynamic that is ref cursor to and not static cursor.

    I made the correction in the code below. Run it and check the result!

    CREATE OR REPLACE PROCEDURE "P_1" ( TAB1 VARCHAR2)
    AS
    field1 CHAR(5);
    field2 CHAR(5);
    
    c1 sys_refcursor;
    
    begin
    
    l_str := 'select a,b,c from '||tab1||' INNER JOIN tab2 ON a = .......';
    open c1 from l_str;
    
    /*OPEN C1;
    CURSOR C1
    IS
    SELECT a, b , c
    FROM TAB1
    INNER JOIN
    tab2
    ON a = .......
    OPEN C1;*/
    
    LOOP
    FETCH C1
    INTO ..... 
    
    EXIT WHEN C1%NOTFOUND;
    .....
    END;
    END LOOP;
    
    CLOSE C1;
    
    EXCEPTION
    WHEN OTHERS
    .....
    END;
    
  • Passing parameters to the query to extract in a stored procedure

    How pass us in a parameter of a query retrieves in a stored procedure?

    Because for example I: -.

    FOR SheikYerbouti in company

    LOOP

    SELECT extract (response,'/ list/hwid [@name = "Tom"] / descendant::node () / address) employee where id = 9506;

    END OF LOOP

    Instead of TOM, I want to pass a variable because I use the stored procedure. The variable is emp_rec.name

    SELECT extract (response,'/ list/hwid [@name = emp_rec.name]/descendant::node()/address) employee where id = 9506; does not work?

    The XPath expression is of type string, concatenate the value:

    extract (answer, "/ List/hwid[@name="' |) emp_rec. Name | ([""] descendant::node () ')

    However, depending on your version of the database, there may be better alternatives, so if you can give us a little more explanation on your requirement, we would be able to offer other options.

  • How to create simultaneous program of type PL/SQL stored procedure?

    I have the procedure to reset sequence as below:

    CREATE OR REPLACE PROCEDURE DEV_RESET_XX IS

    V_NEXT_VAL1 NUMBER;

    BEGIN

    RUN IMMEDIATELY "ALTER SEQUENCE DEV_RECEIPT_S1 MINVALUE 0';"

    RUN IMMEDIATELY "SELECT DEV_RECEIPT_S1. DOUBLE NEXTVAL ' IN V_NEXT_VAL1;

    RUN IMMEDIATELY "ALTER SEQUENCE DEV_RECEIPT_S1 INCREMENT BY ' |" -V_NEXT_VAL1;

    RUN IMMEDIATELY "SELECT DEV_RECEIPT_S1. DOUBLE NEXTVAL ' IN V_NEXT_VAL1;

    RUN IMMEDIATELY "ALTER SEQUENCE INCREMENT DEV_RECEIPT_S1 1 ';"

    END DEV_RESET_XX;

    And if I run this query don't use PL/SQL, no problem and success.

    EXEC DEV_RESET_XX

    And then I want to create simultaneous program for this procedure.

    1. create the executable program

    -Methods: PL/SQL, stored procedure

    2. create the simultaneous program

    -Call the executable program

    -Nothing parameter

    3. assign the application group to receive

    And then I try to run this competitor.

    But, status complete error.

    8-31-2015 7-10-22 PM.jpg

    Help, please.

    Thank you.

    Hello

    To save pl sql program, we have two required parameters. ERRBUFF and RETCODE

    Steps to create a concurrent program of type PL/SQL stored procedure. Techmandate.com

    No need to create these parameters in the simultaneous program window. Just use those in your procedure.

    hope this will help you

  • Can we do non-mandatory parameter of stored procedure?

    Can we make a parameter in the stored procedure as a non-mandatory? so that we can call the stored procedure with parameters?

    Assign a default value, for example

    p_someparameter IN INTEGER DEFAULT 0
    

    or

    p_someparameter IN INTEGER := 0
    

    Syntax of the parameter

  • Access to the defined user compex types in stored procedure

    Hi all

    I have two complex types defined by the user which are defined as follows:

    create or replace

    TYPE 'MA_ROOT_OBJECT' AS THE OBJECT

    (

    USER_MACHINE VARCHAR2 (30),

    USER_DOMAIN VARCHAR2 (60),

    DATE OF EVENT_ACTIVITY_DT,

    USERCOLL MA_USER_TABLE,

    DATABASECOLL MA_DATABASE_TABLE

    )

    And USERCOLL and DATABASECOLL are again a different complex types defined by user 2. What should I do for the DATABASECOLL of the stored procedure?

    I am getting error below when I try to access:

    • Error (13.31): PLS-00302: component 'TMP_DATABASECOLL' must be declared

    ######################################################

    PROCEDURE SP_MSACCESS_METADATA)

    MSACCESSCOLL IN MA_ROOT_TABLE,

    STATUS OF THE VARCHAR2)

    AS

    TMP_DB_NAME VARCHAR2 (100);

    TMP_DATABASECOLL MA_DATABASE_TABLE;

    meter NUMBER (3);

    BEGIN

    SAVEPOINT INIT;

    TMP_DB_NAME: = MSACCESSCOLL. TMP_DATABASECOLL. DB_NAME

    EXCEPTION

    WHILE OTHERS THEN

    STATUS: = "ERROR BY STORING DEMAND MSACCESS."

    RAISE_APPLICATION_ERROR (-20001, SQLERRM);

    ROLLBACK TO SAVEPOINT INIT;

    END SP_MSACCESS_METADATA;

    Since MA_DATABASE_TABLE is a collection, you must tell Oracle item on which you want to:

    For example, if you want only one element in the collection:

    TMP_DB_NAME: = MSACCESSCOLL. DATABASECOLL (1). DB_NAME;

    otherwise, you will need to loop.

  • SQL to generate the last weeks date (not a stored procedure)

    I need SQL to generate the last dates of weeks from Monday to Sunday. I don't want to use the data in the table or the stored procedure. I need inline SQL. Please help me with your suggestions. Thanks in advance for the help.

    Varun says:
    I need SQL to generate the last dates of weeks from Monday to Sunday. I don't want to use the data in the table or the stored procedure. I need inline SQL. Please help me with your suggestions. Thanks in advance for the help.

    below should help you get started

      1* SELECT SYSDATE-LEVEL from dual CONNECT BY LEVEL < 8
    SQL> /
    
    SYSDATE-L
    ---------
    21-APR-13
    20-APR-13
    19-APR-13
    18-APR-13
    17-APR-13
    16-APR-13
    15-APR-13
    
    7 rows selected.
    

Maybe you are looking for

  • Mail displays more mail unread in dock

    I don't know what is happening, but Mail 9.3 stopped showing on the dock when I have unread messages, I have tried to change the new notification message and unread count in dock preferences, but I can't get it back. All ideas/solutions? Thank you.

  • Libretto W100 - SSD model

    Hello can anyone tell my what SSD is build in Libretto W100 series? ConcerningThomas

  • Error average mag-phase FFT

    The purpose of my program is finally take a random signal with a length of discrete and display the fft with Windowing and applied average signal.  In the VI attached to this post, I took a sinusoidal signal and treated with an average and not an ave

  • Bsod Windows Update. Can't even use a boot disk.

    Like most of us is windows update has been trashing systems xp and vista by the thousands. I can't enter safe mode and I can't start the recovery console. I will be pulling my hard drive, connecting to another PC and manually start deleting files. Th

  • How to get the older version of SAV

    Hello I have the 2016_02 version GOING. But it's not compatible with my version (2011) of Labview. So I installed the 2014_02 going TO. But when I run the Setup file, the window that is attached, appears and nothing is installed. So, how can I instal