View with outer join results wrong number of rows

Hi,
When i run a query on a view it returns 2 rows(2 distinct rows), when i run the same query with the select statement which the view is created , it returns only 1 row. According to data the 1 row result is correct, how come twi results. A coding sample as follows. Any help is most appreciated.
I have a view created based on a outer join of two views in the format;
create or replace view view1 as
select ord.order_no order_no,
ord.del_type del_type,
det.qty qty
from detail_view det, order_view ord
where det.site(+) = ord.site
and det.part(+) = ord.part
and nvl(ord.del_type,'_NULL_') <> 'F'
with read only;
detail_view & order_view themselves have several group by/sum and union Alls.
When i run the query on this view
[Select * from View1 where order_no = 'A30' And del_type = 'B']
it returns 2 distinct rows. But when i run the select statement which created the View1 with the query it returns only one row!!
What did i do wrong?
Thanks
Sanjeewa

I cannot reproduce this :
SCOTT@LSC01> create table detail_view(qty number,site number,part number);
Table created.
SCOTT@LSC01> create table order_view(order_no varchar2(10), del_type varchar2(1), site number,part number);
Table created.
SCOTT@LSC01>
SCOTT@LSC01> create or replace view view1 as
  2  select ord.order_no order_no,
  3  ord.del_type del_type,
  4  det.qty qty
  5  from detail_view det, order_view ord
  6  where det.site(+) = ord.site
  7  and det.part(+) = ord.part
  8  and nvl(ord.del_type,'_NULL_') <> 'F'
  9  with read only;
View created.
SCOTT@LSC01>
SCOTT@LSC01> insert into order_view values ('A30','B',1,2);
1 row created.
SCOTT@LSC01> insert into order_view values ('A30','B',1,2);
1 row created.
SCOTT@LSC01>
SCOTT@LSC01> Select * from View1 where order_no = 'A30' And del_type = 'B';
ORDER_NO   D        QTY
A30        B
A30        B
SCOTT@LSC01>
SCOTT@LSC01> select ord.order_no order_no,
  2  ord.del_type del_type,
  3  det.qty qty
  4  from detail_view det, order_view ord
  5  where det.site(+) = ord.site
  6  and det.part(+) = ord.part
  7  and nvl(ord.del_type,'_NULL_') <> 'F' ;
ORDER_NO   D        QTY
A30        B
A30        Bwhat is your version?

