OID: Matching rule where clause is null

Hi All,
I've installed OIM 11.1.1.5.0 BP02 with OID connector 9.0.4.14. I am able to provision to OID and to run the "OID User Target Recon" scheduled task successfully. However, when I run the "OID User Trusted Recon" scheduled task, I get the error below. Does anyone know why this error is occurring and how to solve it?
[2012-05-15T22:55:11.791+02:00] [oim_server1] [NOTIFICATION] [IAM-5010000] [oracle.iam.reconciliation.impl] [tid: OIMQuartzScheduler_Worker-4] [userId: oiminternal] [ecid: 0000JTHLa8WBp20LVyCCyc1FgcIi000002,0] [APP: oim#11.1.1.3.0] Generic Information: ignoreEvent Input Data : {Telephone=, Organization=Xellerate Users, Location=, Preferred Language=, Middle Name=, Xellerate Type=End-User Administrator, Title=, User ID=COETZETH, Manager ID=, Container DN=cn=Users, ssouid=, Status=Active, orclGuid=BA2694539E2C432F852460915924D067, [email protected], modifytimestamp=20120515192927z, Common Name=COETZETH, Role=Consultant, Server Name=OID IT Resource, TimeZone=, Department=, Last Name=Coetzee, First Name=Theuns} dateFormat : yyyy/MM/dd HH:mm:ss z
[2012-05-15T22:55:11.792+02:00] [oim_server1] [NOTIFICATION] [IAM-5010000] [oracle.iam.reconciliation.impl.config] [tid: OIMQuartzScheduler_Worker-4] [userId: oiminternal] [ecid: 0000JTHLa8WBp20LVyCCyc1FgcIi000002,0] [APP: oim#11.1.1.3.0] Generic Information: Xellerate User from cache
[2012-05-15T22:55:11.792+02:00] [oim_server1] [ERROR] [IAM-5010000] [oracle.iam.reconciliation.impl] [tid: OIMQuartzScheduler_Worker-4] [userId: oiminternal] [ecid: 0000JTHLa8WBp20LVyCCyc1FgcIi000002,0] [APP: oim#11.1.1.3.0] Generic Information: {0}[[
oracle.iam.reconciliation.exception.ReconciliationException: Matching rule where clause is null
at oracle.iam.reconciliation.impl.ReconOperationsServiceImpl.getMatchingRule(ReconOperationsServiceImpl.java:490)
at oracle.iam.reconciliation.impl.ReconOperationsServiceImpl.ignoreEvent(ReconOperationsServiceImpl.java:390)
at oracle.iam.reconciliation.impl.ReconOperationsServiceImpl.ignoreEvent(ReconOperationsServiceImpl.java:355)
at Thor.API.Operations.tcReconciliationOperationsIntfEJB.ignoreEventx(Unknown Source)
at sun.reflect.GeneratedMethodAccessor1849.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.bea.core.repackaged.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at com.bea.core.repackaged.springframework.jee.spi.MethodInvocationVisitorImpl.visit(MethodInvocationVisitorImpl.java:37)
at weblogic.ejb.container.injection.EnvironmentInterceptorCallbackImpl.callback(EnvironmentInterceptorCallbackImpl.java:54)
at com.bea.core.repackaged.springframework.jee.spi.EnvironmentInterceptor.invoke(EnvironmentInterceptor.java:50)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at com.bea.core.repackaged.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at com.bea.core.repackaged.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy372.ignoreEventx(Unknown Source)
at Thor.API.Operations.tcReconciliationOperationsIntfEJB_troehf_tcReconciliationOperationsIntfRemoteImpl.__WL_invoke(Unknown Source)
at weblogic.ejb.container.internal.SessionRemoteMethodInvoker.invoke(SessionRemoteMethodInvoker.java:40)
at Thor.API.Operations.tcReconciliationOperationsIntfEJB_troehf_tcReconciliationOperationsIntfRemoteImpl.ignoreEventx(Unknown Source)
at sun.reflect.GeneratedMethodAccessor1848.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at weblogic.ejb.container.internal.RemoteBusinessIntfProxy.invoke(RemoteBusinessIntfProxy.java:85)
at $Proxy169.ignoreEventx(Unknown Source)
at sun.reflect.GeneratedMethodAccessor1847.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:198)
at $Proxy356.ignoreEventx(Unknown Source)
at Thor.API.Operations.tcReconciliationOperationsIntfDelegate.ignoreEvent(Unknown Source)
at com.thortech.xl.integration.OID.schedule.tasks.tcTskOIDUserReconciliation.reconcileUser(Unknown Source)
at com.thortech.xl.integration.OID.schedule.tasks.tcTskOIDUserReconciliation.processRecord(Unknown Source)
at com.thortech.xl.integration.OID.util.tcUtilLDAPOperations.pagingReconSearch(Unknown Source)
at com.thortech.xl.integration.OID.schedule.tasks.tcTskOIDUserReconciliation.doReconSearch(Unknown Source)
at com.thortech.xl.integration.OID.schedule.tasks.tcTskOIDUserReconciliation.processChange(Unknown Source)
at com.thortech.xl.integration.OID.schedule.tasks.tcTskOIDUserReconciliation.execute(Unknown Source)
at com.thortech.xl.scheduler.tasks.SchedulerBaseTask.execute(SchedulerBaseTask.java:384)
at oracle.iam.scheduler.vo.TaskSupport.executeJob(TaskSupport.java:145)
at sun.reflect.GeneratedMethodAccessor565.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at oracle.iam.scheduler.impl.quartz.QuartzJob.execute(QuartzJob.java:196)
at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:529)
[2012-05-15T22:55:11.794+02:00] [oim_server1] [ERROR] [] [XL_INTG.OID] [tid: OIMQuartzScheduler_Worker-4] [userId: oiminternal] [ecid: 0000JTHLa8WBp20LVyCCyc1FgcIi000002,0] [APP: oim#11.1.1.3.0] ====================================================
[2012-05-15T22:55:11.794+02:00] [oim_server1] [ERROR] [] [XL_INTG.OID] [tid: OIMQuartzScheduler_Worker-4] [userId: oiminternal] [ecid: 0000JTHLa8WBp20LVyCCyc1FgcIi000002,0] [APP: oim#11.1.1.3.0] com.thortech.xl.integration.OID.schedule.tasks.tcTskOIDUserReconciliationException when reconciling COETZETH
[2012-05-15T22:55:11.795+02:00] [oim_server1] [ERROR] [] [XL_INTG.OID] [tid: OIMQuartzScheduler_Worker-4] [userId: oiminternal] [ecid: 0000JTHLa8WBp20LVyCCyc1FgcIi000002,0] [APP: oim#11.1.1.3.0] ====================================================[[
[2012-05-15T22:55:11.795+02:00] [oim_server1] [ERROR] [] [XL_INTG.OID] [tid: OIMQuartzScheduler_Worker-4] [userId: oiminternal] [ecid: 0000JTHLa8WBp20LVyCCyc1FgcIi000002,0] [APP: oim#11.1.1.3.0] ====================================================
[2012-05-15T22:55:11.795+02:00] [oim_server1] [ERROR] [] [XL_INTG.OID] [tid: OIMQuartzScheduler_Worker-4] [userId: oiminternal] [ecid: 0000JTHLa8WBp20LVyCCyc1FgcIi000002,0] [APP: oim#11.1.1.3.0] Exception in OID:tcTskOIDUserReconciliation:reconcileUser() oracle.iam.reconciliation.exception.ReconciliationException: Matching rule where clause is null
[2012-05-15T22:55:11.796+02:00] [oim_server1] [ERROR] [] [XL_INTG.OID] [tid: OIMQuartzScheduler_Worker-4] [userId: oiminternal] [ecid: 0000JTHLa8WBp20LVyCCyc1FgcIi000002,0] [APP: oim#11.1.1.3.0] ====================================================

user10233157 wrote:
Could anyone please explain to me how reconciliation and the various design console forms in OIM fit together? I am struggling to understand how resource objects, reconciliation fields, reconciliation action rules, reconciliation field mappings and reconcilaition rules all fit together... As for my original question, I have installed the OID connector and not made any modifications. I expected to see users created in OIM when running the trusted recon task.... When I run the target recon task existing users are associated with accounts in OID (as expected).Most times with OIM, following the documentation will not work. It requires knowledge of the product to find the missed steps, or missed pieces. You really need to get a baseline skill set with the product either through the Oracle By Examples or taking an Oracle University course. You are basically asking the community for all the answers but you haven't done your part.
-Kevin

Similar Messages

  • Where clause with null values

    I need to have a where clause but either/both of the two attributes compared could be null. How can I make this work, atm it just returns no records even though rows do exist.
    Thanks

    Andrew,
    I think you didn't read correctly what I wrote. I said:
    "Even if a column is unique you still can have several nulls in it"
    So I didnt speak about the case where you have severeal columns in a unique constraint but only ONE.
    SQL> CREATE TABLE tab1 (col1 number);
    Table created.
    SQL> ALTER table tab1 add constraint tab1_col1_uk unique (col1);
    Table altered.
    SQL> INSERT INTO tab1 VALUES (1);
    1 row created.
    SQL> INSERT INTO tab1 VALUES (2);
    1 row created.
    SQL> INSERT INTO tab1 VALUES (2);
    INSERT INTO tab1
    ERROR at line 1:
    ORA-00001: unique constraint (MUELLERMAU.TAB1_COL1_UK) violated
    SQL> INSERT INTO tab1 VALUES (NULL);
    1 row created.
    SQL> INSERT INTO tab1 VALUES (NULL);
    1 row created.
    And even if you have a unique constraint over several columns you can still have more than on records containing only nulls in all fields related to that unique contraint.
    SQL> CREATE TABLE nn (col1 number, col2 varchar2(3));
    Table created.
    SQL> ALTER TABLE nn ADD CONSTRAINT nn_uk UNIQUE (col1, col2);
    Table altered.
    SQL> INSERT INTO nn VALUES (NULL,NULL);
    1 row created.
    SQL> INSERT INTO nn VALUES (NULL,NULL);
    1 row created.
    Regards
    Maurice

  • Linq to XML query where clause excluding null attribute in child

    I'm quite new to linq/XML and although I'm making progress I'm stuck at combining two levels of elements in a where clause. The XML is something like this
    <employees type="cashier">
    <employee hired="Jun 1 2000" fired="Jun 1 2013">
    <stats name="jane doe">
    ... other stuff ...
    <stats />
    <employee/> <employee hired="Jun 1 2000">
            <stats name="john doe">
                ... other stuff ...
            <stats />
        <employee/>
    <employees/>
    I'm trying to retrieve all employees of type "cashier" that haven't been fired.
    I tried this
    IEnumerable<XElement> CashierElements = from el in xDoc.Root.Descendants("employees")
    where (string)el.Attribute("type")=="cashier"
    && (string)el.Element("stats").Attribute("fired") != null
    select el;
    But that returns entries where the fired attribute doesn't exist. I'm not even sure I can reference the stats element attribute in this way but VS2013 doesn't complain about it.
    I have managed to muddle past by using two linq selections, the one above without the stats comparison followed by a second on the results that checks for "fired" being null.
    How would I achieve this with one select statement?
    Thanks!

    Hi,
    1) Your XML contains the attribute "fired" on "employee" element. Your query search this attribute on the "stats" element.
    2) you say "that haven't been fired" by you search an attribute fired != null ? I'm not sure about your logic.
    If I understand your request, your LINQ Query is more than :
    IEnumerable<XElement> CashierElements =
    // Loop on <employees>
    from emps in xDoc.Root.Descendants("employees")
    // only 'cashier' type
    where (string)emps.Attribute("type") == "cashier"
    // Loop on <employee> in filtered <employees>
    from emp in emps.Elements("employee")
    // only the employee not fired
    where emp.Attribute("fired") == null
    // select the employee element
    select emp;
    Regards
    Yan Grenier
    Merci de bien vouloir "Marquer comme réponse", les réponses qui ont répondues à votre question, et de noter les réponses que vous avez trouvé utiles.

  • Where clause and NULLs

    I have an inventory table.
    I want to do the following query to determine
    how many systems have no category assigned to them.
    select count(hostname) from systable where category is null;
    It seems I can only create this statement if
    hostname is replaced by category but then you can't do a count on a null.....

    I can get it to display in a popup
    by just getting all rows displayed where
    category is null and then clicking on
    Sheet --> Count All Rows.
    But I'd like to include it in a Discover
    generated report.
    Mike
    ----

  • Where Clause in the Forms doesn't work

    Hi,
    I am trying to execute a query in base table block. The block property 'Query allowed' is TRUE and WHere clause is null;
    I used 'SET_BLOCK_PROPERTY' and set the where clause. Did a GO_BLOCK and EXECUTE_QUERY;
    The block brings all records as if there is no where clause. TO make sure I put up a message 'GET_BLOCK_PROPERTY' to see the where clause. It showed correct where clause.
    null

    Setting the where clause the way you did usually works, and it worked fine for me several times.
    Yet, a couple of days ago I ran into something that defies my logic:
    1) when using the "=" operator, it fetched me several records that satisfied the condition
    2) when using the "<=" or ">=" operator it fetched only one of the records that satisfied the condition: the one that is strictly equal.
    I tried using the pre-query trigger, but to no avail.
    I'm looking forward for your succes.
    null

  • ADF/UIX where clause and VO on different pages

    Hi,
    i have a VO called Periods which contains Periods and their statuses. On one page for entering data i use the periods VO in LOV mode with a where clause limiting the user to selecting periods with open status.
    I have another page which is for maintaining the period statuses. The problem is that when i move between entry and setup pages the where clause takes affect in both pages ie. the maintain periods page only shows periods with status Open!!
    To get around this on the maintain periods prepare model i tried doing this:
    actionContext.getBindingContainer().getApplicationModule().findViewObject("PeriodsView1").setWhereClause(null);
    actionContext.getBindingContainer().getApplicationModule().findViewObject("PeriodsView1").executeQuery();this works, however it causes bizarre behaviour on some records when i change values in the UIX editable table. The UIX editable table works fine if i remove the above code snippet (and dont go to the page that sets the where clause on the view object). The behaviour is that i cant select some rows in the UIX table properly and the updated values arent effected.
    can someone advise pn the proper way of doing this?

    Brenden, instead of setting the where clause to null, try setting it to an empty string (eg. "") or something dumb like "1=1".
    In turn place JDeveloper into debug mode by selecting your project properties, profiles, development, runner, and changing the java options to: -Djbo.debugoutput=console
    With this option turned on, you'll see your actual SQL going to the database with your where clause. You should be able to see the where clause of your underlying query that you just set, and if you use something dumb like 1=1 you'll note the setWhereClause module is working.
    Hope this helps.
    Cheers,
    CM.

  • Query SQL datastore with XML where clause source

    Hope I am in the right place.  New to Bus Obj Data Services Designer....I have cerated xml schemas, added it to the page as an xml source in.  Mapped a test xml file and all is well there.  I have added a query that grabs the xml.
    I need to then query the MS SQL datastore ans use  the data form the xml query as the where clause.  How is this done?  Or do I put a query on the datastore for all the data in a table then do anotehr query filtering one with the other?  seems like that would be rather heavy and low performance.  The results will then be sent back out as xml (schema and test file already set up as an xml out)
    Thanks!

    Thanks for the tips.
    I'm trying to implement this option, using your ViewDefHelper.
    I´m running into a problem though. After I create my dynamic View Object using a ViewDef, I need to create some view links.
    So I get the AttributeDefs of the columns (source, and destination) from the method findAttributeDef (which is the whole purpose of performance in my post). This method is returning the correct Attribute Def, but when I create the view Link with the method createViewLinkBetweenViewObjects(java.lang.String vlName,
    java.lang.String accessorName,
    ViewObject master,
    AttributeDef[] srcAttrs,
    ViewObject detail,
    AttributeDef[] destAttrs,
    java.lang.String assocClause)
    My destination query is generating the where clause as:
    null = ?
    Any Ideas what I'm doing wrong ?
    Thanks again.
    John.

  • Difference between column_name is null and column_name (+) is null in where clause.

    Hi All,
    I found the below condition in one of the code of my project.
    Select *
    From table name
    Where column_name ( + )  is null .
    Could any one explain what does column_name ( + ) in where clause.
    Thanks in advance.
    Regards,
    Jagadeeah

    Hi,
    Jagadeesh R wrote:
    Hi All,
    I found the below condition in one of the code of my project.
    Select *
    From table name
    Where column_name ( + )  is null .
    Could any one explain what does column_name ( + ) in where clause.
    Thanks in advance.
    Regards,
    Jagadeeah
    The  ( + )  sign is an old way of doing outer joins.  In Oracle 8 and earlier, you couldn't say
    SELECT  *
    FROM             scott.dept  d
    LEFT OUTER JOIN  scott.emp   e   ON  e.deptno  = d.deptno
    Instead, you got those results by saying:
    SELECT  *
    FROM    scott.dept  d
    ,       scott.emp   e
    WHERE   e.deptno  ( + ) = d.deptno
    The 1 line you posted was probably part of a larger WHERE clause.  You'll have a better understanding of what that 1 line is doing if you look at it in context, considering all the join conditions between the tables involved.

  • Function in where clause is executed and returns null instead a valid value

    Hi all
    i have a strange problem.
    There is a access-application where i have a pass-through-sql.
    This sql is fetching a foreign exchange rate from a history table which holds this rates for every day and i'm going to fetch the rate for the last day of the last month.
    Example of the fraction which does not work and which i executed directly on the DB, Oracle 11.2.0.3.0:
    select val
    ,last_day(add_months((trunc(sysdate)+3),-1)) tag
    from k.obj_ts_hist th
    where obj_id = 2660
    and eff_date = last_day(add_months((trunc(sysdate)+3),-1))
    --and      eff_date = '01-mar-2013'
    eff_date on table k.obj_ts_hist is defined as date.
    The function last_day in the where clause leads to null for both values in the select (val and tag).
    If i use eff_date = '01-mar-2013' it's all ok, i get the rigth values.
    I tested some combinations of the clause, e.g.
    eff_date = to_date(to_char(last_day(add_months((trunc(sysdate)+3),-1)),'YYYYMMDD'),'YYYYMMDD')
    or
    to_char(eff_date,'YYYYMMDD') = to_char(last_day(add_months((trunc(sysdate)+3),-1)),'YYYYMMDD') , etc., but all of them do not work.
    Also i tested the clause with select ... from dual, e.g.
    select eff_date from
    select last_day(add_months((trunc(sysdate)+3),-1)) eff_date from dual
    where eff_date = last_day(add_months((trunc(sysdate)+3),-1))
    This work's !
    A cross check on Oracle 9.2.0.8.0: it works as expected !
    Thanks in advance for your effort.
    Regards, Konrad

    a little simulation of your formula
    select the_date,last_day(add_months((trunc(the_date) + 3),-1)) eff_date
      from (select to_date('20130224','yyyymmdd') + level - 1 the_date
              from dual
            connect by level <= 7
           )reveals you might have been querrying future rates
    THE_DATE   EFF_DATE 
    24.02.2013 31.01.2013
    25.02.2013 31.01.2013
    26.02.2013 28.02.2013  /* future date */
    27.02.2013 28.02.2013  /* future date */
    28.02.2013 28.02.2013  /* current date */
    01.03.2013 28.02.2013
    02.03.2013 28.02.2013Regards
    Etbin

  • Use of DECODE and NULL value in a WHERE clause

    hi all,
    I came into an issue trying to use the DECODE function in a simple where clause.
    this is my test case
    CREATE TABLE tab_test (lev NUMBER, code VARCHAR2(10), val VARCHAR2(10));
    INSERT INTO tab_test VALUES (1, NULL, 'val11');
    INSERT INTO tab_test VALUES (1, NULL, 'val12');
    INSERT INTO tab_test VALUES (1, '13', 'val13');
    INSERT INTO tab_test VALUES (2, '21', 'val21');
    INSERT INTO tab_test VALUES (1, '22', 'val22');
    INSERT INTO tab_test VALUES (1, '23', 'val23');
    and this is the query
    SELECT * FROM tab_test WHERE code = DECODE(:lev,1,NULL,:cod)
    as you can see running this query, setting :lev to 1 will return an empty record set, instead of the expected first two rows (as it will be, running "select * from tab_test where code is null").
    is there a way to overcome this issue? thanks for help

    hi Frank,
    I can confirm that the queries do work when run on TOAD, but do not when they are put in the WHERE clause of my data block. I guess the problem relies on some data block setting; I should investigate on Forms forum.
    Anyway, here is my test case, including data and some examples. You can realize that it works good
    CREATE TABLE TAB_TEST
    LEV NUMBER,
    CODE VARCHAR2(10 BYTE),
    VAL VARCHAR2(10 BYTE)
    Insert into tab_test
    (LEV, CODE, VAL)
    Values
    (3, 'val21', 'val3_211');
    Insert into tab_test
    (LEV, CODE, VAL)
    Values
    (2, 'val21', 'val3_212');
    Insert into tab_test
    (LEV, VAL)
    Values
    (1, 'val11');
    Insert into tab_test
    (LEV, VAL)
    Values
    (1, 'val12');
    Insert into tab_test
    (LEV, VAL)
    Values
    (1, 'val13');
    Insert into tab_test
    (LEV, CODE, VAL)
    Values
    (2, 'val11', 'val21');
    Insert into tab_test
    (LEV, CODE, VAL)
    Values
    (2, 'val12', 'val22');
    Insert into tab_test
    (LEV, CODE, VAL)
    Values
    (2, 'val13', 'val23');
    COMMIT;
    SELECT * FROM TAB_TEST
    CONNECT
    BY PRIOR val = code
    START WITH (CASE
    WHEN :LIV = 1 AND code IS NULL THEN 'OK'
    WHEN :LIV != 1 AND code = :COD THEN 'OK'
    END = 'OK')
                   AND VAL = :V
    :LIV = 1
    :COD = [any]
    :V = 'val11'
    LEV     CODE     VAL
    1          val11
    2     val11     val21
    3     val21     val3_211
    3     val21     val3_212
    :LIV = 1
    :COD = [any]
    :V = 'val12'
    LEV     CODE     VAL
    1          val12
    2     val12     val22
    :LIV = 2
    :COD = 'val11'
    :V = 'val21'
    LEV     CODE     VAL
    2     val11     val21
    3     val21     val3_211
    2     val21     val3_212

  • Null global variable in block's WHERE clause - no records?

    I'm setting a :GLOBAL.emp_id in certain spots in my form. The EMPLOYEE block's WHERE clause says emp_id = :GLOBAL.emp_id. In the POST-QUERY, it sets that variable back to NULL so the next time they want to run a blind query, it will show all records.
    Well when the :GLOBAL.emp_id is NULL, nothing comes up in a blind query. I even changed the WHERE clause to say emp_id = NVL(:GLOBAL.emp_id,'') but that didn't do anything either.
    How can I get the WHERE clause to (basically) do nothing when that global variable is null? Or should I be messing with DEFAULT_WHERE instead of these global variables
    I'm in 6i

    I'm sorry - I stumbled on something soon after I posted and changed it to:
    emp_id = NVL(:GLOBAL.emp_id,emp_id)
    and it worked - duh

  • Merge with where clause after matched and unmatched

    Hai,
    Can anybody give me one example of merge statement with
    where clause after matched condition and after the unmatched condition.
    MERGE INTO V1 VV1
    USING (SELECT     A.CNO XXCNO, A.SUNITS XXSU, A.DDATE XXDD, XX.SUM_UNITS SUMMED
    FROM V1 A,
    (SELECT                
    SUM(SUNITS) SUM_UNITS FROM V1 B                                   
    GROUP BY CNO) c
    WHERE
    A.DDATE=0 AND A.SUNITS <>0 AND
    A.ROWID=(SELECT MAX(ROWID) FROM V1 )) XX
    ON (1=1)
    WHEN MATCHED THEN UPDATE SET
    VV1.SUNITS=XX.SUMMED
    WHERE XX.XXDD=0
    WHEN NOT MATCHED THEN INSERT
    (VV1.CNO, VV1.SUNITS, VV1.SUNITS)
    VALUES (XX.XXCNO, XX.XXSU, XX.XXDD)
    WHERE XX.XXDD<>0
    i am getting the error
    WHERE XX.XXDD=0
    ERROR at line 13:
    ORA-00905: missing keyword
    Thanks,
    Pal

    One of the example is there:
    http://download-west.oracle.com/docs/cd/B14117_01/server.101/b10759/statements_9016.htm#sthref7014
    What Oracle version do you use ?
    Besides the condition (1=1) is non-deterministic,
    I would expect there an exception like "unable to get a stable set of rows".
    Rgds.

  • The mechanics of the WHERE clause

    I’ve been out in industry for over 10 years now doing DB work most of that time. Lately I’ve been doing some work that is starting to challenge my long held assumptions about the internal workings of SQL Server, specifically what exactly is happening when
    I do joins and where clauses.
    I was explaining to someone that when doing a join putting in a where clause limits the amount of records that are available to do the join on thereby making the query faster. My thought was if a table has 100MM records but only 50MM of those meet the WHERE
    criteria then the JOIN clause wouldn’t try matching the 50MM records that don’t meet the WHERE clause.
    I did some work that afternoon and the empirical results didn’t match the expected outcome of a query I had written in terms of execution time. I don’t think my understanding of what goes on during a JOIN is correct. Can someone educate me?

    Here is how a SELECT works in SQL ... at least in theory.  Real products will optimize things, but the code has to produce the same results. 
     a) Effectively materialize the CTEs in the optional WITH clause. CTE's come into existence in the order they are declared so only backward references are
    alllowed. A CTE can be recursive. Think of them as VIEWs that exist only in the scope of the query. In practice, if they are used once then they are implemented as an in-line macro.
     b) Start in the FROM clause and build a working table from all of the joins, unions, intersections, and whatever other table constructors are there.  The <table expression> AS <correlation name> option allows you give a name to this working
    table which you then have to use for the rest of the containing query.  Ther are UNIONB, INTERSECT and EXCEPT set construtors, LATERAL tables, table-valued funcitosn and all kinds of things happening in here. 
     c) Go to the WHERE clause and remove rows that do not pass criteria; that is, that do not test to TRUE (i.e. reject UNKNOWN and FALSE).  The WHERE clause is applied to the working set in the FROM clause.  
     d) Go to the optional GROUP BY clause, partiton the original table into groups and reduce each grouping to a *single* row, replacing the original working table with the new grouped table. The rows of a grouped table must be only group characteristics:
    (1) a grouping column (2) a statistic about the group (i.e. aggregate functions) (3) a function or constant(4) an expression made up of only those three items.  The original table no longer exists and you cannot reference anything in it (this was an error
    in early Sybase products).  
     e) Go to the optional HAVING clause and apply it against the grouped working table; if there was no GROUP BY clause, treat the entire table as one group. 
     f) Go to the SELECT clause and construct the expressions in the list. This means that the scalar subqueries, function calls and expressions in the SELECT are done after all the other clauses are done.  The AS operator can also give names to expressions
    in the SELECT list.  These new names come into existence all at once, but after the WHERE clause, GROUP BY clause and HAVING clause have been executed; you cannot use them in the SELECT list or the WHERE clause for that reason. 
    If there is a SELECT DISTINCT, then redundant duplicate rows are removed.  For purposes of defining a duplicate row, NULLs are treated as matching (just like in the GROUP BY).  
     g) Nested query expressions follow the usual scoping rules you would expect from a block structured language like C, Pascal, Algol, etc.  Namely, the innermost queries can reference columns and tables in the queries in which they are contained.  
     h) The ORDER BY clause is part of a cursor, not a query. The result set is passed to the cursor, which can only see the names in the SELECT clause list, and the sorting is done there.  The ORDER BY clause cannot have expression in it, or references
    to other columns because the result set has been converted into a sequential file structure and that is what is being sorted.  
    As you can see, things happen "all at once" in SQL, not "from left to right" as they would in a sequential file/procedural language model. In those languages, these two statements produce different results:
      READ (a, b, c) FROM File_X;
      READ (c, a, b) FROM File_X;
    while these two statements return the same data:
    SELECT a, b, c FROM Table_X;
    SELECT c, a, b FROM Table_X;
    Think about what a confused mess this statement is in the SQL model.
    SELECT f(c2) AS c1, f(c1) AS c2 FROM Foobar;
    That is why such nonsense is illegal syntax.
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • Case statement in where clause ??

    Hello gurus,
    Can we use case statements in where clause ?? Any example will be great!
    And also i would like to know, besides CASE and DECODE statements, Is there any way we can use IF ELSE statements in SELECT clause or in WHERE clause ?
    Thank you!!

    Hi,
    user642297 wrote:
    Hoek,
    Thanks for the reply
    Whatever you return from 'then' should match your criteria.I didnt get this part...can you elaborate this part ?? Thank you!!Remember what a CASE expression does: it returns a single value in one of the SQL data types (or NULL).
    You're probably familiar with conditions such as
    WHERE   col = 1Inthe example above, col could be replaced by any kind of expression: a function call, and operation (such as "d * 24") or a CASE expression, which is exactly what Hoek posted:
    where  case
             when col = 6 then 1
             when col = 9 then 1
           end = 1;I think what Hoek meant about mnatching was this: since the CASE expression is being compared to a NUMBER, then every THEN clause (as well as the ELSE, if there is one) should return the same data type. You can't have one THEN clause return a NUMBER, and another one in the same CASE expression return a DATE, like this:
    where  case
             when col = 6 then 1
             when col = 9 then SYSDATE     -- WRONG! Raises ORA-00932: inconsistent datatypes
           end = 1; 
    By the way, it's rare when a CASE expression really helps in a WHERE clause. CASE is great for doing conitional stuff in places where you otherwise can't (in the ORDER BY clause, for example), but the WHERE clause was designed for conditions.
    Hoek was just trying to give a simple example. If you really wanted those results, it would be simpler to say:
    where  col = 6
    or     col = 9and simpler still to say
    where  col  IN (6, 9)

  • How to avoid OR's(too many) in WHERE clause????

    I have similar code(below given is a sample prepared by me) in one of the existing SP.
    dbo.[STUDENT] T1 INNER JOIN
    dbo.[COLLEGE] T2 INNER JOIN
    dbo.[DEPARTMENT] T3 INNER JOIN
    dbo.[EXAM] T4 
    WHERE T1.[student_id] = @student_id
    AND (
    (T1.[student_grade] = @GRADE_A)
    OR
    (T2.[college_location] = @COMP_CONTINENT_ASIA 
    AND T2.[college_country_cde] IN ('AFG', 'ARM', 'BAN', 'CHI', 'IND', 'ISR', 'JAP'))
    OR
    (T2.[college_location] = @COMP_CONTINENT_AFRICA
    AND T2.[college_country_cde] IN ('ALG', 'EGY', 'LIB', 'SUD', 'TUN', 'SOM'))
    AND ( T3.[dept_id]  <> @DEPT_ID_COMP
     OR 
    (T3.[dept_id]  = @DEPT_ID_COMP AND T4.[comp_exam_taken]  = 0))  
    AND (T3.[dept_id] <> @DEPT_ID_ELECT
    OR
    (T3.[dept_id] = @DEPT_ID_ELECT AND T4.[elect_exam_taken]  = 0)))
    AND ( T3.[dept_id] <> @DEPT_ID_MECH
    OR
    (T3.[dept_id]  = @DEPT_ID_MECH AND T4.[mech_exam_taken]  = 0 ))
    AND ( T3.[dept_id] <> @DEPT_ID_CHEM
    OR
    (T3.[dept_id]  = @DEPT_ID_CHEM AND T4.[chem_exam_taken]  = 0 ))
    AND ((T1.[student_status_cde] != @STU_STATUS_CODE_NEW) OR (T4.college_working_days IS NOT NULL AND T4.college_working_days > 90))
    I tried to remove the OR's by using UNION, but it is leading to have number of(almost 96) UNIONs which would't be accepted.  Can someone suggest a better approach to avoid using OR's in WHERE condition?
    Thanks in advance,
    Ravi

    Sometimes, business rules are complex, so there isn't always a way to simplify things.  Is your issue that it's complex and error prone, or is it performance due to the OR clauses?
    One possibility that will at least make it easier to test and debug is something like this:  (pseudocode)
    From Table1 Inner join Table2 on x=y etc.etc.
    CROSS APPLY
    (Select case when a=b and (c=d or e=f) then 1 else 0 end) as Situation1
    , case when h=i or j = k then 1 else 0 end) as situation2
    , case when l = m then 1 else 0 end) as situation 3
    ) as CA_Logic_Simplifier
    Where situation1 = 1 and situation2 = 1 and situation3 = 1
    Although you could say, "Hey, this is basically doing the same thing as before", this approach would be far easier to test and debug, because you can at a glance look at the values for situation1, 2, 3, etc. to see where errors are being introduced. 
    The cross apply makes the columns situation1/2/3 "instantiated", so they are usable in the where clause. Divide and conquer.  

