Using "in" clause in the query in Database control

Hi,
I have a database control and need to fire an update query to update a set of rows based on a list of values as input
Like below
update tablename
set column1="value1"
where column2 in (.......)
I need to pass a list of values for this query where column2 is a NUMBER field in Oracle DB.
can anyone help me how to go about passing this list of values?
Help is appreciated.
Thanks

You may build the comma-separated list in Java and use " {sql: ...} " in your query: http://e-docs.bea.com/workshop/docs81/doc/en/workshop/java-class/com/bea/control/DatabaseControl.html (sorry, I can't find the documentation for WLI 9.2).

Similar Messages

  • Performance hit using "where" clause in the query

    Hi All,
    I am facing a huge performance hit in the java code when using "where" clause in queries. Following are the details:
    1. SELECT * FROM Employee
    2. SELECT * FROM Employee where employeeid in (26,200,330,571,618,945)
    There is no difference in Query Execution Time for both queries.
    Business Logic Time is huge in second case as compared to first one (ratio - 1:20).
    Rows returned are more in first case as compared to second case.(ratio - 1:4)
    Business Logic is same for both the cases where I iterate through the ResultSet, get the objects and set them in a data structure.
    Does anybody know the reason of unexpected time difference for the business logic in the second case?

    Since you're mentioning clustering your index, I'll assume you are using Oracle. Knowing what database you are using makes it a lot easier to suggest things.
    Since you are using Oracle, you can get the database to tell you what execution plan it is using for each of the 2 SQL statements, and figure out why they have similar times (if they do).
    First, you need to be able to run SQL*Plus; that comes as part of a standard database installation and as part of the Oracle client installation - getting it set up and running is outside the scope of this forum.
    Second, you may need your DBA to enable autotracing, if it's not already:
    http://asktom.oracle.com/~tkyte/article1/autotrace.html
    http://www.samoratech.com/tips/swenableautotrace.htm
    Once it's all set up, you can log in to your database using sql*plus, issue "SET AUTOTRACE ON", issue queries and get execution plan information back.
    For example:
    SQL> set autotrace on
    SQL> select count(*) from it.ticket where ticket_number between 10 and 20;
      COUNT(*)
            11
    Execution Plan
    Plan hash value: 2983758974
    | Id  | Operation         | Name       | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT  |            |     1 |     4 |     1   (0)| 00:00:01 |
    |   1 |  SORT AGGREGATE   |            |     1 |     4 |            |          |
    |*  2 |   INDEX RANGE SCAN| TICKET_N10 |    12 |    48 |     1   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       2 - access("TICKET_NUMBER">=10 AND "TICKET_NUMBER"<=20)
    Statistics
              0  recursive calls
              0  db block gets
              1  consistent gets
              0  physical reads
              0  redo size
            515  bytes sent via SQL*Net to client
            469  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
              1  rows processed
    SQL> This tells me that this query used an INDEX RANGE SCAN on index TICKET_N1; the query can't do much better than that logically... In fact, the statistic "1 consistent gets" tells me that Oracle had to examine only one data block to get the answer, also can't do better than that. the statistic, "0 physical reads" tells me that the 1 data block used was already cached in Oracle's memory.
    the above is from Oracle 10g; autotrace is available back to at least 8i, but they've been adding information to the output with each release.
    If you have questions about sql_plus, check the forums at asktom.oracle.com or http://forums.oracle.com/forums/category.jspa?categoryID=18
    since sql*plus is not a JDBC thing...
    Oh, and sql*plus can also give you easier access to timing information, with "set timing on".

  • Using item values in the query

    Hi,
    Is there a way I can use item values in the query...?
    as an example, something like this
    select a.*, :P20_CUST_NAME as CUSTOMER_NAME
    from
    table TEMP a;
    haven't tried it yet but want to get the feedback first before making an attempt...
    Thanks

    Yes, as long as that item has a value in session state..
    Thank you,
    Tony Miller
    Webster, TX

  • Problem with 0FIGL_VC1 when use constant selection in the query

    Please kindly help me. I have this problem for 2 weeks already.
    When I create a query from virtual cube 0FIGL_VC1 (balance sheets / p&l statements), if I use constant selection in any of key figure, my report could not display financial statment correctly. 
    My report layout
    Columns :  key figures  (including 0FIGL_VC1_CK001)
    Rows:  0GLACCEXT  (financial statement item) << as hierarchy
    Initially, the query is processed correctly.
    However, based on the requirement from my customer, I really have to use "constant selection" for some of my columns. Whenever I do so, the query display incorrectly. (Some nodes of financial statement item just disappear. (it seem like all contra item will disappear.)  
    Please help!

    If I dont use constant selection in the query, data are display correctly.
    But If I use constant selection in the query, some financial statement item dont display any value
    Example :
       Financial statement item(Display in hier)     Period1   Total Period1(Constant selection)
                 A                                                       10            60
                 B                                                       20            60
                 C                                                       30            60
                 D                                                       0              60
    - Financial statement item "D"  has some value.
    - Financial statement item "D"  is in the hierarchy,one gl account has been assigned to more than one group differentiated by debit/credit indicator.
    Please help!!

  • Issue while using SUBPARTITION clause in the MERGE statement in PLSQL Code

    Hello All,
    I am using the below code to update specific sub-partition data using oracle merge statements.
    I am getting the sub-partition name and passing this as a string to the sub-partition clause.
    The Merge statement is failing stating that the specified sub-partition does not exist. But the sub-partition do exists for the table.
    We are using Oracle 11gr2 database.
    Below is the code which I am using to populate the data.
    declare
    ln_min_batchkey PLS_INTEGER;
    ln_max_batchkey PLS_INTEGER;
    lv_partition_name VARCHAR2 (32767);
    lv_subpartition_name VARCHAR2 (32767);
    begin
    FOR m1 IN ( SELECT (year_val + 1) AS year_val, year_val AS orig_year_val
    FROM ( SELECT DISTINCT
    TO_CHAR (batch_create_dt, 'YYYY') year_val
    FROM stores_comm_mob_sub_temp
    ORDER BY 1)
    ORDER BY year_val)
    LOOP
    lv_partition_name :=
    scmsa_handset_mobility_data_build.fn_get_partition_name (
    p_table_name => 'STORES_COMM_MOB_SUB_INFO',
    p_search_string => m1.year_val);
    FOR m2
    IN (SELECT DISTINCT
    'M' || TO_CHAR (batch_create_dt, 'MM') AS month_val
    FROM stores_comm_mob_sub_temp
    WHERE TO_CHAR (batch_create_dt, 'YYYY') = m1.orig_year_val)
    LOOP
    lv_subpartition_name :=
    scmsa_handset_mobility_data_build.fn_get_subpartition_name (
    p_table_name => 'STORES_COMM_MOB_SUB_INFO',
    p_partition_name => lv_partition_name,
    p_search_string => m2.month_val);
                        DBMS_OUTPUT.PUT_LINE('The lv_subpartition_name => '||lv_subpartition_name||' and lv_partition_name=> '||lv_partition_name);
    IF lv_subpartition_name IS NULL
    THEN
                             DBMS_OUTPUT.PUT_LINE('INSIDE IF => '||m2.month_val);
    INSERT INTO STORES_COMM_MOB_SUB_INFO T1 (
    t1.ntlogin,
    t1.first_name,
    t1.last_name,
    t1.job_title,
    t1.store_id,
    t1.batch_create_dt)
    SELECT t2.ntlogin,
    t2.first_name,
    t2.last_name,
    t2.job_title,
    t2.store_id,
    t2.batch_create_dt
    FROM stores_comm_mob_sub_temp t2
    WHERE TO_CHAR (batch_create_dt, 'YYYY') = m1.orig_year_val
    AND 'M' || TO_CHAR (batch_create_dt, 'MM') =
    m2.month_val;
    ELSIF lv_subpartition_name IS NOT NULL
    THEN
                        DBMS_OUTPUT.PUT_LINE('INSIDE ELSIF => '||m2.month_val);
    MERGE INTO (SELECT *
    FROM stores_comm_mob_sub_info
    SUBPARTITION (lv_subpartition_name)) T1 --> Issue Here
    USING (SELECT *
    FROM stores_comm_mob_sub_temp
    WHERE TO_CHAR (batch_create_dt, 'YYYY') =
    m1.orig_year_val
    AND 'M' || TO_CHAR (batch_create_dt, 'MM') =
    m2.month_val) T2
    ON (T1.store_id = T2.store_id
    AND T1.ntlogin = T2.ntlogin)
    WHEN MATCHED
    THEN
    UPDATE SET
    t1.postpaid_totalqty =
    (NVL (t1.postpaid_totalqty, 0)
    + NVL (t2.postpaid_totalqty, 0)),
    t1.sales_transaction_dt =
    GREATEST (
    NVL (t1.sales_transaction_dt,
    t2.sales_transaction_dt),
    NVL (t2.sales_transaction_dt,
    t1.sales_transaction_dt)),
    t1.batch_create_dt =
    GREATEST (
    NVL (t1.batch_create_dt, t2.batch_create_dt),
    NVL (t2.batch_create_dt, t1.batch_create_dt))
    WHEN NOT MATCHED
    THEN
    INSERT (t1.ntlogin,
    t1.first_name,
    t1.last_name,
    t1.job_title,
    t1.store_id,
    t1.batch_create_dt)
    VALUES (t2.ntlogin,
    t2.first_name,
    t2.last_name,
    t2.job_title,
    t2.store_id,
    t2.batch_create_dt);
    END IF;
    END LOOP;
    END LOOP;
    COMMIT;
    end;
    Much appreciate your inputs here.
    Thanks,
    MK.
    (SORRY TO POST THE SAME QUESTION TWICE).
    Edited by: Maddy on May 23, 2013 10:20 PM

    Duplicate question

  • Error when using "inlist operator" in the query filter of Webi 3.1

    Hi,
    We are currently in the process of migrating Deski to webi (BOXI 3.1).
    The problem is, Deski is using the "inlist" operator which is working fine but after migrating to webi the inlist operator in the query filter is throwing the below error,
    *Error Message :*
    A database error occured. The database error text is: ORA-00907: missing right parenthesis. (WIS 10901)
    Appreciate your assistance on this.
    Thanks !
    Regards,
    Perialt

    Karthik ,
    Yes I am seeing an additional paranthesis in Webi SQL query.
    For example plz consider the product table below,
    SELECT
    Product.ID,
    Product.Name
    FROM Product
    WHERE
    Product.Name IN ( @Prompt('4) Name:','C','Product\Name-M',multi,free)  )
    As a work around in Custom SQL, If I remove the paranthesis the below query is running fine in webi
    SELECT
    Product.ID,
    Product.Name
    FROM Product
    WHERE
      Product.Name IN  @Prompt('4) Name:','C','Product\Name-M',multi,free) 
    But I want a permanent solution.

  • Avoid distinct clause in the query

    hi i have a query from a single table using distinct clause and has columns (a,b,c,d,e,f,g,h,i)
    eg: select distinct a,b ,c,d from table
    where a<>0 and b<>0 and c<>0 and d<>0 and e=o and f=0 and g=0 and h=0 and i=0 ;
    when i see the execution plan with out distinct... it performs a bit faster.
    how do i remove distinct clause and make the query perform better
    this particular query is used as inline view in my vieiw . it is used in from clause .
    please suggest
    second question.... iam getting bitmap index to rowid conversion ...is this good? does it hamper performance . how to avoid this?
    regards
    raj
    Edited by: raj_fresher on Jul 17, 2009 7:48 AM

    Hi Raj
    what is e in the query ?It is the column name you provided yourself in your own unformatted example.
    After 400+ posts I thought you would understand that it's not that hard to put this exact tag => (yes, 6 characters, 4 letters between 2 curly brackets) before and after your code examples or sample data or explain plans.
    That way you maintain formatting and improve readability for us poor readers by magnitudes.
    But, I'm sure you'll succeed as well as all the others who can.
    I always look on the bright side.
    Example:
    Earlier this week another Raj also finally got enlightened about it, and his life has since then changed forever!
    +He drives a Bentley now, you know+ ;)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Where() clause returning "The query specified in the URI is not valid..."

    I have a .Net mobile service.
    Calling this:
    https://qserv.azure-mobile.net/tables/items?$filter=(company%20eq%20%27987af3f9-8d44-4a9d-8be2-7e0567287106%27)
    Returns:
    {"message":"The query specified in the URI is not valid. Could not find a property named 'company' on type 'Default.<>f__AnonymousType2_3OfString_String_Double'."}
    The field name in the "items" entity model is "company" and on the database is "company_Id", neither will work.Using http://ajax.aspnetcdn.com/ajax/mobileservices/MobileServices.Web-1.2.5.min.jsWhat is wrong?
    Regards

    I see. Now works. So it would be like doing "SELECT ITEM,CATEGORY,COUNTRY, FROM TABLE WHERE CATEGORY='toy' AND COUNTRY='US'"
    All rows will contain the "CATEGORY" and "COUNTRY" fields (or more), which is kind of redundant and bandwidth consuming.
    Hope MS can change this.
    Regards

  • Unable to use Navigational Attr in the query ?

    Hi experts,
    We are using BEx 3.X.
    We have a report based on an infoset. We want to use some navigational attributes in the query and
    restrict the values of these attributes.
    But we are unable to use them as navigational attr. They are displayed as display attributes only.
    We are unable to restrict them. This is because the query is on Infoset.
    When i use the same navigational attr in a query based on a infocube, it is displaying as Navigational Attr.
    We are in BI 7 but using BEx 3.X.
    How to resolve this ?
    Regards,
    Nishuv.

    Hi,
    Master Data Read
    A simple master data read should be done using generic BI functionality in the update rules. Choose the
    option u201CMaster Data Attribute ofu201D in the update rule details for the selected characteristic and select an
    attribute by using the F4 help. With this setting, the value of the characteristic to be updated is read from the
    master data table of the specified characteristic.
    Characteristic Material is provided by the InfoSource.
    Characteristic Material Group is not provided by the InfoSource.
    Characteristic Material Group is an attribute of characteristic Material
    Therefore you can fill Material Group from the master data table of Material: Select the method Master Data
    Attribute from and Material as source.
    The generic master data read only works for characteristics that are available in the communication
    structure.
    For a more complex master data read or if the characteristic is not available in the communication structure,
    you have to implement the master data read yourself in a routine for the specific characteristic. If so, the
    function module RSAU_READ_MASTER_DATA should be used to read the master data.
    In Infoset u can use max 2 cubes......and Infoobjects 'N' number u can use.......
    Thanks/Tarak

  • Using wild chatacters in the query

    Hi experts,
    I have a query like this:
    IF NOT i_name1 IS INITIAL.
        SELECT    kunnr
          FROM    kna1
          INTO    TABLE it_kna1
         WHERE    name1 EQ i_name1.
    ENDIF.
    Lets says KNA1 has some customer names like CABD, ZABY, PABQ, LABN.
    Suppose a customer enters the customer name as AB, how can I use the wild characters in the query to ensure
    that all these 4 names are fetched?
    Thanks,
    Ajay.

    hi ajay ,
        who told  it is not possible pls do this way
         Don't worry You can use   " Ranges : i_name1 like kn1-name1 .  PASTE BELOW   CODE IN YOUR FUNCTION MODULE
    IT WILL RUN LIKE A BULLET  .
    Ranges : i_name1 like knA1-name1 .
    MOVE 'I' TO i_NAME1-sign.
        MOVE 'CP' TO I_NAME1 option.
        MOVE I_NAME1 TO I_NAME1-low.
        APPEND I_NAME1.
    IF NOT i_name1 IS INITIAL.
    SELECT kunnr
    FROM kna1
    INTO TABLE it_kna1
    WHERE name1 EQ i_name1.
    ENDIF.
    rEGARDS
    dEEPAK .

  • Using dimension attributes in the Query Builder Bean

    All...
    I am developing an HTML client based tool using the JSP tags. I wish to create a report that selects the appropriate dimension value based upon an attribute.
    But...
    Using the query builder I can not select dimension values based upon dimension attributes. Is this possible? The only use I have found for the attributes is when I am sorting my selected diemsnion values.
    Thanks in advance
    Dylan.

    1. Java Client QueryBuilder has support for selecting dimension members based on an attribute.
    To use this functionality, go to Dimensional Panel -> Conditions tab. Drill on Match group of conditions. The attribute condition appears as the last available condition, but only for dimensions that have attributes.
    To test this, use BIBDEMO schema supplied with BI Beans and look at conditions for Product dimension.
    2. If you wish to display dimension attributes and their values in the HTML client UI,
    here is how you can retrieve attributes and their values for a dimension:
    (e.g. for Product dimension in BIBDEMO)
    String dimensionID = "MDM!D_BIBDEMO.PRODUCT";
    String hierarchyID = null;
    MDDimension dimension = metadataManager.getDimensionByUniqueID(dimensionID);
    MDHierarchy hierarchy = dimension.getDefaultHierarchy();
    if (hierarchy != null)
    hierarchyID = hierarchy.getUniqueID();
    // Retrieve all the attributes for this dimension
    MDAttribute[] attributes = dimension.getAttributes();
    if (attributes != null && attributes.length > 0)
    String attributeID = null;
    AttributeListStep attrStep = null;
    Selection sel = null;
    MetadataMap map = new MetadataMap(new String[] {MetadataMap.METADATA_VALUE});
    for (int i=0; i<attributes.length; i++)
    // Get the unique ID for the attribute
    attributeID = attributes.getUniqueID();
    // Create and evaluate an AttributeListStep
    attrStep = new AttributeListStep(dimensionID, hierarchyID, attributeID);
    sel = new Selection(dimensionID);
    sel.setHierarchy(hierarchyID);
    sel.addStep(attrStep);
    // Evaluate the AttributeListStep and get the DataAccess
    DataAccess da = query.createQueryAccess().getDataAccess(sel, map);
    // Walk the DataAccess and get the attribute values
    if (da != null)
    int extent = da.getEdgeExtent(DataDirector.COLUMN_EDGE);
    for (int i=0; i<extent; i++)
    // Get the attribute value
    strValue = (String)da.getMemberMetadata(DataDirector.COLUMN_EDGE, 0, i, MetadataMap.METDATA_VALUE);
    // Add the value to a drop down or another UI element...

  • Using RSRT to find the Query properties

    Hi All,
    Can anyone let me know to find out the Query properties using RSRT if we dont have access to BEX Analyser etc.,
    The properties like:
    <b>1.Variables built
    2.Exceptions built
    3.Conditions built
    4.Cell definitions built
    5.Types of Key figures built
    6.Query properties like Scaling factors, Show negative values as etc.,</b>
    As we have in RSRT for seeing List of Objects in Free Characteristics, Filters, Rows, Columns etc.,
    Will be waiting for Answers on this.
    Points will be rewarded for sure.

    Please go to RSRT --> select your query --> Selct query display as "HTML" and execute.
    The next page you will the actual resule display on HTML page with all properties like Exception, Condition ,Properties, etc
    Hope this helps...
    Regards
    Pankaj

  • Change the ip of database control after installing?

    Hi all
    I had to wait for a while to get my database machine's fixed ip so I just installed the database figuring I'd change the ip later. So now I changed the ip and updates both the tnsnames.ora and tnslistener.ora files. I can access the database perfectly but when I open database control to create new users, it insists on connecting to the old ip. I've added a screenshot to illustrate. It's basically the ip in that connection string that needs to change.
    !http://users.telenet.be/Metallion/screenshot2.png!
    Thanks!

    Metallion,
    Is this the first page that comes up with the Database Control startup? The reason for asking this is that I have never seen this page where password for Sys users can be stored as a preferred credentials. This kind of page comes up in Isqlplus login or when EM suggests doing a recovery, not otherwise.
    What happens when you put in the connect string, the current tnsnames entry? Are you able to connect?
    HTH
    Aman....

  • How to use a joystick on the local side to control a robot remotely connected by FP2000 .

    Hi All,
    Does anyone know how to use a joystick to teleoperate a robot on the remote side.
    The robot is connected to the Field point FP2000 RT module and hooked to the internet.
    I can use web publish to publish the control to the local side and control the robot by
    changing the control value on the picture.  Howerer, I have no idea about how to connect the
    joystick on the local compurer to the remote FP rt system. It seems I need to initionalized a communication
    between them. Does any one have the same  experiences??
    Ta. Shih  

    What you will probably need to do is write a seperate program which will run on the PC and send commands to the program running on the FP.
    You can read the joystick data with the VIs in the Advanced>>Input palette and you can communicate with your program by using a simple protocol over a TCP connection. You can find some examples in the example finder (Help>>Find Examples) by searching for TCP.  You can also find an example here and here. The protocol itself is up to you and can probably be fairly simple.
    Message Edited by tst on 02-15-2006 08:20 PM
    Try to take over the world!

  • Need Helping using VBA custom code to query AS400 database

    Hi
    I am trying to connect the AS400 using the custom page programmability in etester. I am able to make the connection for SQL queries but when i try to do the same for a SPROC, I am not able to do it successfully. Any help is very much appreciated.
    Thanks
    Subu

    The easiest thing to open the ODBC interface and create a DSN entry for your AS400. (You will need the appropriate drivers loaded on the windows machine) Once you have done that, you can use the Microsoft Active-x data objects to connect, query, read and write data.

Maybe you are looking for