OVD database adapter and WHERE clause

Hi all,
We're using OVD 11g, and have a database adapter defined against a table in an Oracle schema. The adapter correctly maps columns to LDAP attributes and creates a virtual directory.
However the table contains users we don't want to appear in the directory. We have no control over the data in the table hence we cannot remove the unwanted users from the source.
Is there any way we can specify a WHERE clause in the database adapter which limits the users pulled out of the table and created in the virtual directory? Something like WHERE organisation = 'Company A'.
Thanks
Alan

You can specify LDAP filters in Routing Include/Exclude in Adapter configuration which will eventually translate into where clause for the database adapter.
For example if you want to exclude users from organization A all you have to do is Add an LDAP filter for that organization in Routing Exclude...
Same is the case for Routing Include.
Hope this helps,
Saggu

Similar Messages

  • Database Adapter - Dynamic where clause

    The database adapter needs to support a search facility.
    The user can search by any one of the following
    1) Date Range
    2) Primary Keys
    3) user who created
    Based on the above options, a query needs to be dynamically created in Database adapter
    Date Range
    select column1, column2 from emp where createddate  > ... and  createddate < ....
    Primary Key
    select column1, column2 from emp where empid in (1,2,3)
    * user who created*
    select column1, column2 from emp where userid= 456
    The conditions after the where clause vary dynamically.
    The pure sql option does not seem to support something like
    select column1, column2 from emp #whereclause
    Is there a way to do this in the Database Adapter?
    Edited by: user11920125 on Jan 14, 2010 11:57 AM

    If you are using SOA Suite 11g you can use query by example option to achieve part of that.
    It support only equality check but on dynamic number of fields
    Adam

  • Error while using REMAP_TABLE and WHERE clause  together in IMPDP

    I am trying to move some records from a very large table to another small table.
    I am facing trouble while using REMAP_TABLE and WHERE clause together in IMPDP.
    Problem is data filter is not getting applied and all records are getting imported.
    here is how I have simulated this. please advice.
    CREATE TABLE TSHARRHB.TMP1
      A  NUMBER,
      B  NUMBER
    begin
    Insert into TSHARRHB.TMP1
       (A, B)
    Values
       (1, 1);
    Insert into TSHARRHB.TMP1
       (A, B)
    Values
       (2, 2);
    COMMIT;
    end;
    expdp system/password TABLES=tsharrhb.TMP1 DIRECTORY=GRDP_EXP_DIR DUMPFILE=TMP1.dmp REUSE_DUMPFILES=YES LOGFILE=EXP.log PARALLEL=8
    impdp system/password DIRECTORY=GRDP_EXP_DIR DUMPFILE=TMP1.dmp LOGFILE=imp.log PARALLEL=8 QUERY='TSHARRHB.TMP1:"WHERE TMP1.A = 2"'  REMAP_TABLE=TSHARRHB.TMP1:TMP3 CONTENT=DATA_ONLY
    Import: Release 11.2.0.1.0 - Production on Fri Dec 13 05:13:30 2013
    Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
    Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    With the Partitioning, Automatic Storage Management, OLAP, Data Mining
    and Real Application Testing options
    Master table "SYSTEM"."SYS_IMPORT_FULL_01" successfully loaded/unloaded
    Starting "SYSTEM"."SYS_IMPORT_FULL_01":  system/********@GRD6.RBSG DIRECTORY=GRDP_EXP_DIR DUMPFILE=TMP1.dmp LOGFILE=SSD_93_TABLES_FULL_EXP.log PARALLEL=8 QUERY=TSHARRHB.TMP1:"WHERE TMP1.A = 2" REMAP_TABLE=TSHARRHB.TMP1:TMP3 CONTENT=DATA_ONLY
    Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
    . . imported "TSHARRHB"."TMP3"                           5.421 KB       2 rows
    Job "SYSTEM"."SYS_IMPORT_FULL_01" successfully completed at 05:13:33
    here I am expecting only 1 record to get imported but both the records are getting imported. please advice.

    The strange thing compared to your output is that I get an error when I have table prefix in the query block:
    Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    Master table "SYSTEM"."SYS_IMPORT_FULL_01" successfully loaded/unloaded
    Starting "SYSTEM"."SYS_IMPORT_FULL_01":  system/******** DUMPFILE=TMP1.dmp LOGFILE=imp.log PARALLEL=8 QUERY=SYSADM.TMP1:"WHERE TMP1.A = 2" REMAP_TABLE=SYSADM.TMP1:TMP3 CONTENT=DATA_ONLY
    Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
    ORA-31693: Table data object "SYSADM"."TMP3" failed to load/unload and is being skipped due to error:
    ORA-38500: Unsupported operation: Oracle XML DB not present
    Job "SYSTEM"."SYS_IMPORT_FULL_01" completed with 1 error(s) at Fri Dec 13 10:39:11 2013 elapsed 0 00:00:03
    And if I remove it, it works:
    Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    Master table "SYSTEM"."SYS_IMPORT_FULL_01" successfully loaded/unloaded
    Starting "SYSTEM"."SYS_IMPORT_FULL_01":  system/******** DUMPFILE=TMP1.dmp LOGFILE=imp.log PARALLEL=8 QUERY=SYSADM.TMP1:"WHERE A = 2" REMAP_TABLE=SYSADM.TMP1:TMP3 CONTENT=DATA_ONLY
    Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
    . . imported "SYSADM"."TMP3"                             5.406 KB       1 out of 2 rows
    Job "SYSTEM"."SYS_IMPORT_FULL_01" successfully completed at Fri Dec 13 10:36:50 2013 elapsed 0 00:00:01
    Nicolas.
    PS: as you can see, I'm on 11.2.0.4, I do not have 11.2.0.1 that you seem to use.

  • OVD Database Adapter w/ JDBC Thin Driver to 10G RAC DB Resource

    I'm looking for feedback as to whether anyone has successfully consumed a RAC database resource through an OVD database adapter? If so, I am interested in what your host value in the adapter ui looked like.
    I am successful with this connection only if I go against one of the RAC nodes directly, thus losing redundancy.
    This is OVD 10G 10.1.4.3 on RHEL4
    RAC DB 10G
    I have tried:
    (DESCRIPTION=(ADDRESS_LIST=(LOAD_BALANCE=ON)(ADDRESS=(PROTOCOL=TCP)(HOST=10.26.4.203)(PORT=1540))(ADDRESS=(PROTOCOL=TCP)(HOST=10.26.4.204)(PORT=1540)))
    (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = myhost)(PORT = 1540))(ADDRESS = (PROTOCOL = TCP)(HOST = myhost2)(PORT = 1540))(LOAD_BALANCE = yes)(CONNECT_DATA = (SERVICE_NAME = SCHTESTS)(FAILOVER_MODE = (TYPE = SELECT)(METHOD = BASIC)(RETRIES = 200)(DELAY = 5))))
    (DESCRIPTION=(LOAD_BALANCE=on)(ADDRESS=(PROTOCOL=TCP)(HOST=myhost)(PORT=1540)) (ADDRESS=(PROTOCOL=TCP)(HOST=myhost2)(PORT=1540))(CONNECT_DATA=(SERVICE_NAME=SCHTESTS)))
    OVD Manager seems to anticipate this format because it then rejects inputs on the host and port form fields which I take as a positive indicator.
    Otherwise, this feels like taking shots in the dark...
    Any assistance or feedback is much appreciated.
    Mark

    Sorted this out:
    Used custom URL and made sure that the OVD Manager IDE was not appending any additional information following the closing bracket of the URL.
    The full successful URL was as follows with no values in any of the other fields:
    jdbc:oracle:thin:@(DESCRIPTION=(LOAD_BALANCE=on)(ADDRESS = (PROTOCOL = TCP)(HOST = host1)(PORT = 1540))(ADDRESS = (PROTOCOL = TCP)(HOST = host2)(PORT = 1540))(CONNECT_DATA=(SERVICE_NAME=SNAME)))

  • Qualifying Expression and WHERE CLAUSE Extension

    I would like to know the exact difference between 'Qualifying Expression and WHERE CLAUSE Extension'. Since both are meant to contain some CONDITION that would facilitate the Edit Check's success, So I am sometimes a bit confused with these too as to when to use what.
    Can someone help Please??

    As you can tell from my previous posts (requests!) - I'm a newbie to OC.
    From the documentation - it appears that both Qualifying expression and Where Clause work the same way but the way they execute is different.
    Qualifying expression is applied after the fetch (key fields and question response data from DCM cursor i.e., after the cursor fetches the data) and Where clause filters before QG fetch.
    HTH

  • Diferences in data from database adapter and EJB

    I'm having a strange behaviour in a BPEL that uses a Database Adapter and EJJB for several database operations.
    What happens is that when I create records in the database through the adapter, if I retrieve them through the EJB, the records returned do not contain the newly inserted data. It seems that there is a cache in the EJB side that is not updated when an new record is inserted. If I restart the server the records appear. this does not happen if I insert through the database adapter and retrieve thought it also.
    Does anyone have a clue about this?
    Thanks in advance

    Hi Pedro
    What kind of code do you have in EJB to retrieve the data. Are you using the standard JNDI Lookup for datasource and then get connection object. Then run the query on this connection. If so, do you have like any Static variables declared that stores this information. Or do you use the Eclipse JPA layer that uses annotation on the Entities generated for each table. Incase if you use JPA architecture, there are some cache settings and may be that could be the reason.
    Thanks
    Ravi Jegga

  • Difference of 'Specify Fragmentation Content'  and 'where clause Filter ' ?

    What is the difference of ‘Specify Fragmentation Content’ and ‘where clause Filter ‘
    As per my understanding Both looks like limit the data ?

    'Specify Fragmentation Content’ is for Union-ing tables, e.g. one table has data for 2008 while other has 2005-2007, so 'Specify Fragmentation Content’ tells server where to go look for data.
    'Where clause Filter' is for limiting data from the table, e.g. where status = 'Funded'

  • DB Adapter wizard – WHERE clause on parent and child tables not working.

    I have two tables, SECURITY and SECURITY_POSITIONS, where SECURITY has a 1:M relationship with SECURITY_POSITIONS. I used the DB-adapter wizard to create the relationship and the following WHERE clause expression which is looking at both the parent and the child tables;
    The expression builder looks like this:
    AND
    |--- 1. partitionKey EQUAL p_SearchKey
    |--- 2. securityType EQUAL “DBT”
    |--- 3. securityPositionsCollection.dealReference EQUAL “NA”
    The primary key on SECURITY = PARTITION_KEY and SECURITY_REFERENCE
    The foreign key from SECURITY_POSITIONS to SECURITY = PARTITION_KEY and SECURITY_REFERENCE
    securityType is on SECURITY table (master)
    securityPositionsCollection.dealReference is on SECURITY_POSITIONS table (child)
    The invoke on the database adapter is selecting a row in securityPositionsCollection for each child row, rather than just those with dealReference = “NA”!
    I turned on DEBUG logging in the BPEL console and I can see that there are 2 SELECT queries run (guess this is how Toplink does it!), where the 1st query appears to select the parent rows and the 2nd query selects the child rows.
    However the 2nd query is not working because it is failing to select only those child rows where dealReference = “NA”. Also, don’t know why the 2nd SELECT query needs to specify the child SECURITY_POSITIONS table twice in the FROM clause, because that seems to be causing the problem.
    1st query executed is as follows;
    SELECT DISTINCT t0.PARTITION_KEY, t0.SECURITY_REFERENCE, t0.SECURITY_TYPE
    FROM CENTRAL.SECURITY t0, CENTRAL.SECURITY_POSITIONS t1
    WHERE ((((t0.PARTITION_KEY = ?) AND (t0.SECURITY_TYPE = ?)) AND (t1.DEAL_REFERENCE = ?)) AND ((t1.SECURITY_REFERENCE = t0.SECURITY_REFERENCE) AND (t1.PARTIT
    ION_KEY = t0.PARTITION_KEY)))
    bind => [200706200000, DBT, NA]
    2nd query executed is as follows, where child table appears twice! ;
    SELECT DISTINCT t0.DEAL_REFERENCE, t0.PARTITION_KEY, t0.SECURITY_REFERENCE
    FROM CENTRAL.SECURITY_POSITIONS t0,
    CENTRAL.SECURITY_POSITIONS t2,
    CENTRAL.SECURITY t1
    WHERE ((((t0.SECURITY_REFERENCE = t1.SECURITY_REFERENCE) AND (t0.PARTITION_KEY = t1.PARTITION_KEY)) AND
    (((t1.PARTITION_KEY = ?) AND (t1.SECURITY_TYPE = ?)) AND
    (t2.DEAL_REFERENCE = ?))) AND
    ((t2.SECURITY_REFERENCE = t1.SECURITY_REFERENCE) AND
    (t2.PARTITION_KEY = t1.PARTITION_KEY)))
    bind => [200706200000, DBT, NA]
    Anyone experienced the same problem e.g. why is toplink making the query more complicated that it needs to be, because the query only needs to reference the SECURITY_POSITIONS table once, as follows;
    SELECT DISTINCT t0.DEAL_REFERENCE, t0.PARTITION_KEY, t0.SECURITY_REFERENCE
    FROM CENTRAL.SECURITY_POSITIONS t0,
    CENTRAL.SECURITY t1
    WHERE ((((t0.SECURITY_REFERENCE = t1.SECURITY_REFERENCE) AND (t0.PARTITION_KEY = t1.PARTITION_KEY)) AND
    (((t1.PARTITION_KEY = '200706200000') AND (t1.SECURITY_TYPE = 'DBT')) AND
    (t0.DEAL_REFERENCE = 'NA'))) AND
    ((t0.SECURITY_REFERENCE = t1.SECURITY_REFERENCE) AND
    (t0.PARTITION_KEY = t1.PARTITION_KEY)))

    Hello,
    It looks like you have configured your 1:M relationship to use batch reading. This causes the query to bring in the Security_Position table's objects to use the same selection criteria as was used on the initial query, with a join statement. This is more efficient in most cases as it ensures only the Security_positions needed for the Security objects to be fully built are read, in a single query.
    The selection criteria added is only used to filter out the Security objects. All referenced Security_Positions must be read in for the returned Security objects so that the data matches what is in the database. If you do not want the Security_Positions, you might try using indirection on the mapping which will delay the second query until you need the Security_Positions. Or, if you want only the Security_Positions with dealReference EQUAL “NA", you could do a query specifically to filter on them.
    Best Regards,
    Chris

  • Database Adapter - Using in Clause

    In the Database adapter - I need to generate a Query like
    Select * from employee where empid in (1,2).
    empid - is a integer column
    I have tried the pure sql option and generated a query like Select * from employee where empid in (#ids).
    In the transformation, I am creating a comma separated string for ids and have bound it to ids variable.
    The above works for a single ID but throws an binding error when multiple Id's are passed.
    Whats the best way to handle 'In' Clause on a integer column? (There is no issue with string columns - multiple values can be passed)

    You will need utility PL/SQL function for that:
    create or replace type myTableType
    as table of number;
    create or replace function str2tbl( p_str in varchar2 ) return myTableType
    as
    l_str long default p_str || ',';
    l_n number;
    l_data myTableType := myTabletype();
    begin
    loop
    l_n := instr( l_str, ',' );
    exit when (nvl(l_n,0) = 0);
    l_data.extend;
    l_data( l_data.count ) :=
    ltrim(rtrim(substr(l_str, 1, l_n - 1)));
    l_str := substr( l_str, l_n+1 );
    end loop;
    return l_data;
    end;
    and then in Db Adapter:
    Select * from employee where empid in ( select * from TABLE ( cast ( str2tbl( #ids) as myTableType ))
    Hope that helps,
    Adam

  • Slow split table export (R3load and WHERE clause)

    For our split table exports, we used custom coded WHERE clauses. (Basically adding additional columns to the R3ta default column to take advantage of existing indexes).
    The results have been good so far. Full tablescans have been eliminated and export times have gone down, in some cases, tables export times have improved by 50%.
    However, our biggest table, CE1OC01 (120 GB), continues to be a bottleneck. Initially, after using the new WHERE clause, it looked like performance gains were dramatic, with export times for the first 5 packages dropping from 25-30 hours down to 1 1/2 hours.
    However, after 2 hours, the remaining CE1OC01 split packages have shown no improvement. This is very odd because we are trying to determine why part of the table exports very fast, but other parts are running very slow.
    Before the custom WHERE clauses, the export server had run into issues with SORTHEAP being exhausted, so we thought that might be the culprit. But that does not seem to be an issue now, since the improved WHERE clauses have reduced or eliminated excessive sorting.
    I checked the access path of all the CE1OC01 packages, through EXPLAIN, and they all access the same index to return results. The execution time in EXPLAIN returns similar times for each of the packages:
    CE1OC01-11: select * from CE1OC01  WHERE MANDT='212'
    AND ("BELNR" > '0124727994') AND ("BELNR" <= '0131810250')
    CE1OC01-19: select * from CE1OC01 WHERE MANDT='212'
    AND ("BELNR" > '0181387534') AND ("BELNR" <= '0188469413')
          0 SELECT STATEMENT ( Estimated Costs =  8.448E+06 [timerons] )
      |
      ---      1 RETURN
          |
          ---      2 FETCH CE1OC01
              |
              ------   3 IXSCAN CE1OC01~4 #key columns:  2
    query execution time [millisec]            |       333
    uow elapsed time [microsec]                |   429,907
    total user CPU time [microsec]             |         0
    total system cpu time [microsec]           |         0
    Both queries utilize an index that has fields MANDT and BELNR. However, during R3load, CE1OC01-19 finishes in an hour and a half, whereas CE1OC01-11 can take 25-30 hours.
    I am wondering if there is anything else to check on the DB2 access path side of things or if I need to start digging deeper into other aggregate load/infrastructure issues. Other tables don't seem to exhibit this behavior. There is some discrepancy between other tables' run times (for example, 2-4 hours), but those are not as dramatic as this particular table.
    Another idea to test is to try and export only 5 parts of the table at a time, perhaps there is a throughput or logical limitation when all 20 of the exports are running at the same time. Or create a single column index on BELNR (default R3ta column) and see if that shows any improvement.
    Anyone have any ideas on why some of the table moves fast but the rest of it moves slow?
    We also notice that the "fast" parts of the table are at the very end of the table. We are wondering if perhaps the index is less fragmented in that range, a REORG or recreation of the index may do this table some good. We were hoping to squeeze as many improvements out of our export process as possible before running a full REORG on the database. This particular index (there are 5 indexes on this table) has a Cluster Ratio of 54%, so, perhaps for purposes of the export, it may make sense to REORG the table and cluster it around this particular index. By contrast, the primary key index has a Cluster Ratio of 86%.
    Here is the output from our current run. The "slow" parts of the table have not completed, but they average a throughput of 0.18 MB/min, versus the "fast" parts, which average 5 MB/min, a pretty dramatic difference.
    package     time      start date        end date          size MB  MB/min
    CE1OC01-16  10:20:37  2008-11-25 20:47  2008-11-26 07:08   417.62    0.67
    CE1OC01-18   1:26:58  2008-11-25 20:47  2008-11-25 22:14   429.41    4.94
    CE1OC01-17   1:26:04  2008-11-25 20:47  2008-11-25 22:13   416.38    4.84
    CE1OC01-19   1:24:46  2008-11-25 20:47  2008-11-25 22:12   437.98    5.17
    CE1OC01-20   1:20:51  2008-11-25 20:48  2008-11-25 22:09   435.87    5.39
    CE1OC01-1    0:00:00  2008-11-25 20:48                       0.00
    CE1OC01-10   0:00:00  2008-11-25 20:48                     152.25
    CE1OC01-11   0:00:00  2008-11-25 20:48                     143.55
    CE1OC01-12   0:00:00  2008-11-25 20:48                     145.11
    CE1OC01-13   0:00:00  2008-11-25 20:48                     146.92
    CE1OC01-14   0:00:00  2008-11-25 20:48                     140.00
    CE1OC01-15   0:00:00  2008-11-25 20:48                     145.52
    CE1OC01-2    0:00:00  2008-11-25 20:48                     184.33
    CE1OC01-3    0:00:00  2008-11-25 20:48                     183.34
    CE1OC01-4    0:00:00  2008-11-25 20:48                     158.62
    CE1OC01-5    0:00:00  2008-11-25 20:48                     157.09
    CE1OC01-6    0:00:00  2008-11-25 20:48                     150.41
    CE1OC01-7    0:00:00  2008-11-25 20:48                     175.29
    CE1OC01-8    0:00:00  2008-11-25 20:48                     150.55
    CE1OC01-9    0:00:00  2008-11-25 20:48                     154.84

    Hi all, thanks for the quick and extremely helpful answers.
    Beck,
    Thanks for the health check. We are exporting the entire table in parallel, so all the exports begin at the same time. Regarding the SORTHEAP, we initially thought that might be our problem, because we were running out of SORTHEAP on the source database server. Looks like for this run, and the previous run, SORTHEAP has remained available and has not overrun. That's what was so confusing, because this looked like a buffer overrun.
    Ralph,
    The WHERE technique you provided worked perfectly. Our export times have improved dramatically by switching to the forced full tablescan. Being always trained to eliminate full tablescans, it seems counterintuitive at first, but, given the nature of the export query, combined with the unsorted export, it now makes total sense why the tablescan works so much better.
    Looks like you were right, in this case, the index adds too much additional overhead, and especially since our Cluster Ratio was terrible (in the 50% range), so the index was definitely working against us, by bouncing all over the place to pull the data out.
    We're going to look at some of our other long running tables and see if this technique improves runtimes on them as well.
    Thanks so much, that helped us out tremendously. We will verify the data from source to target matches up 1 for 1 by running a consistency check.
    Look at the throughput difference between the previous run and the current run:
    package     time       start date        end date          size MB  MB/min
    CE1OC01-11   40:14:47  2008-11-20 19:43  2008-11-22 11:58   437.27    0.18
    CE1OC01-14   39:59:51  2008-11-20 19:43  2008-11-22 11:43   427.60    0.18
    CE1OC01-12   39:58:37  2008-11-20 19:43  2008-11-22 11:42   430.66    0.18
    CE1OC01-13   39:51:27  2008-11-20 19:43  2008-11-22 11:35   421.09    0.18
    CE1OC01-15   39:49:50  2008-11-20 19:43  2008-11-22 11:33   426.54    0.18
    CE1OC01-10   39:33:57  2008-11-20 19:43  2008-11-22 11:17   429.44    0.18
    CE1OC01-8    39:27:58  2008-11-20 19:43  2008-11-22 11:11   417.62    0.18
    CE1OC01-6    39:02:18  2008-11-20 19:43  2008-11-22 10:45   416.35    0.18
    CE1OC01-5    38:53:09  2008-11-20 19:43  2008-11-22 10:36   413.29    0.18
    CE1OC01-4    38:52:34  2008-11-20 19:43  2008-11-22 10:36   424.06    0.18
    CE1OC01-9    38:48:09  2008-11-20 19:43  2008-11-22 10:31   416.89    0.18
    CE1OC01-3    38:21:51  2008-11-20 19:43  2008-11-22 10:05   428.16    0.19
    CE1OC01-2    36:02:27  2008-11-20 19:43  2008-11-22 07:46   409.05    0.19
    CE1OC01-7    33:35:42  2008-11-20 19:43  2008-11-22 05:19   414.24    0.21
    CE1OC01-16    9:33:14  2008-11-20 19:43  2008-11-21 05:16   417.62    0.73
    CE1OC01-17    1:20:01  2008-11-20 19:43  2008-11-20 21:03   416.38    5.20
    CE1OC01-18    1:19:29  2008-11-20 19:43  2008-11-20 21:03   429.41    5.40
    CE1OC01-19    1:16:13  2008-11-20 19:44  2008-11-20 21:00   437.98    5.75
    CE1OC01-20    1:14:06  2008-11-20 19:49  2008-11-20 21:03   435.87    5.88
    PLPO          0:52:14  2008-11-20 19:43  2008-11-20 20:35    92.70    1.77
    BCST_SR       0:05:12  2008-11-20 19:43  2008-11-20 19:48    29.39    5.65
    CE1OC01-1     0:00:00  2008-11-20 19:43                       0.00
                558:13:06  2008-11-20 19:43  2008-11-22 11:58  8171.62
    package     time      start date        end date          size MB   MB/min
    CE1OC01-9    9:11:58  2008-12-01 20:14  2008-12-02 05:26   1172.12    2.12
    CE1OC01-5    9:11:48  2008-12-01 20:14  2008-12-02 05:25   1174.64    2.13
    CE1OC01-4    9:11:32  2008-12-01 20:14  2008-12-02 05:25   1174.51    2.13
    CE1OC01-8    9:09:24  2008-12-01 20:14  2008-12-02 05:23   1172.49    2.13
    CE1OC01-1    9:05:55  2008-12-01 20:14  2008-12-02 05:20   1188.43    2.18
    CE1OC01-2    9:00:47  2008-12-01 20:14  2008-12-02 05:14   1184.52    2.19
    CE1OC01-7    8:54:06  2008-12-01 20:14  2008-12-02 05:08   1173.23    2.20
    CE1OC01-3    8:52:22  2008-12-01 20:14  2008-12-02 05:06   1179.91    2.22
    CE1OC01-10   8:45:09  2008-12-01 20:14  2008-12-02 04:59   1171.90    2.23
    CE1OC01-6    8:28:10  2008-12-01 20:14  2008-12-02 04:42   1172.46    2.31
    PLPO         0:25:16  2008-12-01 20:14  2008-12-01 20:39     92.70    3.67
                90:16:27  2008-12-01 20:14  2008-12-02 05:26  11856.91

  • Avoid repeating same logic in 'select' and 'where' clauses?

    I'll preface by saying I'm self-taught and have only been fiddling with SQL for a couple of months, so forgive me if this is a dumb question. I have a query written to pull out customers who are configured to have their products stored at the wrong warehouse, according to the first 3 digits of the zip code. Here is an extremely simplified version of a query I'm trying to run:
    select custno, custbuy_zip_cd, custbuy_prim_ship_loc_cd as Warehouse,
    case when substr(custbuy_zip_cd,1,3) in ('839','848') then '20'
    when substr(custbuy_zip_cd,1,3) in ('590','591') then '33'
    end as StdWhse
    from customers
    where case when substr(custbuy_zip_cd,1,3) in ('839','848') then '20'
    when substr(custbuy_zip_cd,1,3) in ('590','591') then '33'
    end <> custbuy_prim_ship_loc_cd
    or (case when substr(custbuy_zip_cd,1,3) in ('839','848') then '20'
    when substr(custbuy_zip_cd,1,3) in ('590','591') then '33'
    end is not null and custbuy_prim_ship_loc_cd is null)
    Now, the query works, but it seems overly convoluted and feels like there must be a way to make it simpler and faster. I'm using the same 'case when' 3 times. Originally, I had thought I could use the aliases from the 'select' clause in the 'where' clause, which would simplify things:
    select custno, custbuy_prim_ship_loc_cd as Warehouse,
    case when substr(custbuy_zip_cd,1,3) in ('839','848') then '20'
    when substr(custbuy_zip_cd,1,3) in ('590','591') then '33'
    end as StdWhse
    from customers
    where StdWhse <> custbuy_prim_ship_loc_cd
    or (StdWhse is not null and custbuy_prim_ship_loc_cd is null)
    I then found out that that caused 'invalid identifier' errors. My first attempt at a solution was to use a subquery in the 'from' clause, but that ran the 'case when' on every single customer instead of the small subset, so it wound up taking much longer even though it looked neater. Any tips on how to clean up that first query to make it run faster?
    this is Oracle 11i, I believe. As a side note, I don't have write access to the database.

    Thanks for all the tips so far - still going through them. You all respond fast! Sorry about using double angle brackets for != and not using code tags, I'll make sure to format my posts properly going forward. I think the double angle brackets messed up the appearance of my original queries a little. Here's how I probably should have pasted my first query in my first post:
    select custno, custbuy_zip_cd, custbuy_prim_ship_loc_cd as Warehouse,
        case when substr(custbuy_zip_cd,1,3) in ('839','848') then '20'
            when substr(custbuy_zip_cd,1,3) in ('590','591') then '33'
        end as StdWhse
    from customers
    where case when substr(custbuy_zip_cd,1,3) in ('839','848') then '20'
            when substr(custbuy_zip_cd,1,3) in ('590','591') then '33'
        end != custbuy_prim_ship_loc_cd
        or (case when substr(custbuy_zip_cd,1,3) in ('839','848') then '20'
            when substr(custbuy_zip_cd,1,3) in ('590','591') then '33'
        end is not null and custbuy_prim_ship_loc_cd is null)The almost unanimous opinion seems to be that I should use a subquery in one way or another, but the problem remains that the only significant logic to narrow down the results is the logic that matches the 'case when' results (which are what the warehouse number should be, based on the zip code) to the current warehouse number. Therefore, it seems like any subquery is going to return my entire list of 600k customers, and take a much longer time than my original (messy) query. At least it has in the test runs I created based on
    Satyaki's and Peter's examples. The query based on my original example takes about 2.5 minutes, and the subquery examples take about 5+ even though they look cleaner.
    to clarify what the query is trying to accomplish, I want it to pull any records where the warehouse number does not equal the correct warehouse number based on zip code (or if the warehouse number is null when it shouldn't be).
    I'll try to create some sample data and sample results. Customers table:
    custno   custbuy_zip_cd  custbuy_prim_ship_loc_cd
    1        59024           20
    2        59024           33desired results:
    custno   custbuy_zip_cd   warehouse   StdWhse
    1        59024            20          33If I could create a table to hold the standard warehouses to join on, the whole thing would be much easier. The full version of the query really has hundreds of zip code prefixes and 5 different warehouses and each account has 4 alternate warehouses as well. However, I'm stuck with read only access so everything has to go right in the query. It wouldn't be the end of the world to just stick with my original query since it's not like it takes hours, and I'll only be running it weekly. I just wanted to make sure there wasn't some other solution that wasn't just cleaner but was also faster.

  • Database Adapter and Paging

    Hi
    I would like to add paging (first row, number of rows) to the Database Adapter that are calling PL/SQL. I can't see any options for this. Is this is something that I have to do at the PL/SQL level to work with Database Adapter? How would I do this in PL/SQL?
    Regards

    Try something like this...
    SELECT * FROM
         SELECT a.*, rownum r__
         FROM
              SELECT * FROM ORDERS WHERE CustomerID LIKE 'A%'
              ORDER BY OrderDate DESC, ShippingDate DESC
         ) a
         WHERE rownum < ((pageNumber * pageSize) + 1 )
    WHERE r__ >= (((pageNumber-1) * pageSize) + 1)
    This was extracted from Frans Bouma's blog...
    http://weblogs.asp.net/fbouma/archive/2007/05/21/api-s-and-production-code-shouldn-t-be-designed-by-scientists.aspx
    Cheers,
    Vlad

  • OVD: Database Adapter Query Problem

    Hey Everyone,
    I am using a database adapter in OVD 10g and am not able to get the proper results from a query. We have created a view in the database and have pointed OVD at the view. We then set up 7 objectclasses using the DB Attribute Mapping Wizard. When doing a query on the base of the DB adapters we are not getting back all of the proper results one would expect. For instance if I query for objectclass=* I only get back 2 of the 7 objectclasses. Another example would be a query for mail=[email protected] will only return the attributes from the mailRecipient objectclass when normally in LDAP the entire record would be returned.
    Does anyone have an idea as to what could be going on? Does anyone have additional resources (beyond the OVD manual) for creating a database adapter?
    Thanks,
    Stephen

    Sorted this out:
    Used custom URL and made sure that the OVD Manager IDE was not appending any additional information following the closing bracket of the URL.
    The full successful URL was as follows with no values in any of the other fields:
    jdbc:oracle:thin:@(DESCRIPTION=(LOAD_BALANCE=on)(ADDRESS = (PROTOCOL = TCP)(HOST = host1)(PORT = 1540))(ADDRESS = (PROTOCOL = TCP)(HOST = host2)(PORT = 1540))(CONNECT_DATA=(SERVICE_NAME=SNAME)))

  • OVD database adapter

    Hi,
    I have created two database adapters and one join view adapter to combine the data from the two adapters in OVD. Now i have written a custom authentication plugin in C for OAM 10g, wherein i am doing an ldap search on the join view adapter. When i invoke the plugin the first time during the day i get an error LDAP Operations Error for the ldap search query. After this it works fine and i don't get the error again. Can anyone let me know the reason for this.
    TIA.

    I wonder if this is possible, I also wonder why you'd want to do something like this

  • How to install SOAP Axis adapter and where is it available  ??

    Hi,
    I heard that SOAP Axis adapter was not initially available for PI 7.0 and was introduced in some later support pack.When I checked the below url I found that some of the components are missing.
    http://xi-dev.intranet.com:50000/XIAxisAdapter/MessageServlet
    Can anyone please suggest how I can get that pack and where it will be available?
    How to install it?
    Thanks
    Deepthi.

    Hi Sunil,
    Dont mind...one final question, they mentioned in the README file as below.. 
    // Open the SDA archive using some unzip tool and replace the following empty
    jar files with the those inclued in Axis 1.4 src package
    axis.jar
    commons-discovery-0.2.jar
    commons-logging-1.0.4.jar
    commons-net-1.0.0-dev.jar
    wsdl4j-1.5.1.jar
    When i checked in the Axis folder, I found so many files.
    Do I need to just add this Axis zip file into aii_af_axisprovider.sda Archive file.?
    If possible, It would be very helpful if you send the aii_af_axisprovider.sda file which you have deployed into your system?
    Thanks
    Deepthi

Maybe you are looking for