Similar Messages

  • Group by with outer join

    Group by sum doesn't work with outer join. Can anyone please help me to get it right?
    I've posted some sample data and queries below:
    CREATE TABLE COMPLAINT
      CNO     NUMBER,
      REASON  VARCHAR2(15 BYTE),
      TOTAL   NUMBER
    Insert into COMPLAINT
       (CNO, REASON, TOTAL)
    Values
       (1, 'edge', 250);
    Insert into COMPLAINT
       (CNO, REASON, TOTAL)
    Values
       (2, 'edge', 250);
    Insert into COMPLAINT
       (CNO, REASON, TOTAL)
    Values
       (3, 'brst', 300);
    Insert into COMPLAINT
       (CNO, REASON, TOTAL)
    Values
       (4, 'crea', 400);
    COMMIT;
    CREATE TABLE SCOTT.COMPLAINTROLL
      CNO   NUMBER,
      ROLL  VARCHAR2(15 BYTE)
    SET DEFINE OFF;
    Insert into COMPLAINTROLL
       (CNO, ROLL)
    Values
       (2, 'roll22');
    Insert into COMPLAINTROLL
       (CNO, ROLL)
    Values
       (1, 'roll4');
    Insert into COMPLAINTROLL
       (CNO, ROLL)
    Values
       (1, 'roll3');
    Insert into COMPLAINTROLL
       (CNO, ROLL)
    Values
       (1, 'roll2');
    Insert into COMPLAINTROLL
       (CNO, ROLL)
    Values
       (1, 'roll1');
    COMMIT;
    select * from complaint
    CNO     REASON     TOTAL
    1     edge     250
    2     edge     250
    3     brst     300
    4     crea     400
    select * from complaintroll
    CNO     ROLL
    1     roll1
    1     roll2
    1     roll3
    1     roll4
    2     roll22
    -- total of reason code edge is 500
    select reason,sum(total)
    from complaint c
    group by reason
    REASON     SUM(TOTAL)
    brst     300
    crea     400
    edge     500
    -- total of reason code edge after outer join is 1250
    select reason,sum(total)
    from complaint c,complaintroll cr
    where c.cno=cr.cno(+)
    group by reason
    REASON     SUM(TOTAL)
    brst     300
    crea     400
    edge     1250
    {\code}
    Thanks for reading this post.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    The problem that you described is simple. The outer join duplicates all the rows from the parent table (complaint). If you want to sum a column from the parent table, then this sum includes all the duplicated rows.
    There are several solutions for this problem.
    A) One had been shown already by Cenutil. Instead of doing an outer join, you can do a subquery in the select clause that delivers the additional information from the detail table.
    SQL> select reason,
       sum(total),
       sum((select count(*) from complaintroll cr where c.cno=cr.cno)) cnt_rolls
    from complaint c
    group by c.reason;
    REASON          SUM(TOTAL)  CNT_ROLLS
    crea                   400          0
    brst                   300          0
    edge                   500          5b) sum in two steps. First sum and count including the join criteria, then use this information to calculate the correct total sum.
    SQL> select reason, sum(stotal), sum(stotal/scount), sum(scount), sum(cnt_rolls)
      2  from (select reason, sum(total) stotal, count(*) scount, count(cr.cno) cnt_rolls
      3         from complaint c
      4         left join complaintroll cr on c.cno=cr.cno
      5         group by reason, c.cno
      6         )
      7   group by reason;
    REASON          SUM(STOTAL) SUM(STOTAL/SCOUNT) SUM(SCOUNT) SUM(CNT_ROLLS)
    crea                    400                400           1              0
    brst                    300                300           1              0
    edge                   1250                500           5              5
    sql> c) another option is to do the left join, but do the aggregation only one time for the parent table. Analytic functions are helpful for that. However since analytic fuinctions can't be used inside an aggregation function, we would again need an inline view.
    SQL> select reason, sum(case when rn = 1 then total end) sum_total, count(*), count(crcno)
      2  from (select row_number() over (partition by c.reason order by c.cno) rn,
      3                   c.*, cr.cno crcno
      4         from complaint c
      5         left join complaintroll cr on c.cno=cr.cno
      6         )
      7  group by reason;
    REASON           SUM_TOTAL   COUNT(*) COUNT(CRCNO)
    brst                   300          1            0
    crea                   400          1            0
    edge                   250          5            5
    SQL> Edited by: Sven W. on Feb 10, 2011 1:00 PM - formatting + column added to 2nd option

  • Update with Outer Join, round 2

    Thanks for those of you who helped me out on the first one (I never thought that you could use a one-row SELECT like that).
    However, here is a new version of my problem:
    I have three tables.
    Table_1 has a column that needs to be updated based on values in Table_2 and Table_3.
    Both Table_1 and Table_2 have values used to determine which Table_3 row to use.
    However, not every Table_1 row has a corresponding Table_3 row, in which case the Table_3 value to use is assumed to be 1.
    The tables and corresponding columns are:
    TABLE_1
    value_1 - the value to be updated
    key_2 - a pointer to TABLE_2
    key_3a - a pointer to TABLE_3, or a dummy value if there is no corresponding TABLE_3 record
    TABLE_2
    key_2 - the primary key
    key_3b - a secondary pointer to TABLE_3
    value_2 - a value to be used in calculating TABLE_1.value_1
    TABLE_3
    key_3a - the first part of the unique key
    ley_3b - the second part of the unique key
    value_3 - a value to be used in calculating TABLE_1.value_1
    If there is a row in table_3 that matches the table_1.key_3a and table_2.key_3b values (where table_2.key_2 = table_1.key_2):
    set table_1.value_1 = table_2.value_2 * table_3.value_3
    If there is no such row in table_3:
    set table_1.value_1 = table_2.value_2
    I want to do something like this:
    UPDATE table_1 t1
    SET value_1 =
    SELECT t2.value_2 * NVL(t3.value_3, 1)
    FROM table_2 t2
    LEFT JOIN table_3 t3
    ON (t3.key_3b = t2.key_3b and t3.key_3a = t1.key_3a)
    WHERE t2.key_2 = t1.key_2
    However, Oracle does not allow t1 to be referenced in the ON clause of the outer join.
    (Assume that every key_2 value in table_1 is in table_2 as well - it is only the key_3 value that can be a dummy.)
    If I move "t3.key_3 = t1.key_3" to the WHERE clause, then t1.value_1 is null for rows without the corresponding table_3 value.
    I can do it with a clone of table_1 using ROWIDs:
    UPDATE table_1 t1
    SET value_1 =
    SELECT t2.value_2 * NVL(t3.value_3, 1)
    FROM table_1 t1a
    JOIN table_2 t2
    ON t2.key_2 = t1a.key_2
    LEFT JOIN table_3 t3
    ON (t3.key_3b = t2.key_3b and t3.key_3a = t1a.key_3a)
    WHERE t1a.row_id = t1.row_id
    However, is there an easier way to do this using ANSI joins (i.e. without (+) syntax)?
    I have this feeling I am missing something reasonably obvious here.

    ddelgran wrote:
    Thanks for those of you who helped me out on the first one (I never thought that you could use a one-row SELECT like that).
    I want to do something like this:
    UPDATE table_1 t1
    SET value_1 =
    SELECT t2.value_2 * NVL(t3.value_3, 1)
    FROM table_2 t2
    LEFT JOIN table_3 t3
    ON (t3.key_3b = t2.key_3b and t3.key_3a = t1.key_3a)
    WHERE t2.key_2 = t1.key_2
    However, Oracle does not allow t1 to be referenced in the ON clause of the outer join.
    (Assume that every key_2 value in table_1 is in table_2 as well - it is only the key_3 value that can be a dummy.)
    If I move "t3.key_3 = t1.key_3" to the WHERE clause, then t1.value_1 is null for rows without the corresponding table_3 value.
    I can do it with a clone of table_1 using ROWIDs:
    UPDATE table_1 t1
    SET value_1 =
    SELECT t2.value_2 * NVL(t3.value_3, 1)
    FROM table_1 t1a
    JOIN table_2 t2
    ON t2.key_2 = t1a.key_2
    LEFT JOIN table_3 t3
    ON (t3.key_3b = t2.key_3b and t3.key_3a = t1a.key_3a)
    WHERE t1a.row_id = t1.row_id
    However, is there an easier way to do this using ANSI joins (i.e. without (+) syntax)?
    I have this feeling I am missing something reasonably obvious here.You might want to refer to my post in your original thread how to use join views in updates. You can use ANSI join syntax there, too:
    Re: Update with Outer Join
    You would end up with something like this (note: untested):
    UPDATE
      SELECT t1.value_1, t2.value_2 * NVL(t3.value_3, 1) as new_val
      FROM table_1 t1
      INNER JOIN table_2 t2 ON (t2.key_2 = t1.key_2)
      LEFT JOIN table_3 t3
      ON (t3.key_3b = t2.key_3b and t3.key_3a = t1.key_3a)
    SET value_1 = new_val;And again the same restrictions regarding key-preserved tables apply as described in the post referred to.
    Regards,
    Randolf
    Oracle related stuff blog:
    http://oracle-randolf.blogspot.com/
    SQLTools++ for Oracle (Open source Oracle GUI for Windows):
    http://www.sqltools-plusplus.org:7676/
    http://sourceforge.net/projects/sqlt-pp/

  • Trim With Outer Join in where

    Getting an error called Invalid relational Operator
    SELECT DISTINCT t1.recv_order_no, t2.reference_no
    FROM receiving_order t1, receiver_num t2
    WHERE TRIM(t2.reference_no) (+) = TRIM (t1.recv_order_no)
    ORDER BY t2.reference_no ASC
    What I am doing wrong here ?
    Can I use trim fun with outer join ?
    Thanks for help.
    Srini

    Hi Srini,
    I have done this with emp and dept
    Following is an example:
      1  select a.deptno, b.ename
      2     from dept a, emp b
      3*   where trim(a.deptno) = trim(b.deptno(+))
    scott>/
        DEPTNO ENAME
            10 CLARK
            10 KING
            10 GHULAM
            10 MILLER
            20 SMITH
            20 ADAMS
            20 FORD
            20 SCOTT
            20 JONES
            30 ALLEN
            30 BLAKE
            30 MARTIN
            30 JAMES
            30 TURNER
            30 WARD
            40Hope this helps
    Ghulam

  • How to poll a blob using db adapter, with outer joins condition

    Hi All,
    We are trying to poll tables which contain column types as long and blob, we are using relationships in adapter and kept outer joins. by this we got select distinct t1.document .....etc
    distinct keyword cannot be used for blobs.
    is there any way to poll these tables having blob column types with outer joins.
    thanks a lot in advance,
    RR

    Hi,
    Procedure will be an explicit Invoke not Polling. If you can alter you design such that your BPEL process instead of polling gets triggered by some external entity (Java, PL/SQL, Scheduler, another BPEL etc.), you can put the data fetching logic in the procedure and call this procedure from your BPEL process to get the data. And your BPEL process is called periodically at an interval by an external entity.
    Also see if you can restrict the duplicate records at the database level itself. Polling, AFAIK, is limited in terms of customization and wouldn't be easy to customize. However, would like to learn a way if someone has.
    Regards,
    Neeraj Sehgal

  • Help requried with outer joins

    Hi All,
    I neeed a query help can any one please help me getting this done,
    for the below query
    select trunc(assumed_time_sql) AS date1,sum(rp.rebate_due)as sum1 from mn_date_dim dd ,mn_rebate_payment rp,mn_prc_program prc,mn_structured_doc sd
    where trunc(assumed_time_sql) in (TO_DATE('01-JUL-10','dd-mon-yy'),add_months(TO_DATE('01-JUL-10','dd-mon-yy'),-3),add_months(TO_DATE('01-JUL-10','dd-mon-yy'),-6),add_months(TO_DATE('01-JUL-10','dd-mon-yy'),-9))----input parameter
    AND trunc(dd.assumed_time_sql)=TRUNC(rp.start_date)
    AND prc.prc_program_id=rp.tiered_rebate_id
    AND sd.struct_doc_id=prc.struct_doc_id
    AND sd.struct_doc_id_num='M0000763'----input parameter
    group by trunc(assumed_time_sql);
    I am getting output as
    date1      sum1
    01-JAN-10      10
    01-APR-10     15
    01-JUL-10     20
    But i want my output to be as
    date1      sum1
    01-JAN-10      10
    01-APR-10     15
    01-JUL-10     20
    01-OCT-09 NULL
    I have tried with outer joins but this didn't help me
    Can any one please give me help in getting this done
    Thanks

    Hi,
    As SB pointed out, you'd better provide tables and data in order to be helped more efficiently.
    Anyway, you may want to investigate the use of NVL and/or DECODE so that you can translate NULL into valid values so they are returned to your select statement.
    HTH,
    Thierry
    Handle:  p78   
    Status Level:  Newbie (10) 
    Registered:  Mar 9, 2009 
    Total Posts:  60 
    Total Questions:  35 (30 unresolved)  Be kind to share your helpful / correct threads with other with marking them as ANSWERED
    Edited by: Urgent-IT on Feb 13, 2011 11:00 AM

  • Generate a where clause with outer join criteria condition: (+)=

    Hi,
    In my search page, I use Auto Customization Criteria mode, and I build where clause by using get Criteria():
    public void initSrpQuery(Dictionary[] dic, String userName) {
    int dicSize = dic.length;
    StringBuffer whereClause = new StringBuffer(100);
    Vector parameters = new Vector(5);
    int clauseCount = 0;
    int bindCount = 1;
    for(int i=0; i < dicSize; i++){
    String itemName = (String)(dic.get(OAViewObject.CRITERIA_ITEM_NAME));
    Object value = dic[i].get(OAViewObject.CRITERIA_VALUE);
    String joinCondition = (String)dic[i].get(OAViewObject.CRITERIA_JOIN_CONDITION);
    String criteriaCondition = (String)dic[i].get(OAViewObject.CRITERIA_CONDITION);
    String criteriaDataType = (String)dic[i].get(OAViewObject.CRITERIA_DATATYPE);
    String viewAttributename = (String)dic[i].get(OAViewObject.CRITERIA_VIEW_ATTRIBUTE_NAME);
    String columnName = findAttributeDef(viewAttributename).getColumnNameForQuery();
    if((value != null) /*&& (!("".equals((String).trim())))*/){
    if(clauseCount > 0){
    whereClause.append(" AND ");
    whereClause.append(columnName + " " + criteriaCondition + " :");
    whereClause.append(++bindCount);
    parameters.addElement(value);
    clauseCount++;
    If I want to generate following where clause:
    select
    ,emp.name
    ,emp.email
    ,emp.salesrep_number
    ,comp.name
    ,gs.srp_goal_header_id
    ,gs.status_code
    ,gs.start_date
    ,gs.end_date
    from g2c_goal_shr_emp_assignments_v emp
    ,jtf_rs_salesreps rs
    ,xxg2c_srp_goal_headers_all gs
    ,cn_comp_plans_all comp
    where 1 = 1
    and rs.salesrep_id = gs.salesrep_id (+)
    and gs.comp_plan_id = comp.comp_plan_id (+)
    and gs.period_year (+) = :1 -- :1 p_fiscal_year
    How can I generate a where clause with outer join : gs.period_year (+) = :1 ? Will I get '(+)=' from get(OAViewObject.CRITERIA_CONDITION)?
    thanks
    Lei

    If you are using SQL-Plus or Reports you can use lexical parameters like:
    SELECT * FROM emp &condition;
    When you run the query it will ask for value of condition and you can enter what every you want. Here is a really fun query:
    SELECT &columns FROM &tables &condition;
    But if you are using Forms. Then you have to change the condition by SET_BLOCK_PROPERTY.
    Best of luck!

  • How to use common object from two tables with out join.

    HI,
    I have two tables called A & B In A table i have the following objects
    1.weekend
    2.S1(measure)
    3.S2(measure)
    4.S3(measure)
    5.S4(measure)
    And In B table i have followning columns
    1.week end
    2.p1(measure)
    3.p2(measure)
    4.p3(measure)
    5.p4(measure)
    Now in universe i created all the measure objects i.e.s1,s2,s3,s4,p1,p2,p3,p4 A.weekend,B.weekend.
    instead of using week end two times i wnt to use only once because this is common in both table.
    if i use join between these tables i am getting values fine
    But With out join is there any thing to do in universe level to create common objects to use from both the tables..I tried using aggregate awareness but while reporting it is taking as two SQL.which is not synchronized.
    Please help me on this ...

    hi,
    Although  Weekend column is present in both tables, by creating a single Object in Universe, Universe can identify relationship with only table referenced in Object Creation.
    So, there will be no identification of relationship with other table measures.
    Obviously, you need to create 2 Weekend objects in Universe (in two classes).
    Case 1: You need not join these two tables in Universe. When you create 2 Queries in WEBI, automatcially Weekend objects are synchronized (if both are of same datatype)
    Case 2: If you join these two tables in Universe, Obviously,
    your SQL may contain Weekend from Table1, measures from Table 2
    or
    your SQL may contain Weekend from Table2, measures from Table 1
    Finally, You need to create 2 objects in Universe. But your query may contain a single Object based on Case 2.
    Regards,
    Vamsee

  • Need help with outer joins

    I have the following table structure,
    Table - 1_
    ID | Information
    1 | abcadskasasa
    2 | asdasdasdasd
    3 | saeqdfdvsfcsc
    Table - 2_
    ID | PID
    1 | 12
    1 | 13
    2 | 14
    1 | 15
    1 | 16
    2 | 12
    Table - 3_
    ID | PARID
    1 | 12
    2 | 14
    1 | 15
    Now I want to select for each ID in table 1, the count of number of PID from table 2 and count of number of PARID from table 3.
    Desired output:_
    ID | COUNT_PID | COUNT_PARID
    1 | 4 | 2
    2 | 2 | 1
    3 | 0 | 0
    Could anyone please help me out with this. I am trying to make use of outer joins, but as I work mostly on the front end so, not able to come up with a proper solution for the above.
    Thanks in advance,
    Tejas

    Hi, Tejas,
    You might have been doing the outer join correctly.
    There's another problem here: joining table_1 to two other tables with which it has a one-to-many relationship.
    If you were joining table_1 to just one other table, you could say:
    SELECT       t1.id
    ,       COUNT (t2.pid)     AS count_pid
    FROM              table_1     t1
    LEFT OUTER JOIN  table_2     t2     ON     t1.id     = t2.id
    GROUP BY  t1.id
    ORDER BY  t1.id;You could have done the exact same thing with table_3 instead of table_2.
    But you can't do the same thing with both table_2 and table_3 at the same time: that would be like cross-joining table_2 and table_3. Instead of showing id=1 having count_pid=4 and count_parid=2, you would get cout_pid=8 and count_parid=8 (since 8 = 4 * 2).
    You can do a separate GROUP BY on (at least) one of the tables.
    This gets the right results. In the main query, there is only one one-to-many relationship.
    WITH  t3_summary     AS
         SELECT    id
         ,       COUNT (parid)     AS count_parid
         FROM       table_3
         GROUP BY  id
    SELECT       t1.id
    ,       COUNT (t2.pid)     AS count_pid
    ,       MAX (t3.count_parid)     AS count_parid
    FROM              table_1     t1
    LEFT OUTER JOIN  table_2     t2     ON     t1.id     = t2.id
    LEFT OUTER JOIN      t3_summary     t3     ON     t1.id     = t3.id
    GROUP BY  t1.id
    ORDER BY  t1.id;

  • Question - View with a join based on two unequal strings.

    Hello -
    First my apologies for the likely novice question.
    I'm creating a view based on two tables as such:
    SELECT *
    FROM table1 LEFT OUTER JOIN table2 ON table1.string = table2.string AND table1.number = table2.number
    Problem: table1.string looks like "A00A01%%%" and table2.string looks like "A1" (which would correspond to "A00A01%%%".
    Question: Can I create the join based on the 4th and 6th character of the string = the other string, or should I create a view with a formula creating a new field and then create a second view? (Note: creating or changing the field in the original table is not an option).
    Thank you.

    Hi,
    Yes, you can do that. Join conditions don't have to be as simple as "ON a.col1 = b.col2"; they can involve functions, like CONCAT and SUBSTR.
    For example:
    FROM            table1
    LEFT OUTER JOIN table2
    ON              SUBSTR (table1.string, 4, 1)
                    ||
                    SUBSTR (table1.string, 6, 1) = table2.string
    ...The query might be faster if you create a function-based index on the join condition from table1. This does not require changing table1 itself. (For a LEFT OUTER JOIN, like this, it probably won't matter.)

  • Help with outer join

    I have two tables:
    PS and Entity whose data are as follows
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('26-DEC-08','DD-MON-RR HH.MI.SSXFF AM'),1);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('26-DEC-08','DD-MON-RR HH.MI.SSXFF AM'),3);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('26-DEC-08','DD-MON-RR HH.MI.SSXFF AM'),6);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('26-DEC-08','DD-MON-RR HH.MI.SSXFF AM'),10);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('26-DEC-08','DD-MON-RR HH.MI.SSXFF AM'),13);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('27-JAN-09','DD-MON-RR HH.MI.SSXFF AM'),13);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('27-JAN-09','DD-MON-RR HH.MI.SSXFF AM'),10);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('27-JAN-09','DD-MON-RR HH.MI.SSXFF AM'),6);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('27-JAN-09','DD-MON-RR HH.MI.SSXFF AM'),3);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('27-JAN-09','DD-MON-RR HH.MI.SSXFF AM'),1);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('26-FEB-09','DD-MON-RR HH.MI.SSXFF AM'),13);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('26-FEB-09','DD-MON-RR HH.MI.SSXFF AM'),10);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('26-FEB-09','DD-MON-RR HH.MI.SSXFF AM'),6);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('26-FEB-09','DD-MON-RR HH.MI.SSXFF AM'),3);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('26-FEB-09','DD-MON-RR HH.MI.SSXFF AM'),1);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('30-MAR-09','DD-MON-RR HH.MI.SSXFF AM'),1);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('30-MAR-09','DD-MON-RR HH.MI.SSXFF AM'),3);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('30-MAR-09','DD-MON-RR HH.MI.SSXFF AM'),6);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('30-MAR-09','DD-MON-RR HH.MI.SSXFF AM'),10);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('30-MAR-09','DD-MON-RR HH.MI.SSXFF AM'),13);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('28-APR-09','DD-MON-RR HH.MI.SSXFF AM'),13);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('28-APR-09','DD-MON-RR HH.MI.SSXFF AM'),10);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('28-APR-09','DD-MON-RR HH.MI.SSXFF AM'),6);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('28-APR-09','DD-MON-RR HH.MI.SSXFF AM'),3);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('28-APR-09','DD-MON-RR HH.MI.SSXFF AM'),1);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('29-MAY-09','DD-MON-RR HH.MI.SSXFF AM'),14);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('29-MAY-09','DD-MON-RR HH.MI.SSXFF AM'),9);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('29-MAY-09','DD-MON-RR HH.MI.SSXFF AM'),13);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('29-MAY-09','DD-MON-RR HH.MI.SSXFF AM'),10);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('29-MAY-09','DD-MON-RR HH.MI.SSXFF AM'),6);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('29-MAY-09','DD-MON-RR HH.MI.SSXFF AM'),3);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('29-MAY-09','DD-MON-RR HH.MI.SSXFF AM'),1);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('26-JUN-09','DD-MON-RR HH.MI.SSXFF AM'),13);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('26-JUN-09','DD-MON-RR HH.MI.SSXFF AM'),10);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('26-JUN-09','DD-MON-RR HH.MI.SSXFF AM'),6);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('26-JUN-09','DD-MON-RR HH.MI.SSXFF AM'),3);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('26-JUN-09','DD-MON-RR HH.MI.SSXFF AM'),1);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('28-JUL-09','DD-MON-RR HH.MI.SSXFF AM'),14);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('28-JUL-09','DD-MON-RR HH.MI.SSXFF AM'),9);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('28-JUL-09','DD-MON-RR HH.MI.SSXFF AM'),13);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('28-JUL-09','DD-MON-RR HH.MI.SSXFF AM'),10);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('28-JUL-09','DD-MON-RR HH.MI.SSXFF AM'),6);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('28-JUL-09','DD-MON-RR HH.MI.SSXFF AM'),3);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('28-JUL-09','DD-MON-RR HH.MI.SSXFF AM'),1);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('26-AUG-09','DD-MON-RR HH.MI.SSXFF AM'),14);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('26-AUG-09','DD-MON-RR HH.MI.SSXFF AM'),9);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('26-AUG-09','DD-MON-RR HH.MI.SSXFF AM'),13);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('26-AUG-09','DD-MON-RR HH.MI.SSXFF AM'),10);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('26-AUG-09','DD-MON-RR HH.MI.SSXFF AM'),6);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('26-AUG-09','DD-MON-RR HH.MI.SSXFF AM'),3);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('26-AUG-09','DD-MON-RR HH.MI.SSXFF AM'),1);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('25-SEP-09','DD-MON-RR HH.MI.SSXFF AM'),14);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('25-SEP-09','DD-MON-RR HH.MI.SSXFF AM'),9);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('25-SEP-09','DD-MON-RR HH.MI.SSXFF AM'),13);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('25-SEP-09','DD-MON-RR HH.MI.SSXFF AM'),10);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('25-SEP-09','DD-MON-RR HH.MI.SSXFF AM'),6);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('25-SEP-09','DD-MON-RR HH.MI.SSXFF AM'),3);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('25-SEP-09','DD-MON-RR HH.MI.SSXFF AM'),1);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('26-OCT-09','DD-MON-RR HH.MI.SSXFF AM'),14);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('26-OCT-09','DD-MON-RR HH.MI.SSXFF AM'),9);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('26-OCT-09','DD-MON-RR HH.MI.SSXFF AM'),13);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('26-OCT-09','DD-MON-RR HH.MI.SSXFF AM'),10);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('26-OCT-09','DD-MON-RR HH.MI.SSXFF AM'),6);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('26-OCT-09','DD-MON-RR HH.MI.SSXFF AM'),3);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('26-OCT-09','DD-MON-RR HH.MI.SSXFF AM'),1);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('24-NOV-09','DD-MON-RR HH.MI.SSXFF AM'),14);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('24-NOV-09','DD-MON-RR HH.MI.SSXFF AM'),9);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('24-NOV-09','DD-MON-RR HH.MI.SSXFF AM'),13);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('24-NOV-09','DD-MON-RR HH.MI.SSXFF AM'),10);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('24-NOV-09','DD-MON-RR HH.MI.SSXFF AM'),6);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('24-NOV-09','DD-MON-RR HH.MI.SSXFF AM'),3);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('24-NOV-09','DD-MON-RR HH.MI.SSXFF AM'),1);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('25-DEC-09','DD-MON-RR HH.MI.SSXFF AM'),9);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('25-DEC-09','DD-MON-RR HH.MI.SSXFF AM'),13);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('25-DEC-09','DD-MON-RR HH.MI.SSXFF AM'),10);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('25-DEC-09','DD-MON-RR HH.MI.SSXFF AM'),6);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('25-DEC-09','DD-MON-RR HH.MI.SSXFF AM'),3);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('25-DEC-09','DD-MON-RR HH.MI.SSXFF AM'),1);
    Insert into PS (DATE_TIME,ENTITY_ID) values (to_timestamp('25-DEC-09','DD-MON-RR HH.MI.SSXFF AM'),14);
    Entity:
    Insert into ENTITY (ENTITY_ID,ENTITY_ADDRESS) values (1,'AAA');
    Insert into ENTITY (ENTITY_ID,ENTITY_ADDRESS) values (3,'CCC');
    Insert into ENTITY (ENTITY_ID,ENTITY_ADDRESS) values (6,'DDD');
    Insert into ENTITY (ENTITY_ID,ENTITY_ADDRESS) values (9,'EEE');
    Insert into ENTITY (ENTITY_ID,ENTITY_ADDRESS) values (10,'FFF');
    Insert into ENTITY (ENTITY_ID,ENTITY_ADDRESS) values (13,'GGG');
    Insert into ENTITY (ENTITY_ID,ENTITY_ADDRESS) values (14,'HHH');
    I want to display data for each entity available in entity table
    What is wrong with this query??
    Select ps.date_time,ps.entity_id,et.entity_id from entity et left outer join PS ps on (et.entity_id = ps.entity_id)
    This query gives me result like
    26-DEC-08     1     1
    26-DEC-08     3     3
    26-DEC-08     6     6
    26-DEC-08     10     10
    26-DEC-08     13     13
    27-JAN-09     13     13
    27-JAN-09     10     10
    27-JAN-09     6     6
    27-JAN-09     3     3
    27-JAN-09     1     1...
    But for 26-Dec-08, i want to display
    26-DEC-08     1     1
    26-DEC-08     3     3
    26-DEC-08     6     6
    26-DEC-08     10     10
    26-DEC-08     13     13
    26-DEC-08 NULL 9
    26-DEC-09 NULL 14
    27-JAN-09     13     13
    27-JAN-09     10     10
    27-JAN-09     6     6
    27-JAN-09     3     3
    27-JAN-09     1     1
    But the unmatching ids are not displaying when i am using the outer join..please help me..

    Almost there.
    In this case you need a partitioned outer join, partitioning by date_time:
    SQL> Select ps.date_time
      2       , ps.entity_id
      3       , et.entity_id
      4    from ps partition by (ps.date_time)
      5         right outer join entity et on (et.entity_id = ps.entity_id)
      6  /
    DATE_TIME                                 ENTITY_ID  ENTITY_ID
    26-12-08 00:00:00,000000                          1          1
    26-12-08 00:00:00,000000                          3          3
    26-12-08 00:00:00,000000                          6          6
    26-12-08 00:00:00,000000                                     9
    26-12-08 00:00:00,000000                         10         10
    26-12-08 00:00:00,000000                         13         13
    26-12-08 00:00:00,000000                                    14
    27-01-09 00:00:00,000000                          1          1
    27-01-09 00:00:00,000000                          3          3
    27-01-09 00:00:00,000000                          6          6
    27-01-09 00:00:00,000000                                     9
    27-01-09 00:00:00,000000                         10         10
    27-01-09 00:00:00,000000                         13         13
    27-01-09 00:00:00,000000                                    14
    26-02-09 00:00:00,000000                          1          1
    26-02-09 00:00:00,000000                          3          3
    26-02-09 00:00:00,000000                          6          6
    26-02-09 00:00:00,000000                                     9
    26-02-09 00:00:00,000000                         10         10
    26-02-09 00:00:00,000000                         13         13
    26-02-09 00:00:00,000000                                    14
    30-03-09 00:00:00,000000                          1          1
    30-03-09 00:00:00,000000                          3          3
    30-03-09 00:00:00,000000                          6          6
    30-03-09 00:00:00,000000                                     9
    30-03-09 00:00:00,000000                         10         10
    30-03-09 00:00:00,000000                         13         13
    30-03-09 00:00:00,000000                                    14
    28-04-09 00:00:00,000000                          1          1
    28-04-09 00:00:00,000000                          3          3
    28-04-09 00:00:00,000000                          6          6
    28-04-09 00:00:00,000000                                     9
    28-04-09 00:00:00,000000                         10         10
    28-04-09 00:00:00,000000                         13         13
    28-04-09 00:00:00,000000                                    14
    29-05-09 00:00:00,000000                          1          1
    29-05-09 00:00:00,000000                          3          3
    29-05-09 00:00:00,000000                          6          6
    29-05-09 00:00:00,000000                          9          9
    29-05-09 00:00:00,000000                         10         10
    29-05-09 00:00:00,000000                         13         13
    29-05-09 00:00:00,000000                         14         14
    26-06-09 00:00:00,000000                          1          1
    26-06-09 00:00:00,000000                          3          3
    26-06-09 00:00:00,000000                          6          6
    26-06-09 00:00:00,000000                                     9
    26-06-09 00:00:00,000000                         10         10
    26-06-09 00:00:00,000000                         13         13
    26-06-09 00:00:00,000000                                    14
    28-07-09 00:00:00,000000                          1          1
    28-07-09 00:00:00,000000                          3          3
    28-07-09 00:00:00,000000                          6          6
    28-07-09 00:00:00,000000                          9          9
    28-07-09 00:00:00,000000                         10         10
    28-07-09 00:00:00,000000                         13         13
    28-07-09 00:00:00,000000                         14         14
    26-08-09 00:00:00,000000                          1          1
    26-08-09 00:00:00,000000                          3          3
    26-08-09 00:00:00,000000                          6          6
    26-08-09 00:00:00,000000                          9          9
    26-08-09 00:00:00,000000                         10         10
    26-08-09 00:00:00,000000                         13         13
    26-08-09 00:00:00,000000                         14         14
    25-09-09 00:00:00,000000                          1          1
    25-09-09 00:00:00,000000                          3          3
    25-09-09 00:00:00,000000                          6          6
    25-09-09 00:00:00,000000                          9          9
    25-09-09 00:00:00,000000                         10         10
    25-09-09 00:00:00,000000                         13         13
    25-09-09 00:00:00,000000                         14         14
    26-10-09 00:00:00,000000                          1          1
    26-10-09 00:00:00,000000                          3          3
    26-10-09 00:00:00,000000                          6          6
    26-10-09 00:00:00,000000                          9          9
    26-10-09 00:00:00,000000                         10         10
    26-10-09 00:00:00,000000                         13         13
    26-10-09 00:00:00,000000                         14         14
    24-11-09 00:00:00,000000                          1          1
    24-11-09 00:00:00,000000                          3          3
    24-11-09 00:00:00,000000                          6          6
    24-11-09 00:00:00,000000                          9          9
    24-11-09 00:00:00,000000                         10         10
    24-11-09 00:00:00,000000                         13         13
    24-11-09 00:00:00,000000                         14         14
    25-12-09 00:00:00,000000                          1          1
    25-12-09 00:00:00,000000                          3          3
    25-12-09 00:00:00,000000                          6          6
    25-12-09 00:00:00,000000                          9          9
    25-12-09 00:00:00,000000                         10         10
    25-12-09 00:00:00,000000                         13         13
    25-12-09 00:00:00,000000                         14         14
    91 rijen zijn geselecteerd.Partitioned outer join became available somewhere during version 10. They are described here: http://download.oracle.com/docs/cd/B28359_01/server.111/b28314/tdpdw_sql.htm#TDPDW00736
    Regards,
    Rob.

  • Problem with outer join/insert

    I created a test case in scott schema that describes my problem. I use emp table, and I want to have one more table - emp_info - that will store some additional info about employees. Not every employee will have additional info. I can't add a field to emp table - this has to be in an additional table.
    I want to display all the emp's in a swing table, and an info if it exists - of course, using outer join. Further more, I want users to be able to enter info in this same table. If info already exists in the emp_info it will be updated, if not a new record is created.
    I hope you get the picture.
    So, emp_info table is:
    create table emp_info(empno number(4), info varchar2(10))
    ALTER TABLE "SCOTT"."EMP_INFO"
    ADD (CONSTRAINT "PK_EMP_INFO" PRIMARY KEY("EMPNO"))
    ALTER TABLE "SCOTT"."EMP_INFO"
    ADD (CONSTRAINT "FK_EMP_INFO_EMP" FOREIGN KEY("EMPNO")
    REFERENCES "SCOTT"."EMP"("EMPNO"))
    In Jdev I create entitiy objects for emp and emp_info, and create View object 'ViewOuter' using these two entities. emp is updatable and empinfo is updatable and reference.
    SQL query for the view object is:
    SELECT Emp.EMPNO, Emp.ENAME, Emp.JOB, Emp.MGR, Emp.HIREDATE,
    Emp.SAL, Emp.COMM, Emp.DEPTNO, EmpInfo.EMPNO AS EMPNO1,
    EmpInfo.INFO
    FROM EMP Emp, EMP_INFO EmpInfo
    WHERE Emp.EMPNO = EmpInfo.EMPNO(+)
    I changed View row class of the ViewOuter view:
    public void setInfo(String value) {
    if (getEmpno1()==null) {
    setEmpno1(getEmpno());
    setAttributeInternal(INFO, value);
    Now I create the table in swing. It works fine - if a user changes info, new record is created or existing updated etc. There is only one problem:
    If I change info on an employee, and then requery the view without commiting to the database, I don't see this info. If I try to change it, I get error
    (oracle.jbo.TooManyObjectsException) JBO-25013: Too many objects match the primary key oracle.jbo.Key[7499 ].
    It seams that the new info is cached, but requerying the view didn't pick it up. And when it creates new row for info PK is violated.
    How can I avoid this?

    I set up the primari key for emp_info like this:
    public void setInfo(String value) {
    if (getEmpno1()==null) {
    setEmpno1(getEmpno());
    setAttributeInternal(INFO, value);
    It's set when the user enters info.
    What is the difference between transaction.commit and transaction.postChanges?
    Posting changes looks like good temp solution. How can I change view object, so it calls postchanges before executing query? Since I can do requery on multiple places in application, this should be handled by the view itself.
    Is there any better way?

  • SAP QUERY/INFOSET with OUTER JOIN

    Hi,
    I have created an infoset (SQ02) using two tables for SAP query.
    Table: AGR_TEXTS. Fields: AGR_NAME, SPRAS, LINE, TEXT.
    TABLE: AGR_FLAGS. Fields: AGR_NAME, FLAG_TYPE, FLAG_VALUE.
    Joined these two tables using outer join.  Defined the join condition as AGR_NAME = AGR_NAME.  Saved and Generated the infoset.
    Created SAP Query (SQ01) using the above created infoset.
    In the basic list,
    Marked AGR_NAME (AGR_TEXTS), TEXT, FLAG_VALUE as listed fields.
    Marked AGR_NAME (AGR_TEXTS), SPRAS, LINE, FLAG_TYPE as selection fields.
    Save the query.  When execute the query provided the inputs for all the selection fields in the selection screen as given below:
    AGR_NAME=Z*
    SPRAS=E
    LINE=00000
    FLAG_TYPE=LICENSE_01
    Executed the Query. 
    Got the results only the matched records as per the selection field FLAG_TYPE.
    But I want all the records from table AGR_TEXTS and matched records from table AGR_FLAGS.
    I want the report (output) as below,
    _AGR_NAME                                               TEXT                                                                                  FLAG_VALUE_
    ZCA_BASIC_ACCESS_GLOBAL     Non-critical basic access for all users.                                       53
    ZCA_BASIC_ENDUSER_ACCESS     UK:CA Basic Enduser Access     
    ZCA_BASIC_ENDUSER_ACCESS_UK     UK:CA Basic Enduser Access UK                                        52
    ZCA_BASIC_ENDUSER_SU52_UK     UK:CA Basic Enduser Access to change Parameter ID's     
    But I got the report (output) as below, 
    _AGR_NAME                                                TEXT                                               FLAG_VALUE_
    ZCA_BASIC_ACCESS_GLOBAL     Non-critical basic access for all users.     53
    ZCA_BASIC_ENDUSER_ACCESS_UK     UK:CA Basic Enduser Access UK     52
    Apprecited your help. Thanks.
    Code Formatted by: Alvaro Tejada Galindo on Dec 30, 2009 2:20 PM

    Identify a KF for which there are non-zero values for all accounts in the cube.
    Create the query with Account (from MP coming from both IO and cube) and this KF. KF will have 0 values for accounts not existing in the cube. Create a condition to show only the 0 value for the KF. This should show you all the accounts in the IO which are not in the cube.

  • Use of db link in subquery with outer join

    I have a query where i am using db link to get data from another database.
    I have an outer join where i am using a subquery using the same db link but it fails gives me the error:
    ORA-00991: illegal use of LONG datatype.
    But the same query with inner join is not giving me the error.
    Is this a limitation of Oracle or am I doing something wrong.

    This is an example of what i am running. That last outer join does not work c.acad_plan(+).
    select count(1)
    from ( select a.* from cb001_tbl a where a.strm='1800' ) a ,
    ( select distinct emplid,national_id,strm, acad_plan, acad_career from ps_uhcb_001@SAPRD where institution='00730') b ,
    ( select * from ps_acad_plan_tbl@SAPRD a
    where a.institution='00730'
    and a.eff_status='A'
    and a.effdt=(select max(b.effdt) from ps_acad_plan_tbl@SAPRD b
    where a.institution=b.institution
    and a.acad_plan=b.acad_plan
    and b.effdt<=to_date(20100514,'yyyymmdd'))) c
    where a.stdnt_id=b.national_id (+)
    and a.strm=b.strm (+)
    and b.acad_plan=c.acad_plan (+)

  • How do I update a view with a join

    I have a module with database block based on a view with joins, so I am not able to perform insert, update & delete directly.
    Therefore I created an unbound item that can be changed. The relevant database record is searched and updated.
    So, with above work around, insert, update & delete is possible.
    This works just fine.
    Now, the 'save icon' in the menu (diskette icon), does not get activated automatically when there are changes to be saved. This is because the view is not changed.
    So, I enable the 'save icon' manually in the when-validate-item trigger. But now when I navigate to another record, the 'save icon' gets de-activated by QMS/headstart code. This is because the view is not changed.
    So, I tried set_record_property (CHANGED_STATUS) to let the application
    know there are changes to be saved.
    But then, I get an error:
    * FRM-40654: Record has been updated by another user. Re-query block to see
    change.
    What is the proper way to handle this problem?
    null

    Peter,
    I think you've gone down the wrong track with your workaround.
    You should base your form on the view and allow update and insert to the view just as if it was a table.
    If you are using Oracle 8i, create an INSTEAD-OF trigger on the view in the database which redirects the DML to insert or update the appropriate table(s) instead of the view.
    If you are pre Oracle 8i, in the form you can create on-insert, on-update, and on-delete triggers to redirect the DML to the appropriate table.
    The only other tricky situation comes if you have items in your form that are server-derived (in the TAPI) of the table(s) in question. If so, you must explicitly code the form to retrieve these server-derived values. Also note that with a view, you cannot have a server derived primary key since there would be no way to retrieve it in the form. (Views don't have a rowid.) You must derive primary key columns in the form when the form is based on the view.
    Regards,
    Lauri

Maybe you are looking for

  • Connecting SAP R/3 to Xcelsius dashboard

    Hi all,      I've a requirement where I have some reports in SAP R/3 and based on those reports I need to build a single Xcelsius dashboard.  What I know is I have to use Crystal Reports which fetches the data from R/3 tables and in turn use these Cr

  • Communication between 2 servlets

    Hi, I’ve a problem. Not sure if it’s a simple one. I have a web app with servlets (say Servlet1, Servlet2, etc.) in it. I use a SQL query in Servlet1 and fetch an employee’s information (say empinfo) from the database. This is a string value. Now, I

  • X2-01 newer version firmware problem

    Can we replace new firmware to older?? If there is solution plzzz tell me..!

  • UDF for Date -7 days

    Hi everyone I am fairly new to Java and PI, and I have to create a UDF that takes the currentDate and subtracts 7 days. I was just wondering the best way to go about this with java? Thank You

  • Missing Files in Feb. 2010 Device Drivers installer

    I have downloaded the February 2010 several times.  Each time I try to run the installer, I get several error messages saying that installation files are missing.  Has anyone else had these issues?  Is there a workaround for it? Solved! Go to Solutio