Maybe you are looking for

  • Dual monitor issues

    Ok so (again) I'm trying to set up dual monitors. My laptop has no backlight so I use a normal CRT as output Section "ServerLayout" Identifier "X.org Configured" Screen 0 "Screen1" 0 0 Screen 1 "Screen0" LeftOf "Screen1" InputDevice "Keyboard0" "Core

  • Purchase order item(2lis_02_itm) and 0PUR_O01  transformation

    Hello, I'm trying to populate  DSO 0PUR_O01 with  standard DS 2LIS_02_ITM Purchase Order Items The mappings are not copied after BCT installation. so i have  trouble in mappings some of the  keyfigures of 0PUR_O01 with the extractor fields. It's conf

  • Unable to use the Copy function while submitting the program for XML output

    Hi when i submit the concurrent program with XML output type, getting the output.. when i submit he concurrent program using the copy button not able to get the output, my observation while submitting the program the xml template is not called.... Di

  • Apexlib tabular form with lov gining ora-00900

    Hi, When I add a tabular form with 3 items and chagne two of them to a LOV display item I get the following error: ORA-00900: invalid SQL statement Debug: 1: begin 2: --------------------------------------------- 3: -- Get metadata of page 4: -------

  • Can I change whfdhtml.htm WebHelp file inside RH Project?

    We have a Macintosh display issue with our Search pane. After researching it we found it is because the whfdhtml.htm file contains an if statement that sets the frameset at 85% for Macs. When I change it to 100% it displays correctly. Question: Can I