Binding multiple values for a clause in a PreparedStatement

Is there a way to bind multiple values for the same variable?
Example: select * from catalog where catnum = ?
and cat_num can be 12340-56, 23451-21 43211-00 etc.
so the where condition really is:
catnum in ('12340-56', '23451-21', '43211-00')
Thanks for a lead!

I've not been able to do this in a way I'd call clean. You might think you could do something like:// create a PreparedStatment with
// the following String: select * from catalog where catnum in (?)"
ps.setString(1, "'12340-56', '23451-21', '43211-00'");But the driver tends to escape the stuff you want to go "straight in" to your where clause. So I end up using Statement and building the SQL manually.
I'd be interested in anyone else's solution
Lee

Similar Messages

  • Passing multiple values for a single field in URL to call sap Transaction

    Hi All,
    I need to pass multiple values for a single field to SAP transaction .
    means if i have say a field "Date" which can contain more than one value, <b>but its not a range which has two fields</b> . How is it possible.
    Let me know pls.
    Regards,
    Sirisha.R.S.

    Hi Satyajit,
    I need to call a transaction with multiple values which gives me the report based on those values.
    So I need to pass multiple values for a single parameter.
    I hope u got it.
    Regards,
    Sirisha.R.S.

  • Any way to pass Multiple Values for a single Label in the Parameter?

    I have a Report that Contains 2 Parameters, @Customer & @Area. When trying to set up the Available Values for @Area, I'm having issues using multiple values for one Label, i.e. = "4006" Or "4610"
    One of the Filters in the Report is an Operation number, which is the [OPERATION] field, which is setup as a filter on the Tablix referencing the @Area parameter. 
    PROBLEM: I cannot retrieve any data when trying to use the ‘Or’ Operator here. If I simply put “4006” or “4610” I retrieve data, but when trying to combine it returns no data.
    Example, I need to allow a user to select ‘Chassis Incoming’, which would include data from Operations 4006 & 4610.
    QUESTION:
    Any way to pass Multiple Values for a single Label in the Parameter?
    I realize the typical solution may be to use ‘Multi-Value’ selection, but in this case we want the User to select the Area and the multiple values for Filtering will be automatically determined for them. Otherwise, they are subject to not getting
    it correct.
    I have tried several different ways, such as =”4006” Or “4610”, =(“4006”, “4610”), = In(“4006”, “4610”), etc….
    Note: We are using Report Builder 3.0

    Based on my experience, there's no way to 'intercept' the query that gets passed back to SQL Server, so a Split wouldn't work.
    Try creating either a function or stored procedure using the code below (compliments to
    http://www.dotnetspider.com/resources/4680-Parse-comma-separated-string-SQL.aspx) to parse the string: 
    CREATE FUNCTION dbo.Parse(@Array VARCHAR(1000), @Separator VARCHAR(10))
    RETURNS @ResultTable TABLE (ParseValue VARCHAR(100))AS
    BEGIN
    DECLARE @SeparatorPosition INT
    DECLARE @ArrayValue VARCHAR(1000)
    SET @Array = @Array + @Separator
    WHILE PATINDEX('%' + @Separator + '%' , @Array) <> 0
    BEGIN
    SELECT @SeparatorPosition = PATINDEX('%' + @Separator + '%', @Array)
    SELECT @ArrayValue = LEFT(@Array, @SeparatorPosition - 1)
    INSERT @ResultTable VALUES (CAST(@ArrayValue AS VARCHAR))
    SELECT @Array = STUFF(@Array, 1, @SeparatorPosition, '')
    END
    RETURN
    END
    Once created you can do things like this:
    SELECT * FROM Parse('John,Bill,David,Thomas', ',')
    SELECT * FROM (SELECT 'John' AS TestName union select 'David' AS TestName) AS Main
    WHERE TestName IN (SELECT ParseValue FROM dbo.Parse('John,Bill,David,Thomas', ','))
    This is what your SQL query would probably look like:
    SELECT OperationID, OperationName FROM dbo.Operations
    WHERE AreaID IN (SELECT ParseValue FROM dbo.Parse(@Area, ','))
    You may need to fiddle around with the Separator depending on whether SQL Server inserts a space between the comma and next value.

  • How to passing multiple values for a parameter of discoverer(url parameters

    Hi All,
    I am trying to pass multiple values for a parameter of disco report. I am trying to include my url for discoverer viewer report. the values has the following
    'jeff,mark'
    'sfophiee,angela'
    Thanks and Regards
    Venkat

    Hello Venkat,
    I know there are some problems with 10.1.2.0.2, maybe if you haven't done yet you can try with 10.1.2.2, assuming this version should be working for multiple parameter values :
    OracleAS Discoverer 10.1.2.2 is installed with the following patch :
    Patch 4960210 PLACEHOLDER BUG FOR AS/DS 10G R2 PATCH SET 2 10.1.2.2
    So, once installed you can try adding your parameter as param_<parameter_name>='sfophiee,angela'
    Hope this helps, otherwise feel free to log a Service Request to Support.
    Best Regards,
    Gianluca

  • Multiple Values For one Condition in Choose From List

    I have used one Business Partner Choose From List in my form but i want to give condition in that choose from list on GroupCode .But the condition will have multiple values like 100,102,104 then how i will write the code to incorporate multiple values for one single condition.

    Hi,
    Check this thread
    How to set a Multiple condition in a single CFL
    Hope that helps,
    Vasu Natari.

  • Multiple values for single field

    hi
    In order to upload Purchase order details, how you handle multiple values for a single field? 
          Eg: Item field may contain no. of values for a record

    Hi,
    It is generally taken care using BDC's by Table Control, and if you are using BAPI's then there are tables for ITEMS.
    Regards,
    Atish

  • Can't we use function to derive value for NEXT clause in MV ?

    Hi Friends,
    I have a requirement like below
    I need to derive the schedule (Value for NEXT clause in the create MV command) for a MV to run it
    e.g., Value from a date column : 03-JUL-2012 10:00 AM, VALUE for NEXT clause in CREATE MV statement should be 03-JUL-2012 04:45 AM (It is -5.45 hrs from the above date column value )
    So I wrote a function (GET_DATE) to derive schedule for NEXT clause and tried to call it from NEXT caluse, but it is giving error message as mentioned below
    ORA-04044: procedure, function, package, or type is not allowed here
    CREATE MATERIALIZED VIEW child_mv
    PARALLEL 16
    INITRANS 16
    STORAGE (
    FREELISTS 16
    FREELIST GROUPS 4
    BUILD IMMEDIATE
    REFRESH COMPLETE
    NEXT GET_DATE('PARENT_MV')
    AS
    SELECT * from xxmdme_party_stage where rownum<101;
    Could you please help to give some light on how this can be done ?

    942661 wrote:
    Hi Friends,
    I have a requirement like below
    I need to derive the schedule (Value for NEXT clause in the create MV command) for a MV to run it
    e.g., Value from a date column : 03-JUL-2012 10:00 AM, VALUE for NEXT clause in CREATE MV statement should be 03-JUL-2012 04:45 AM (It is -5.45 hrs from the above date column value )
    So I wrote a function (GET_DATE) to derive schedule for NEXT clause and tried to call it from NEXT caluse, but it is giving error message as mentioned below
    ORA-04044: procedure, function, package, or type is not allowed here
    CREATE MATERIALIZED VIEW child_mv
    PARALLEL 16
    INITRANS 16
    STORAGE (
    FREELISTS 16
    FREELIST GROUPS 4
    BUILD IMMEDIATE
    REFRESH COMPLETE
    NEXT GET_DATE('PARENT_MV')
    AS
    SELECT * from xxmdme_party_stage where rownum<101;
    Could you please help to give some light on how this can be done ?you must (ab)use EXECUTE IMMEDIATE

  • Got multiple values for non null local custom field

    Hi,
    I get the following error message while saving a MPP from Project Professional to MS Project Server:
    Got multiple values for non null local custom field.
    I checked the MPP and found that there are fields with same alias as Enterprise field names. However, these fields are at a Task level, whereas the Enterprise fields are at a Project Level.
    I would like to know why this is happening and the resolution for this issue. I don't want to delete the local fields.
    Any help in this regard will be appreciated.

    Then try to find any inconsistencies in the project plans with the issues, like required values not entered. Also try to save the plan as XML format and save it back as an mpp file to see if it helps (be aware that any formatting will be lost).
    Hope this helps,
    Guillaume Rouyre, MBA, MVP, P-Seller |

  • Enter multiple values for a field in dialog programming

    I need to enter multiple values for some of the fields in screen , which screen element do i use for this or is there any other way of doing it?

    That would be a table control. In this you can enter multiple values for multiple fields.
    http://help.sap.com/saphelp_nw04/helpdata/en/9f/dbac5e35c111d1829f0000e829fbfe/content.htm
    Thanks,
    SKJ

  • Multiple values for Time Characteristics (Ex: 0CALMONTH) in planning layout

    Hello,
    We are on BW - BPS 3.5v
    We have a realtime infocube with only time characteristic 0CALMONTH.
    There is a requirement that in my Planning layout I have to display the Keyfigures for:
    (CURRENT MONTH)    (CUMULATIVE 4 MONTHS FROM CURRENT MONTH) (CUMULATIVE 7 MONTHS FROM CUR MONTH)
    I defined 3 exit variables on 0CALMONTH , one for Current Month, one for All 4 months from Current Month and another for All 7 months from Current Month.
    In my planning layout when I use these variables for 0CALMONTH, I don't get the values for 4 months & 7 months.
    I checked the variables are being populated with correct values. But when they get passed to the layout it doesn't read the Cube. 
    I got the basic doubt if we can give multiple values for the time characteristics in planning layout..??
    Thanks for any suggestions.
    Vish

    Hi.
    Did you created 3 restricted KF: one with KF amount and variable current month, second with amount and variable 4 monthes, third with amount and variable 7 monthes ?
    Did you have match records in you cube ?
    Regards.

  • Create URL with multiple values for one parameter

    Post Author: cbamberg
    CA Forum: General
    While I have no problems to create the URL to open a report with a single value for a parameter from my Java application, I don't know how to format multiple values for a parameter when I want to pass the "&prompt0=" value. The values I want to pass are numbers, not strings.
    Anyone can help?

    Hi gayatri,
    you need to select both the product id and custname.put a count on the prodid column and write a condition of count>1 and apply it.
    Thanks
    Hari

  • Multiple values for one key in hashtable k, v

    So, I know that java.util.hashtable (as of Java 1.5) uses separate chaining to handle collisions. What I want to know is how to get a certain value somewhere in that bucket if they all share a common key? Javadoc says I have to search it sequentially but doesn't say how.

    OK, there's a lot of confusion on here for such a short thread :-)
    Firstly, HashMaps pick which "bucket" to store your object in based on the hash value of your object (see Object.hashCode()). However, the actual object equality test (applied to the keys during a search) is based on Object.equals(). Therefore which bucket your object is in is irrelevant - the bucketting concept is just used as a way of quickly locating a subset of all the keys in the map which might match your search value. There could very well be just a single bucket in a map and it wouldn't change its logical behaviour.
    This statement: "any Map including Hashtable, can only have a single (key,value) pair" is poorly worded. What it should say is that for any given key, a map can only hold a single value.
    Really, you don't need to think about the internal structure of maps (i.e. buckets, etc.).
    If you want to store multiple values for any given key, then make your value a list (java.util.List) and store your multiple real values inside that list.

  • Storing multipl values for meta data in DOCUMENT_META_DATA

    Hi,
    We currently have 3 content types in our system: news, announcements, and events.
    They are currently stored in 3 different tables. We want to make this content
    available via the various CM (select) and PZ tags (contentquery, contentselector).
    I'd like to avoid writing my own doc provider (file:///D:/bea7/weblogic700/wlp/docs70/dev/conmgmt.htm#999019)
    and instead would like to begin to publish document data directly to the reference
    implementation tables (DOCUMENT and DOCUMENT_METADATA).
    It seems like I should be able to do that with one exception. It doesn't seem
    like we can store multiple values for meta data attributes. If you take the out
    of the box p13n example, a lot of the data is tagged with 'genre' = Something
    (i.e. Rock, Hip-hop, etc). Then content queries use this genre to personalize
    pages.
    What if I have a band that has multiple genres? What if I want to tag my band
    as Rock and Hip-hop? And then also want that band to appear on both a Rock lovers
    and a Hip hop groupies page? Is this possible with the default implementation?
    I know when I tried entering multiple 'genre' meta data values for a same document
    ID, it gave me a PK constraint violation. Any other trick around this?
    Thanks,
    Will Young
    ps. using weblogic 7...

    Yes Subler http://code.google.com/p/subler/ does support adding the HD tag.
    On the Mac I wouldn't use anything but Subler for tagging, best UI, best metadata lookup, best underlying libraries for mp4 files (I'm biased on the libraries part).
    Cheers Ed.

  • Multiple values for the Parameter

    1. Had any tried the selecting MULTIPLE values for the parameter in Oracle Discoverer Plus Releae 4.1 Version 4.1.37.00.0. If so can please let me know how to implement it.
    2. In a Page-Detail Cross Tab workbook, I have to show the weighted average instead of the avg or sum. Any inputs please.
    3. I have to compare two periods (TOP) of datapoints. Any inputs please.

    If you wanted to eliminate the need for users to type in the parameter values, you could create a LOV on the desired column. This will produce a distinct list of all valid values where the user would simply select as the wish. Of course you still need to check the "let user enter multiple values" checkbox if you want them to select more than one.
    -DG

  • Multiple values for an attribute ?

    Is it possible to accept multiple values for the same attribute ?
    (such as a multi-select list, like Portal perspectives)
    Thanks

    Is it possible to accept multiple values for the same attribute ?
    (such as a multi-select list, like Portal perspectives)
    Thanks

Maybe you are looking for