Passing null as input parameter for relational physical DS

I'm creating a adapter(physical and logical) to talk to a Sybase Stored procedure. A few input integer arguments to the stored procedure are always null
From Stored procedures - default NULL , I use xs:int(()) to pass in nulls. But for the 2nd argument($id),which has args with valid input following it, the stored procedure does not return any results. Executing the same stored proc with same inputs via Java JDBC or Sybase central gives the right results.
But if i give a value for the 2nd argument ($id), the stored proc returns valid multi-row results indicating that the plumbing(my rowset schema..) works.
In the below code, I have included the 2nd argument(id_inp) as an input to Logical just to be able to test using "setNull" check box. I also tried just passing "xs:int(())" without getting it as input into the logical.
Physical:
declare function f1:test_get($cid as xs:string, *$id as xs:int?*, $dt as xs:string, $tm as xs:string, $in1 as xs:int?, $in2 as xs:int?, $in3 as xs:int?, $in4 as xs:int?) as schema-element(t1:test_get) external;
Logical:
declare function tns:test_get($cid_inp as xs:string, $dt_inp as xs:string, $tm_inp as xs:string, *$id as xs:int?*) as element(ns1:OutputSchema)*{
for $test_ret_get in f1:test_get($cid_inp, *$id*, $dt_inp, $tm_inp, xs:int(()), xs:int(()), xs:int(()), xs:int(()))
return
The sybase stored proc is declared as below: [ id, in1.in2,in3,in4 do not need to be passed in]
create proc test_get
@cid          varchar(32)=null,
@id          int=null,
@dt               varchar(8)=null,
@tm               varchar(8)=null,
@in1               int=null,
@in2          int=null,
@in3          int=null,
@in4           int=0
as
Can i pass in null to an input argument followed by valid inputs to arguments following it?
Is there any other way to send null?
Thank you.

mikereiche wrote:
First - it is impossible to optimize stored procedures, as sorting, joining and filtering cannot be "pushed" inside the stored procedure. For this reason, I encourage you to avoid using stored procedures in your solution.Unfortunately, this is an external Sybase DB stored proc that we need to call to get data.
>
The issue is that SQL syntax for querying for a null value ( ... where COL_A is null ) is not consistent with querying for a non-null value (... where COL_A = ? ), and for ODSI to support querying for null values, it would need to delay generating the sql until the value of the arguments was known, and also there would be the possibility of having 2^number_of_args different sql statements. So it does not execute queries where any of the arguments are null. (look at the audit for your query, there won't be any executions of the sql).
The stored procedure seems to correctly handle the null input parameters since I get the correct results with Java JDBC.
See the thread, Re: Search Functionality , the post by Jeff Hoffman at "Mar 8, 2010 12:24 PM"
Jeff shows how to solve this problem when it occurs in a sql query (SELECT) - and this is useful for doing query-by-form - which, by the looks of it, is what you are after. To implement it for a stored query, you would need an extra "IsNull" arg for each arg that could be null,
myProcedure( @lastName varchar(8), @lastNameIsNull int, @firstName varchar(8) @firstNameIsNull int)
select from CUSTOMER where (LASTNAME = @lastName or @lastNameIsNull=1) and (FIRSTNAME = @firstName or @firstNameisNull=1)
And you would call that from ODSI as below (using Jeff's ensureNotNull function).
myProcedure( tns:ensureNotNull($lastName), fn:empty($lastName) , tns:ensureNotNull($firsttName), fn:empty($firstName) )
You may note that when lastName is null, a bogus value of "" (empty-string) will be passed for the value of @lastName. This does not matter since LASTNAME = @lastName will have no effect in the query since @lastNameIsNull=1 is true.I'm probably missing something but it is different in my case that i want to pass in null and the stored proc already has the necessary check for null. It looks up a different table when this arg is null and gets the values needed for execution.
I turned on the Audit for query parameters and it goes out as null for the 2nd argument. Its probably what i'm not getting from your explanation but I don't understand why it would behave differently compared to Java JDBC when it looks like the input parameters are the same. This also uses the JDBC DataSource created in Weblogic console.
Audit log:
rows: 0
parameters:
10000
null
12/06/11
15:48:00
null
null
null
0

Similar Messages

  • Date Format on OWB 11.1.0.7 to use for input parameter for a mapping

    All,
    What is the Date Format on OWB 11.1.0.7 to use for passing in an input parameter for a mapping to execute?
    I have tried '01-01-2010','01-JAN-2010','01.01.2010', 01/01/2010 and I get the following error:
    Error RPE-01003: An infrastructure condition prevented the request from completing.
    Error RPE-01038: Failed to evaluate expression declare l_expression DATE := 01/01/2010;begin :result := wb_rt_conversions.from_date(l_expression);end;. Please modify the expression, redeploy and retry again.
    RA-06550: line 1, column 32:
    PLS-00382: expression is of wrong type
    ORA-06550: line 1, column 24:
    PL/SQL: Item ignored
    ORA-06550: line 1, column 90:
    PLS-00320: the declaration of the type of this expression is incomplete or malformed
    ORA-06550: line 1, column 51:
    PL/SQL: Statement ignored
    I am using a Mapping Input parameter object and have a START_DATE_IN as a DATE and an END_DATE_IN as a DATE
    Any information you could provide would be greatly appreciated.
    Thanks,
    Shaun

    Hello Shaun,
    The function wb_rt_conversions.from_date is (at least in OWB10.2) overloaded and can with input-types as
    date, timestamp_unconstrained, timestamp_tz_unconstrained, timestamp_ltz_unconstrained or varchar2.
    If it doesn't work with varchar2 I would try Date:
    For example: to_date('2010-01-01','YYYY-MM-DD')
    I also found this thread:
    http://kr.forums.oracle.com/forums/thread.jspa?threadID=608257
    Hoping this helps...
    Guenther

  • Declaring input parameter for flag in procedure!!!!!

    hi,
    can anyone tell how to declare the flag i,e true or false as an input parameter in the procedure.
    here is the code wat i have
    create or replace procedure test
         cur_out out sys_refcursor
    as
    begin
         open cur_out for
              select field1
              from Test
              where REPORTING_FLG = 'y' --(here i want the user to select 'Y' or 'N' )
    ORDER BY field1;
    end TEST;
    In the where condition i want the user to select the 'y' or 'N'. So i have to give input parameter i guess. So could anyone let me know how to give input parameter for flag.
    Urgent PLZ!!!
    Thank u in Advance.

    May be this way:
    Create or Replace procedure test (cur_out out sys_refcursor,flg in varchar2)
    as
    begin
    open cur_out for select field1 from Test
    where REPORTING_FLG = flg
    ORDER BY field1;
    end TEST;
    We can only pass Input parameters!

  • How to pass refcursor as input parameter to a procedure in a package

    Hi there
    Please can anybody explain me with an small example for
    passing a procedure output(output should be a refcursor) and pass that refcursor values into a procedure in a package as input parameter and this value i want to use as join condition in my procedure ie. ename=refcursor.ename like this).That my exact question is how to pass refcursor values as in parameter
    Pls suggest me with some example statements
    thanks in advance
    prasanth a.s.

    I am giving you a generic example.
    SQL> variable v_out REFCURSOR
    SQL> r
      1  DECLARE
      2  PROCEDURE TEST1(p_out OUT SYS_REFCURSOR) IS
      3  BEGIN
      4  OPEN p_out FOR SELECT EMPNO,ENAME FROM SCOTT.EMP;
      5  END;
      6  PROCEDURE TEST2(p_in IN SYS_REFCURSOR) IS
      7  v_empno NUMBER(10);
      8  v_ename VARCHAR2(30);
      9  BEGIN
    10  LOOP
    11  FETCH p_in INTO v_empno,v_ename;
    12  EXIT WHEN p_in%NOTFOUND;
    13  DBMS_OUTPUT.PUT_LINE(v_ename);
    14  END LOOP;
    15  NULL;
    16  END;
    17  BEGIN
    18     TEST1(:v_out);
    19     TEST2(:v_out);
    20* END;
    SMITH
    ALLEN
    WARD
    JONES
    MARTIN
    BLAKE
    CLARK
    SCOTT
    KING
    TURNER
    ADAMS
    JAMES
    FORD
    MILLER
    PL/SQL procedure successfully completed.

  • How can I pass Recordsets as input parameter to a Function ?

    Hi Gurus,
    I want to create a function that receive recordsets as input parameter also returns recordsets as output.
    I have a requirement to do stock taking for all order items of one Order number in one single query execution (to avoid row by row basis).
    From the post in the forum I know that a function can return recordsets / query result using REF CURSOR or pipelined table function.
    My question is : how to pass the recordsets as input parameter to that function ?
    (because I could have 75 rows item in one order number)
    Below is the DDL and the query :
    create table stocks (Product char(4), Warehouse char(5), expireddate date, qty_available number)
    insert into stocks values('P001', 'WH001', '01-dec-2006', 30)
    insert into stocks values('P001', 'WH002', '01-dec-2006', 50)
    insert into stocks values('P001', 'WH002', '01-jan-2007', 50 )
    insert into stocks values('P001', 'WH001', '01-Mar-2007', 150)
    insert into stocks values('P002', 'WH003', '01-dec-2006', 25)
    insert into stocks values('P002', 'WH003', '15-Jan-2007', 50)
    insert into stocks values('P002', 'WH003', '01-Mar-2007', 75)
    insert into stocks values('P003', 'WH001', '01-dec-2006', 30)
    insert into stocks values('P003', 'WH002', '15-Jan-2007', 40)
    insert into stocks values('P003', 'WH003', '01-Mar-2007', 50)
    CREATE TABLE Order_Detail (PRODUCT_ORD CHAR(4), QTY_ORD number, Priority_WH CHAR(5) )
    INSERT INTO Order_Detail VALUES ('P001', 75, 'WH003') // previously 'WH002'
    INSERT INTO Order_Detail VALUES ('P002', 45, 'WH002')
    INSERT INTO Order_Detail VALUES ('P003', 55, NULL)
    The query for stock taking :
    select product,warehouse,expireddate, least(qty_available-(sm - qty_ord),qty_available) qty
    from ( select product,warehouse,expireddate,qty_available,qty_ord, sum(qty_available) over(partition by product order by s.product,expireddate,decode(warehouse,priority_wh,0,1),warehouse ) sm
    from stocks s,order_detail o
    where s.product = o.product_ord order by s.product,expireddate,decode(warehouse,priority_wh,0,1) )
    where (sm - qty_ord) < qty_available

    Hi,
    This my requirement :
    I have (simplified)Order_Detail as below :
    CREATE TABLE Order_Detail (PRODUCT_ORD CHAR(4), QTY_ORD number, Priority_WH CHAR(5) )
    INSERT INTO Order_Detail VALUES ('P001', 75, 'WH003') // previously 'WH002'
    INSERT INTO Order_Detail VALUES ('P002', 45, 'WH002')
    INSERT INTO Order_Detail VALUES ('P003', 55, NULL)
    Then I want to do stock taking from my STOCK table (described on my first post on this thread)
    create table stocks (Product char(4), Warehouse char(5), expireddate date, qty_available number)
    The rule is : The stok taking is on First In First Out basis, on expireddate.
    And I want to do it in single query.
    I want to make this a Function / Stored Procedure so that other transaction can also make use of this query.
    That is why I need to pass the 3 rows oy mr Order_Detail above, do the query, and return the result.
    Then INSERT the result into ORDER_DETAIL_PER_EXPIRED_DATE table.
    I hope this clear my requirement, is this possible ?
    Thank you,
    xtanto

  • Error while setting input parameter for dynamic process - GP

    Hi All,
    I am using CAF 7.1 GP.
    Here I have to start a process dynamically and it is working fine.
    But, when I tried to set value for input parameter of this process by
    IGPStructure params = GPStructureFactory.getStructure(process.getInputParameters());
    params.setAttributeValue("Val","MyValue");
    ( <b>Val</b> is the name of grouped input parameter ), it is giving
    com.sap.caf.eu.gp.exception.api.GPInvocationException: Structure with name input and namespace http://wwww.sap.com/nw/eup/gp does not have an attribute with name Val and namespace null.
    But no where I have mentioned http://wwww.sap.com/nw/eup/gp.
    I dont have any structures in my input and output.
    Here is my full code
           try
                IGPProcess process = null;
                IUser tl_user =UMFactory.getUserFactory().getUserByLogonID("fahad");
                     IGPUserContext userContext = GPContextFactory.getContextManager().createUserContext(tl_user);//, user.getLocale());
                     process =GPProcessFactory.getDesigntimeManager().getActiveTemplate("F5D76840A56F11DC983B001966243CAD",userContext);
                     wdComponentAPI.getMessageManager().reportSuccess("Title of process is "+process.getTitle());
                     IGPRuntimeManager rtm = GPProcessFactory.getRuntimeManager();
                     IGPProcessRoleInstanceList roles = rtm.createProcessRoleInstanceList();
                     int rolenum = process.getRoleInfoCount();
                     wdComponentAPI.getMessageManager().reportSuccess("Number is "+rolenum);
                     IGPProcessRoleInstance roleInstance=null;
                     IUser ho_User=null;
                     for (int i = 0; i < rolenum; i++)
                             wdComponentAPI.getMessageManager().reportWarning("Role Text is "process.getRoleInfo(i).getText()"  Role Name is "+process.getRoleInfo(i).getRoleName());
                             if(i==1)
                                  ho_User = UMFactory.getUserFactory().getUserByLogonID("poornendu");
                                  roleInstance = roles. createProcessRoleInstance(process.getRoleInfo(i).getRoleName());
                                  roleInstance.addRuntimeDefinedUser(ho_User);
                                  roles.addProcessRoleInstance(roleInstance);
                             if(i==2)
                                  ho_User = UMFactory.getUserFactory().getUserByLogonID("fahad");
                                  roleInstance = roles. createProcessRoleInstance(process.getRoleInfo(i).getRoleName());
                                  roleInstance.addUser(ho_User);
                                  roles.addProcessRoleInstance(roleInstance);
                     wdComponentAPI.getMessageManager().reportSuccess(""+process.getStructure().getItemCount());
                     IGPStructure params = GPStructureFactory.getStructure(process.getInputParameters());
                     wdComponentAPI.getMessageManager().reportSuccess("Title of process is "+process.getTitle());
                     <b>params.setAttributeValue("Val","MyValue");</b>                     
                     String pName=wdContext.currentContextElement().getProcessName();
                     IGPProcessInstance prInstance = rtm.startProcess(process,pName,"This process has been started using the GP public API",tl_user,roles,params,tl_user);
           catch(Exception e)
                wdComponentAPI.getMessageManager().reportException(""+e);
    Can anyone help me on this.
    Thanks,
    Fahad Hamsa

    Hi Experts,
    I solved it myself.
    The problem was, I have to make the input parameter as exposed. Thats all
    Anyway, thanks for the support.
    Regards,
    Fahad Hamsa

  • How to pass process flow input parameter to unix script external process

    Hi,
    I'm trying to pass a process flow input paramter (string) to an external process which is a unix script. I've been working on this for the last 2 days but can't get it to work. Here is the design. I have a process flow with 3 maps that create a file in the unix file system. I have a suffix, which is an input parameter to the process flow, that will need to be passed to the unix script to rename the file appending the suffix to the filename. I've tried different things and nothing works for me. Has anyone done something similar in OWB?
    Thanks much!

    I tried using useBean inside the Jsp for this.
    But following error comes:
    OracleJSP error: oracle.jsp.parse.JavaCodeException: Line # 13, oracle.jsp.parse.JspParseTagExpression@102e37e
    Error: Java code in jsp source files is not allowed in ojsp.next mode.
    Please explain why?
    How can set POST request params when calling to an external servlet?

  • Table as Input parameter for BAPI in Webdynpro Application

    I am creating webdynpro JAVA application to create RFQ, for which ABAP guy written a Custom BAPI called Z_BAPI_INQUIRY_CREATE. I tested this BAPI  in SAPGUI it is working fine. From my webdynpro application when I passes header and item parameter, my header getting inserted but my item data is not. It is giving me error like "Table input parameter not found". I am passing table to this bapi. When I tried my code to standard BAPI's (NOT CUSTOM), I am able to insert both HEADER and ITEM data.
    In above scenario I have few questions,
    1. Is there anything extra we have to do with custom BAPI's? (my BAPIs are in BOR).
    2. What is the datatype in webdynpro parallal to table parameter?
    3. is there any tutorial available for table parameter? (except FLIGHT examle).
    Thanks and regards,
    Nitin

    Hi Vijayakhanna Raman,
    Thanks much for your reply.
    Yes I did the same as you mentioned, but still I am getting an error "Table parameter not avaliable is empty".
    I am not getting were is the bug. And this is happening only with ZBapi's not with Standard Bapi's.
    I am really stucted becouse of this, answer will really get all 10 points.
    Here is my code,
         1. First create an instance for bapi and bind the instance to the bapi node.
         Z_Bapi_Inquiry_Change_Input input = new Z_Bapi_Inquiry_Change_Input();
         Zbapirfqitem item =new Zbapirfqitem();          
         wdContext.nodeBapi_RFQ_OnHold_Update_Input().bind(input);
         2. Then if u have the import parameter u have to set them by using
         input.setRfq_Number("6");
         input.setCreated_By("NLNS0000");
         //wdContext.currentBapi_RFQ_OnHold_Update_InputElement().modelObject().setRfq_Number("6");
         //wdContext.currentBapi_RFQ_OnHold_Update_InputElement().modelObject().setCreated_By("NLNS0000");
         3. If the bapi has a table parameters then the structure for the table parameters will also be imported In the model class.
    DONE!
         4. Set the table parameters by creating the instance for that structure and using this instance set it.
                             item.setUpdateflag("I");
                             item.setItm_Number("000030");
                             item.setMaterial("MAT-NITIN");
                             item.setMatl_Desc("Inserted by Nitin");
                             item.setQuantity(new BigDecimal(4));
                             item.setBase_Uom("PCE");
                             item.setReq_Qty(new BigDecimal(4));
                             item.setBase_Uom1("PCE");
                             item.setList_Price(new BigDecimal(3));
                             item.setList_Curr("");
                             item.setReq_Price(new BigDecimal(4));
                             item.setCurrency("EUR");
                             item.setIndirect_Price(new BigDecimal(4));
                             item.setCurrency_2("EUR");
                             item.setFinal_Price(new BigDecimal(4));
                             item.setCurrency_3("EUR");
                             item.setText_Line("");
                             item.setReq_Date_H(new Date(12-05-06));
                             item.setDirect_Dis(new BigDecimal(4));
                             item.setIndirect_Dis(new BigDecimal(4));
                             item.setFinal_Dis(new BigDecimal(4));
                             item.setProfit_Margin1(new BigDecimal(4));
                             item.setProfit_Margin2(new BigDecimal(4));
                             item.setBrand1("");
                             item.setModel1("");
                             item.setVal_Loccurr1(new BigDecimal(4));
                             item.setCurrency1("");
                             item.setBrand2("");
                             item.setModel2("");
                             item.setVal_Loccurr2(new BigDecimal(4));
                             item.setCurrency2("");
              5. Then add the structure instance to the bapi instance.
         input.addItem(item);
         6. Then Execute the bapi after setting the import parameters.
              //wdThis.wdGetContext().currentBapi_RFQ_OnHold_Update_InputElement().modelObject().execute();
              input.execute();
    Message was edited by: Nitin Kamble

  • Passing the same input parameter twise in execute sql task

    Hi All, I want to insert some values to 3 different tables in sql server. Execute sql task is used to populate three tables. Here is the sql statement.
    DECLARE @Dt AS DATE
    SET @Dt = ?
    INSERT INTO TABLE1 SELECT ?, COL2, COL3 FROM TABLE_A
    INSERT INTO TABLE2 SELECT ?, COL2, COL3 FROM TABLE_B
    Input parameter is mapped as follows :
    Variable name : User::EffectiveDate
    Direction : Input Data Type :
    Date Parameter name :0
    Parameter size :-1
    User::EffectiveDate is datetime variable.
    When the package is executed, it throws an error.
    [Execute SQL Task] Error: Executing the query " " failed with the following error: "Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.". Possible failure reasons: Problems
    with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly. I am not sure what I am doing wrong here. If anyone could point me to the right direction, I really appreciate.
    Thanks
    shamen

    To expand on the other answers.
    Your SQL command
    DECLARE @Dt AS DATE
    SET @Dt = ?
    INSERT INTO TABLE1 SELECT ?, COL2, COL3 FROM TABLE_A
    INSERT INTO TABLE2 SELECT ?, COL2, COL3 FROM TABLE_B
    It using 3 input variables.  I assume you didn't pass 3 variables and you want @DT to be column 1 in each.  In that case you would use:
    DECLARE @Dt AS DATE
    SET @Dt = ?
    INSERT INTO TABLE1 SELECT @Dt, COL2, COL3 FROM TABLE_A
    INSERT INTO TABLE2 SELECT @Dt, COL2, COL3 FROM TABLE_B

  • Input parameter for ZGGBS000

    Hi Expert,
    May I ask what are the input parameters for ZGGBS000, which is directly copied from RGGBS000?
    Can I read the the G/L account number by BSEG-SAKNR?
    BR,
    King

    Please check table GB01( or view VWTYGB01 in SM30) and see if exclude field for BSEG-SAKNR is marked. If yes, then the field cannot be substituted otherwise, you need to check with your FI consultant and uncheck the checkbox.
    Regards

  • Need to pass field value as input parameter for a task

    I have the following scenario:
    User opens a task from UWL and sees a UI in which a Quote no. is generated, which is saved in the backend. Next time the user comes to this UI(from the same task in his UWL) he should see the Quote no. generated. Also, the data is fetched from backend by calling BAPI which takes the Quote no. as input, which was generated the first time user visited this UI.
    My concern is how can I store this Quote no. in GP, which was generated the first time, so that user sees the data specific to quote no., as relevant for that task.
    Please help.
    Thanks and Regards
    Aanchal

    Hi Srinivasan,
    Thanks for ur quick response.
    I am explaining my issue further.
    User comes to this UI (first time), Quote no. is generated. User fills some other fields( but does not complete whatever he has to) and saves the data to backend. Now user closes the window (task remains in his UWL), but now when he opens the task, he should see the Quote no. which was generated earlier and also data which he saved(by calling BAPI). How can I get this quote no.?
    Can you please explain what you mean by "expose the quote no. at process level"?
    Thanks and Regards
    Aanchal

  • Can I pass an array as an input parameter for a stored procedure on SQL Server 2000

    I am trying to pass an array to a stored procedure residing on my SQL Server 2000 database server. Is this even possible? If it is possible, what is the syntax for this?
    Any help would be greatly appreciated.
    Thanks

    I have passed arrays to and from a database using SQL and ActiveX, including to and from stored procedures, but I cannot recall the precise method used to do so. If memory serves, everything is in the form of a string. You need to do a lot of parsing and 'unparsing' to get this data into your stored procedure.
    You are left with a couple of options to get your data to the stored procedure. I recommend using SQL in LabVIEW wherever possible as it saves the amount of external code calls (and believe me, calling ActiveX procedures developed by someone else in Visual Basic is NOT much fun at all...). You can either send the array and other data to the stored procedure (you will find the syntax in the SQL references in LabVIEW help under SQL), or you can send
    the array to the database, and have the database then act upon the array.
    I strongly recommend making routines (subVIs) to handle these operations.
    Sorry I don't have the syntax, I don't have SQL installed on this machine. If you can't find the syntax in the help, please post here again.
    -Mike Du'Lyea

  • Is it possible to pass table type values as input parameter for con prg?

    Hi All,
    Could you please confirm that is it possible to pass table type value as input to concurrent program?
    If possible how to achive this?
    If not possible whether we have any ora doc which is confirming this.
    Any hel will be great.
    Thanks,

    Hi student;
    Please check (http://apps2fusion.com/at/45-as/241-enablingdisabling-concurrent-program-parameters)
    Hope it helps
    Regard
    Helios

  • Can I use Bulk Collect results as input parameter for another cursor

    MUSIC            ==> remote MUSIC_DB database, MUSIC table has 60 million rows
    PRICE_DATA ==> remote PRICING_DB database, PRICE_DATE table has 1 billion rows
    These two table once existed in same database, but size of database exceeded available hardware size and hardware budget, so the PRICE_DATA table was moved to another Oracle database.  I need to create a single report that combines data from both of these tables, and a distributed join with DRIVING_SITE hint will not work because the size of both table is too large to push to one DRIVING_SITE location, so I wrote this PLSQL block to process in small blocks.
    QUESTION: how can use bulk collect from one cursor and pass that bulk collected information as input to second cursor without specifically listing each cell of the PLSQL bulk collection?  See sample pseudo-code below, I am trying to determine more efficient way to code than hard-coding 100 parameter names into 2nd cursor.
    NOTE: below is truly pseudo-code, I had to change the names of everything to adhere to NDA, but below works and is fast enough for my purposes, but if I want to change from 100 input parameters to 200, I have to add more hard-coded values.  There has got to be a better way.
    DECLARE
         -- define cursor that retrieves distinct SONG_IDs from MUSIC table in remote music database
         CURSOR C_CURRENT_MUSIC
         IS
        select distinct SONG_ID
        from MUSIC@MUSIC_DB
        where PRODUCTION_RELEASE=1
         /*  define a parameterized cursor that accepts 100 SONG_IDs and retrieves
              required pricing information
         CURSOR C_get_music_price_data
                   P_SONG_ID_001 NUMBER, P_SONG_ID_002 NUMBER, P_SONG_ID_003 NUMBER, P_SONG_ID_004 NUMBER, P_SONG_ID_005 NUMBER, P_SONG_ID_006 NUMBER, P_SONG_ID_007 NUMBER, P_SONG_ID_008 NUMBER, P_SONG_ID_009 NUMBER, P_SONG_ID_010 NUMBER,
                   P_SONG_ID_011 NUMBER, P_SONG_ID_012 NUMBER, P_SONG_ID_013 NUMBER, P_SONG_ID_014 NUMBER, P_SONG_ID_015 NUMBER, P_SONG_ID_016 NUMBER, P_SONG_ID_017 NUMBER, P_SONG_ID_018 NUMBER, P_SONG_ID_019 NUMBER, P_SONG_ID_020 NUMBER,
                   P_SONG_ID_021 NUMBER, P_SONG_ID_022 NUMBER, P_SONG_ID_023 NUMBER, P_SONG_ID_024 NUMBER, P_SONG_ID_025 NUMBER, P_SONG_ID_026 NUMBER, P_SONG_ID_027 NUMBER, P_SONG_ID_028 NUMBER, P_SONG_ID_029 NUMBER, P_SONG_ID_030 NUMBER,
                   P_SONG_ID_031 NUMBER, P_SONG_ID_032 NUMBER, P_SONG_ID_033 NUMBER, P_SONG_ID_034 NUMBER, P_SONG_ID_035 NUMBER, P_SONG_ID_036 NUMBER, P_SONG_ID_037 NUMBER, P_SONG_ID_038 NUMBER, P_SONG_ID_039 NUMBER, P_SONG_ID_040 NUMBER,
                   P_SONG_ID_041 NUMBER, P_SONG_ID_042 NUMBER, P_SONG_ID_043 NUMBER, P_SONG_ID_044 NUMBER, P_SONG_ID_045 NUMBER, P_SONG_ID_046 NUMBER, P_SONG_ID_047 NUMBER, P_SONG_ID_048 NUMBER, P_SONG_ID_049 NUMBER, P_SONG_ID_050 NUMBER,
                   P_SONG_ID_051 NUMBER, P_SONG_ID_052 NUMBER, P_SONG_ID_053 NUMBER, P_SONG_ID_054 NUMBER, P_SONG_ID_055 NUMBER, P_SONG_ID_056 NUMBER, P_SONG_ID_057 NUMBER, P_SONG_ID_058 NUMBER, P_SONG_ID_059 NUMBER, P_SONG_ID_060 NUMBER,
                   P_SONG_ID_061 NUMBER, P_SONG_ID_062 NUMBER, P_SONG_ID_063 NUMBER, P_SONG_ID_064 NUMBER, P_SONG_ID_065 NUMBER, P_SONG_ID_066 NUMBER, P_SONG_ID_067 NUMBER, P_SONG_ID_068 NUMBER, P_SONG_ID_069 NUMBER, P_SONG_ID_070 NUMBER,
                   P_SONG_ID_071 NUMBER, P_SONG_ID_072 NUMBER, P_SONG_ID_073 NUMBER, P_SONG_ID_074 NUMBER, P_SONG_ID_075 NUMBER, P_SONG_ID_076 NUMBER, P_SONG_ID_077 NUMBER, P_SONG_ID_078 NUMBER, P_SONG_ID_079 NUMBER, P_SONG_ID_080 NUMBER,
                   P_SONG_ID_081 NUMBER, P_SONG_ID_082 NUMBER, P_SONG_ID_083 NUMBER, P_SONG_ID_084 NUMBER, P_SONG_ID_085 NUMBER, P_SONG_ID_086 NUMBER, P_SONG_ID_087 NUMBER, P_SONG_ID_088 NUMBER, P_SONG_ID_089 NUMBER, P_SONG_ID_090 NUMBER,
                   P_SONG_ID_091 NUMBER, P_SONG_ID_092 NUMBER, P_SONG_ID_093 NUMBER, P_SONG_ID_094 NUMBER, P_SONG_ID_095 NUMBER, P_SONG_ID_096 NUMBER, P_SONG_ID_097 NUMBER, P_SONG_ID_098 NUMBER, P_SONG_ID_099 NUMBER, P_SONG_ID_100 NUMBER
         IS
         select
         from PRICE_DATA@PRICING_DB
         where COUNTRY = 'USA'
         and START_DATE <= sysdate
         and END_DATE > sysdate
         and vpc.SONG_ID IN
                   P_SONG_ID_001 ,P_SONG_ID_002 ,P_SONG_ID_003 ,P_SONG_ID_004 ,P_SONG_ID_005 ,P_SONG_ID_006 ,P_SONG_ID_007 ,P_SONG_ID_008 ,P_SONG_ID_009 ,P_SONG_ID_010,
                   P_SONG_ID_011 ,P_SONG_ID_012 ,P_SONG_ID_013 ,P_SONG_ID_014 ,P_SONG_ID_015 ,P_SONG_ID_016 ,P_SONG_ID_017 ,P_SONG_ID_018 ,P_SONG_ID_019 ,P_SONG_ID_020,
                   P_SONG_ID_021 ,P_SONG_ID_022 ,P_SONG_ID_023 ,P_SONG_ID_024 ,P_SONG_ID_025 ,P_SONG_ID_026 ,P_SONG_ID_027 ,P_SONG_ID_028 ,P_SONG_ID_029 ,P_SONG_ID_030,
                   P_SONG_ID_031 ,P_SONG_ID_032 ,P_SONG_ID_033 ,P_SONG_ID_034 ,P_SONG_ID_035 ,P_SONG_ID_036 ,P_SONG_ID_037 ,P_SONG_ID_038 ,P_SONG_ID_039 ,P_SONG_ID_040,
                   P_SONG_ID_041 ,P_SONG_ID_042 ,P_SONG_ID_043 ,P_SONG_ID_044 ,P_SONG_ID_045 ,P_SONG_ID_046 ,P_SONG_ID_047 ,P_SONG_ID_048 ,P_SONG_ID_049 ,P_SONG_ID_050,
                   P_SONG_ID_051 ,P_SONG_ID_052 ,P_SONG_ID_053 ,P_SONG_ID_054 ,P_SONG_ID_055 ,P_SONG_ID_056 ,P_SONG_ID_057 ,P_SONG_ID_058 ,P_SONG_ID_059 ,P_SONG_ID_060,
                   P_SONG_ID_061 ,P_SONG_ID_062 ,P_SONG_ID_063 ,P_SONG_ID_064 ,P_SONG_ID_065 ,P_SONG_ID_066 ,P_SONG_ID_067 ,P_SONG_ID_068 ,P_SONG_ID_069 ,P_SONG_ID_070,
                   P_SONG_ID_071 ,P_SONG_ID_072 ,P_SONG_ID_073 ,P_SONG_ID_074 ,P_SONG_ID_075 ,P_SONG_ID_076 ,P_SONG_ID_077 ,P_SONG_ID_078 ,P_SONG_ID_079 ,P_SONG_ID_080,
                   P_SONG_ID_081 ,P_SONG_ID_082 ,P_SONG_ID_083 ,P_SONG_ID_084 ,P_SONG_ID_085 ,P_SONG_ID_086 ,P_SONG_ID_087 ,P_SONG_ID_088 ,P_SONG_ID_089 ,P_SONG_ID_090,
                   P_SONG_ID_091 ,P_SONG_ID_092 ,P_SONG_ID_093 ,P_SONG_ID_094 ,P_SONG_ID_095 ,P_SONG_ID_096 ,P_SONG_ID_097 ,P_SONG_ID_098 ,P_SONG_ID_099 ,P_SONG_ID_100
         group by
               vpc.SONG_ID
              ,vpc.STOREFRONT_ID
         TYPE SONG_ID_TYPE IS TABLE OF MUSIC@MUSIC_DB%TYPE INDEX BY BINARY_INTEGER;
         V_SONG_ID_ARRAY                         SONG_ID_TYPE                     ;
         v_commit_counter           NUMBER := 0;
    BEGIN
         /* open cursor you intent to bulk collect from */
         OPEN C_CURRENT_MUSIC;
         LOOP
              /* in batches of 100, bulk collect ADAM_ID mapped TMS_IDENTIFIER into PLSQL table or records */
              FETCH C_CURRENT_MUSIC BULK COLLECT INTO V_SONG_ID_ARRAY LIMIT 100;
                   EXIT WHEN V_SONG_ID_ARRAY.COUNT = 0;
                   /* to avoid NO DATA FOUND error when pass 100 parameters to OPEN cursor, if the arrary
                      is not fully populated to 100, pad the array with nulls to fill up to 100 cells. */
                   IF (V_SONG_ID_ARRAY.COUNT >=1 and V_SONG_ID_ARRAY.COUNT <> 100) THEN
                        FOR j IN V_SONG_ID_ARRAY.COUNT+1..100 LOOP
                             V_SONG_ID_ARRAY(j) := null;
                        END LOOP;
                   END IF;
              /* pass a batch of 100 to cursor that get price information per SONG_ID and STOREFRONT_ID */
              FOR j IN C_get_music_price_data
                        V_SONG_ID_ARRAY(1) ,V_SONG_ID_ARRAY(2) ,V_SONG_ID_ARRAY(3) ,V_SONG_ID_ARRAY(4) ,V_SONG_ID_ARRAY(5) ,V_SONG_ID_ARRAY(6) ,V_SONG_ID_ARRAY(7) ,V_SONG_ID_ARRAY(8) ,V_SONG_ID_ARRAY(9) ,V_SONG_ID_ARRAY(10) ,
                        V_SONG_ID_ARRAY(11) ,V_SONG_ID_ARRAY(12) ,V_SONG_ID_ARRAY(13) ,V_SONG_ID_ARRAY(14) ,V_SONG_ID_ARRAY(15) ,V_SONG_ID_ARRAY(16) ,V_SONG_ID_ARRAY(17) ,V_SONG_ID_ARRAY(18) ,V_SONG_ID_ARRAY(19) ,V_SONG_ID_ARRAY(20) ,
                        V_SONG_ID_ARRAY(21) ,V_SONG_ID_ARRAY(22) ,V_SONG_ID_ARRAY(23) ,V_SONG_ID_ARRAY(24) ,V_SONG_ID_ARRAY(25) ,V_SONG_ID_ARRAY(26) ,V_SONG_ID_ARRAY(27) ,V_SONG_ID_ARRAY(28) ,V_SONG_ID_ARRAY(29) ,V_SONG_ID_ARRAY(30) ,
                        V_SONG_ID_ARRAY(31) ,V_SONG_ID_ARRAY(32) ,V_SONG_ID_ARRAY(33) ,V_SONG_ID_ARRAY(34) ,V_SONG_ID_ARRAY(35) ,V_SONG_ID_ARRAY(36) ,V_SONG_ID_ARRAY(37) ,V_SONG_ID_ARRAY(38) ,V_SONG_ID_ARRAY(39) ,V_SONG_ID_ARRAY(40) ,
                        V_SONG_ID_ARRAY(41) ,V_SONG_ID_ARRAY(42) ,V_SONG_ID_ARRAY(43) ,V_SONG_ID_ARRAY(44) ,V_SONG_ID_ARRAY(45) ,V_SONG_ID_ARRAY(46) ,V_SONG_ID_ARRAY(47) ,V_SONG_ID_ARRAY(48) ,V_SONG_ID_ARRAY(49) ,V_SONG_ID_ARRAY(50) ,
                        V_SONG_ID_ARRAY(51) ,V_SONG_ID_ARRAY(52) ,V_SONG_ID_ARRAY(53) ,V_SONG_ID_ARRAY(54) ,V_SONG_ID_ARRAY(55) ,V_SONG_ID_ARRAY(56) ,V_SONG_ID_ARRAY(57) ,V_SONG_ID_ARRAY(58) ,V_SONG_ID_ARRAY(59) ,V_SONG_ID_ARRAY(60) ,
                        V_SONG_ID_ARRAY(61) ,V_SONG_ID_ARRAY(62) ,V_SONG_ID_ARRAY(63) ,V_SONG_ID_ARRAY(64) ,V_SONG_ID_ARRAY(65) ,V_SONG_ID_ARRAY(66) ,V_SONG_ID_ARRAY(67) ,V_SONG_ID_ARRAY(68) ,V_SONG_ID_ARRAY(69) ,V_SONG_ID_ARRAY(70) ,
                        V_SONG_ID_ARRAY(71) ,V_SONG_ID_ARRAY(72) ,V_SONG_ID_ARRAY(73) ,V_SONG_ID_ARRAY(74) ,V_SONG_ID_ARRAY(75) ,V_SONG_ID_ARRAY(76) ,V_SONG_ID_ARRAY(77) ,V_SONG_ID_ARRAY(78) ,V_SONG_ID_ARRAY(79) ,V_SONG_ID_ARRAY(80) ,
                        V_SONG_ID_ARRAY(81) ,V_SONG_ID_ARRAY(82) ,V_SONG_ID_ARRAY(83) ,V_SONG_ID_ARRAY(84) ,V_SONG_ID_ARRAY(85) ,V_SONG_ID_ARRAY(86) ,V_SONG_ID_ARRAY(87) ,V_SONG_ID_ARRAY(88) ,V_SONG_ID_ARRAY(89) ,V_SONG_ID_ARRAY(90) ,
                        V_SONG_ID_ARRAY(91) ,V_SONG_ID_ARRAY(92) ,V_SONG_ID_ARRAY(93) ,V_SONG_ID_ARRAY(94) ,V_SONG_ID_ARRAY(95) ,V_SONG_ID_ARRAY(96) ,V_SONG_ID_ARRAY(97) ,V_SONG_ID_ARRAY(98) ,V_SONG_ID_ARRAY(99) ,V_SONG_ID_ARRAY(100)        
              LOOP
                   /* do stuff with data from Song and Pricing Database coming from the two
                        separate cursors, then continue processing more rows...
              END LOOP;
              /* commit after each batch of 100 SONG_IDs is processed */        
              COMMIT;
              EXIT WHEN C_CURRENT_MUSIC%NOTFOUND;  -- exit when there are no more rows to fetch from cursor
         END LOOP; -- bulk fetching loop
         CLOSE C_CURRENT_MUSIC; -- close cursor that was used in bulk collection
         /* commit rows */
         COMMIT; -- commit any remaining uncommitted data.
    END;

    I've got a problem when using passing VARRAY of numbers as parameter to remote cursor: it takes a super long time to run, sometimes doesn't finish even after an hour as passed.
    Continuing with my example in original entry, I replaced the bulk collect into PLSQL table collection with a VARRAY and i bulk collect into the VARRAY, this is fast and I know it works because I can DBMS_OUTPUT.PUT_LINE cells of VARRAY so I know it is getting populated correctly.  However, when I pass the VARRAY containing 100 cells populated with SONG_IDs as parameter to cursor, execution time is over an hour and when I am expecting a few seconds.
    Below code example strips the problem down to it's raw details, I skip the bulk collect and just manually populate a VARRAY with 100 SONG_ID values, then try to pass to as parameter to a cursor, but the execution time of cursor is unexpectedly long, over 30 minutes, sometime longer, when I am expecting seconds.
    IMPORTANT: If I take the same 100 SONG_IDs and place them directly in the cursor query's where IN clause, the SQL runs in under 5 seconds and returns result.  Also, if I pass the 100 SONG_IDs as individual cells of a PLSQL table collection, then it also runs fast.
    I thought that since the VARRAY is used via select subquery that is it queried locally, but the cursor is remote, and that I had a distribute problem on my hands, so I put in the DRIVING_SITE hint to attempt to force the result of query against VARRAY to go to remote server and rest of query will run there before returning result, but that didn't work either, still got slow response.
    Is something wrong with my code, or I am running into a Oracle problem that may require support to resolve?
    DECLARE
         /*  define a parameterized cursor that accepts XXX number of in SONG_IDs and
          retrieves required pricing information
         CURSOR C_get_music_price_data
      p_array_song_ids SYS.ODCInumberList              
         IS
         select  /*+DRIVING_SITE(pd) */
      count(distinct s.EVE_ID)
         from PRICE_DATA@PRICING_DB pd
         where pd.COUNTRY = 'USA'
         and pd.START_DATE <= sysdate
         and pd.END_DATE > sysdate
         and pd.SONG_ID IN
              select column_value from table(p_array_song_ids)
         group by
               pd.SONG_ID
              ,pd.STOREFRONT_ID
      V_ARRAY_SONG_IDS SYS.ODCInumberList := SYS.ODCInumberList();    
    BEGIN
    V_ARRAY_SONG_IDS.EXTEND(100);
    V_ARRAY_SONG_IDS(  1 ) := 31135  ;
    V_ARRAY_SONG_IDS(  2 ) := 31140   ;
    V_ARRAY_SONG_IDS(  3 ) := 31142   ;
    V_ARRAY_SONG_IDS(  4 ) := 31144   ;
    V_ARRAY_SONG_IDS(  5 ) := 31146   ;
    V_ARRAY_SONG_IDS(  6 ) := 31148   ;
    V_ARRAY_SONG_IDS(  7 ) := 31150   ;
    V_ARRAY_SONG_IDS(  8 ) := 31152   ;
    V_ARRAY_SONG_IDS(  9 ) := 31154   ;
    V_ARRAY_SONG_IDS( 10 ) := 31156   ;
    V_ARRAY_SONG_IDS( 11 ) := 31158   ;
    V_ARRAY_SONG_IDS( 12 ) := 31160   ;
    V_ARRAY_SONG_IDS( 13 ) := 33598   ;
    V_ARRAY_SONG_IDS( 14 ) := 33603   ;
    V_ARRAY_SONG_IDS( 15 ) := 33605   ;
    V_ARRAY_SONG_IDS( 16 ) := 33607   ;
    V_ARRAY_SONG_IDS( 17 ) := 33609   ;
    V_ARRAY_SONG_IDS( 18 ) := 33611   ;
    V_ARRAY_SONG_IDS( 19 ) := 33613   ;
    V_ARRAY_SONG_IDS( 20 ) := 33615   ;
    V_ARRAY_SONG_IDS( 21 ) := 33617   ;
    V_ARRAY_SONG_IDS( 22 ) := 33630   ;
    V_ARRAY_SONG_IDS( 23 ) := 33632   ;
    V_ARRAY_SONG_IDS( 24 ) := 33636   ;
    V_ARRAY_SONG_IDS( 25 ) := 33638   ;
    V_ARRAY_SONG_IDS( 26 ) := 33640   ;
    V_ARRAY_SONG_IDS( 27 ) := 33642   ;
    V_ARRAY_SONG_IDS( 28 ) := 33644   ;
    V_ARRAY_SONG_IDS( 29 ) := 33646   ;
    V_ARRAY_SONG_IDS( 30 ) := 33648   ;
    V_ARRAY_SONG_IDS( 31 ) := 33662   ;
    V_ARRAY_SONG_IDS( 32 ) := 33667   ;
    V_ARRAY_SONG_IDS( 33 ) := 33669   ;
    V_ARRAY_SONG_IDS( 34 ) := 33671   ;
    V_ARRAY_SONG_IDS( 35 ) := 33673   ;
    V_ARRAY_SONG_IDS( 36 ) := 33675   ;
    V_ARRAY_SONG_IDS( 37 ) := 33677   ;
    V_ARRAY_SONG_IDS( 38 ) := 33679   ;
    V_ARRAY_SONG_IDS( 39 ) := 33681   ;
    V_ARRAY_SONG_IDS( 40 ) := 33683   ;
    V_ARRAY_SONG_IDS( 41 ) := 33685   ;
    V_ARRAY_SONG_IDS( 42 ) := 33700   ;
    V_ARRAY_SONG_IDS( 43 ) := 33702   ;
    V_ARRAY_SONG_IDS( 44 ) := 33704   ;
    V_ARRAY_SONG_IDS( 45 ) := 33706   ;
    V_ARRAY_SONG_IDS( 46 ) := 33708   ;
    V_ARRAY_SONG_IDS( 47 ) := 33710   ;
    V_ARRAY_SONG_IDS( 48 ) := 33712   ;
    V_ARRAY_SONG_IDS( 49 ) := 33723   ;
    V_ARRAY_SONG_IDS( 50 ) := 33725   ;
    V_ARRAY_SONG_IDS( 51 ) := 33727   ;
    V_ARRAY_SONG_IDS( 52 ) := 33729   ;
    V_ARRAY_SONG_IDS( 53 ) := 33731   ;
    V_ARRAY_SONG_IDS( 54 ) := 33733   ;
    V_ARRAY_SONG_IDS( 55 ) := 33735   ;
    V_ARRAY_SONG_IDS( 56 ) := 33737   ;
    V_ARRAY_SONG_IDS( 57 ) := 33749   ;
    V_ARRAY_SONG_IDS( 58 ) := 33751   ;
    V_ARRAY_SONG_IDS( 59 ) := 33753   ;
    V_ARRAY_SONG_IDS( 60 ) := 33755   ;
    V_ARRAY_SONG_IDS( 61 ) := 33757   ;
    V_ARRAY_SONG_IDS( 62 ) := 33759   ;
    V_ARRAY_SONG_IDS( 63 ) := 33761   ;
    V_ARRAY_SONG_IDS( 64 ) := 33763   ;
    V_ARRAY_SONG_IDS( 65 ) := 33775   ;
    V_ARRAY_SONG_IDS( 66 ) := 33777   ;
    V_ARRAY_SONG_IDS( 67 ) := 33779   ;
    V_ARRAY_SONG_IDS( 68 ) := 33781   ;
    V_ARRAY_SONG_IDS( 69 ) := 33783   ;
    V_ARRAY_SONG_IDS( 70 ) := 33785   ;
    V_ARRAY_SONG_IDS( 71 ) := 33787   ;
    V_ARRAY_SONG_IDS( 72 ) := 33789   ;
    V_ARRAY_SONG_IDS( 73 ) := 33791   ;
    V_ARRAY_SONG_IDS( 74 ) := 33793   ;
    V_ARRAY_SONG_IDS( 75 ) := 33807   ;
    V_ARRAY_SONG_IDS( 76 ) := 33809   ;
    V_ARRAY_SONG_IDS( 77 ) := 33811   ;
    V_ARRAY_SONG_IDS( 78 ) := 33813   ;
    V_ARRAY_SONG_IDS( 79 ) := 33815   ;
    V_ARRAY_SONG_IDS( 80 ) := 33817   ;
    V_ARRAY_SONG_IDS( 81 ) := 33819   ;
    V_ARRAY_SONG_IDS( 82 ) := 33821   ;
    V_ARRAY_SONG_IDS( 83 ) := 33823   ;
    V_ARRAY_SONG_IDS( 84 ) := 33825   ;
    V_ARRAY_SONG_IDS( 85 ) := 33839   ;
    V_ARRAY_SONG_IDS( 86 ) := 33844   ;
    V_ARRAY_SONG_IDS( 87 ) := 33846   ;
    V_ARRAY_SONG_IDS( 88 ) := 33848   ;
    V_ARRAY_SONG_IDS( 89 ) := 33850   ;
    V_ARRAY_SONG_IDS( 90 ) := 33852   ;
    V_ARRAY_SONG_IDS( 91 ) := 33854   ;
    V_ARRAY_SONG_IDS( 92 ) := 33856   ;
    V_ARRAY_SONG_IDS( 93 ) := 33858   ;
    V_ARRAY_SONG_IDS( 94 ) := 33860   ;
    V_ARRAY_SONG_IDS( 95 ) := 33874   ;
    V_ARRAY_SONG_IDS( 96 ) := 33879   ;
    V_ARRAY_SONG_IDS( 97 ) := 33881   ;
    V_ARRAY_SONG_IDS( 98 ) := 33883   ;
    V_ARRAY_SONG_IDS( 99 ) := 33885   ;
    V_ARRAY_SONG_IDS(100 ) := 33889  ;
        /* do stuff with data from Song and Pricing Database coming from the two
      separate cursors, then continue processing more rows...
      FOR i IN C_get_music_price_data( v_array_song_ids ) LOOP
      . (this is the loop where I pass in v_array_song_ids
      .  populated with only 100 cells and it runs forever)
      END LOOP; 
    END;

  • How to pass multi-value input parameter to SQL command

    I'm having trouble following the threads related to passing multi-value parameters to a SQL command.
    I need more details on the work-around that exists for using a dummy main report to GET the input parameters and pass them to a subreport parameter that uses the input parameters in its sql command WHERE clause.
    So far the main report prompts user to enter badge numbers into a multi-value string type parameter field called badgeNumber.
    The main report getRequesters command executes the following SQL:
    SELECT requester FROM lawprod.requester WHERE lawprod.requester.requester IN  '{?badgeNumber}'
    order by requester
    The main report also contains a formula called requesterList that concatenates the input parameters and separates the values with commas:  (Join ({?badgeNumber}, ", ")  
    So if user enters badge numbers 1 and 2 and 3 the value of requesterList is 1, 2, 3
    From the main report I've used the Insert Subreport command to choose an existing report, and used the link tab to link @requesterList to ?requester; where ?requester is a multi-value parameter that is used in the subreport's SQL query as shown below:
    WHERE (lawprod.ictrans.update_date <=  {?endDate} AND
           lawprod.ictrans.update_date >= {?startDate} AND
           lawprod.ictrans.doc_type = 'IS' AND
           lawprod.ictrans.system_cd = 'RQ' AND
           lawprod.mmdist.posting_type = 'O1')
          AND
          (lawprod.ictrans.company = lawprod.mmdist.company AND 
           lawprod.ictrans.system_cd = lawprod.mmdist.system_cd AND
           lawprod.ictrans.location = lawprod.mmdist.location AND
           lawprod.ictrans.doc_type = lawprod.mmdist.doc_type AND
           lawprod.ictrans.document = lawprod.mmdist.doc_number AND
           lawprod.ictrans.shipment_nbr = lawprod.mmdist.doc_nbr_num AND
           lawprod.ictrans.line_nbr = lawprod.mmdist.line_nbr AND
           lawprod.ictrans.component_seq = lawprod.mmdist.component_seq)
          AND
          (lawprod.ictrans.company = lawprod.reqline.company AND 
           lawprod.ictrans.document = lawprod.reqline.req_number_a AND
           lawprod.ictrans.line_nbr = lawprod.reqline.line_nbr AND
           lawprod.reqline.company = lawprod.reqheader.company AND
           lawprod.reqline.req_number = lawprod.reqheader.req_number)
           AND
           (lawprod.reqheader.requester in '{?requester}')
    Following execution of the main report, Crystal appears to prompt for three values as expected: badge numbers for the main report, and start and end dates needed by the subreport.   I can't figure out why Crystal XI returns no data. Can anyone explain what I'm missing?
    Edited by: Patricia Sims on Sep 21, 2009 9:30 PM

    The reason no data is returned is that the multiple values are not (properly?) passed to the main report's SQL.  The main report's SQL should be (MS SQL):
    select 1 as dummy
    This causes exactly one record to be returned, which will basically be ignored (except the fact that it will drive the subreport; any query that returns only 1 record will suffice...).
    Change the concatenation of the selected values to be (basic syntax):
    formula = "|" + join({?badgeNumber}, "|") + "|"
    The leading and trailing vertical bars are important (otherwise a database value of 1 might match a selection of 123).
    Pass the concatenated string as the parameter value to the subreport.  In your subreport, select records on (basic syntax):
    formula = (instr({?sr-badgeParam}, "|"+cstr({requester},"0") + "|") > 0)
    (assumes is numeric in the database, and is integer; modify or eliminate cstr() if otherwise...)
    Put your subreport on the detail format of the main report, and you're all set...
    HTH,
    Carl

Maybe you are looking for