Parameter in inline view

Hi All,
There is a requirement to change oracle report (rdf) to discoverer. The report query has parameters in inline views which are used as tables (a and b below).
For example:
SELECT a.1,a.2,b.1,b.2
FROM
( select 1,2... from c where c.sth=:Parameter1) a
,( select 1,2... from d where d.sth between :Parameter2 and :parameter3) b
Now that, c.sth or d.sth are not available in select clause, How do i apply the parameters from discoverer desktop.
Also, is there any approach i can follow to solve the same.

Hi,
You can use non-mandatory parameters in a condition but if for some reason a non-mandatory parameter is not available then the user will have to enter a dummy value when the parameter is not used. For example, you could add ALL to the list of values and use a condition like DECODE(param:, 'ALL', column, :param) = column. You can then make the parameter mandatory and the users enter ALL if they don't want to use the parameter.
Hope that helps,
Rod West

Similar Messages

  • How to use Parameter in inline view

    I want to deploye following sql in discoveror. Problem is that how to use the P_TO_DATE in disco.
    select papf.employee_number, papf.effective_start_date, papf.effective_end_date, paaf.effective_start_date, paaf.effective_end_date,
    (select peev.screen_entry_value
    from pay_element_types_f pet,
    pay_element_classifications pec,
    pay_input_values_f piv,
    pay_element_entries_f pee,
    pay_element_entry_values_f peev
    where pet.classification_id = pec.classification_id
    and pet.processing_type = 'R'
    and pec.classification_name = 'Earnings'
    and piv.name in ('Monthly Amount')
    and pet.ELEMENT_TYPE_ID = piv.ELEMENT_TYPE_ID
    and pet.element_type_id = pee.element_type_id
    and piv.INPUT_VALUE_ID = peev.INPUT_VALUE_ID
    and pet.ELEMENT_NAME = 'Basic Salary'
    and pee.ELEMENT_ENTRY_ID = peev.ELEMENT_ENTRY_ID
    and pee.assignment_id = paaf.assignment_id
    and pee.effective_start_date <= :P_TO_DATE and pee.effective_end_date >= :P_TO_DATE
    and peev.effective_start_date <= :P_TO_DATE and peev.effective_end_date >= :P_TO_DATE ) Basic_Salary
    from per_assignments_f paaf, per_people_f papf
    where papf.person_id = paaf.person_id
    and papf.employee_number = '101111'

    Hi,
    What you can do is to change the query so that the parameters will be in the where clause and then you can define the condition with the parameter in the dicoverer worksheet.
    Use the following code instead of your own:
    select papf.employee_number,
    papf.effective_start_date,
    papf.effective_end_date,
    paaf.effective_start_date,
    paaf.effective_end_date,
    Basic_Salary.p_start_date1, ---> create the conditions on those fields
    Basic_Salary.p_start_date2,
    Basic_Salary.p_end_date1,
    Basic_Salary.p_end_date2
    from per_assignments_f paaf,
    per_people_f papf,
    (select peev.screen_entry_value,
    pee.assignment_id,
    pee.effective_start_date p_start_date1, --parameter
    pee.effective_end_date p_end_date1, --parameter
    peev.effective_start_date p_start_date2,--parameter
    peev.effective_end_date p_end_date2
    from pay_element_types_f pet,
    pay_element_classifications pec,
    pay_input_values_f piv,
    pay_element_entries_f pee,
    pay_element_entry_values_f peev
    where pet.classification_id = pec.classification_id
    and pet.processing_type = 'R'
    and pec.classification_name = 'Earnings'
    and piv.name in ('Monthly Amount')
    and pet.ELEMENT_TYPE_ID = piv.ELEMENT_TYPE_ID
    and pet.element_type_id = pee.element_type_id
    and piv.INPUT_VALUE_ID = peev.INPUT_VALUE_ID
    and pet.ELEMENT_NAME = 'Basic Salary'
    and pee.ELEMENT_ENTRY_ID = peev.ELEMENT_ENTRY_ID
    ) Basic_Salary
    where papf.person_id = paaf.person_id
    and Basic_Salary.assignment_id = paaf.assignment_id
    --and Basic_Salary.p_start_date1 <= :P_TO_DATE
    --and Basic_Salary.p_start_date2 <= :P_TO_DATE
    --and Basic_Salary.p_end_date1 >= :P_TO_DATE
    --and Basic_Salary.p_end_date2 >= :P_TO_DATE
    --and papf.employee_number = '101111'                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Passing a value to Inline View  WHERE clause through JDev...

    Hi ,
    I need to pass a value to inline view which is mentioned in below VIEW query.
    That view is created inside a view using jDev. Note that there are two WHERE clauses one in the Main query and the other in the Inline view.
    How to set the value for the innerView.
    //copied the code from Java
    view.volAlertsHistroyView.setWhereClauseParam(1, new Integer(clientId));
    Gives an error Missing IN or OUT parameter at index:: 1
    SELECT Alerts.SEND_TIME,
         Alerts.STATUS,
         Alerts.TEXT ,
         Groups.NAME,
              VolRoles.ROLE_NAME,
                   VolRoles.ID as vid,
                   Groups.ID as gid
         FROM ALERTS Alerts, ALERTS_GROUPS AlertsGroups, GROUPS Groups, VOL_ROLES VolRoles,
    --Inline view starts
    (SELECT GRP_ID, VRL_ID FROM vol_groups WHERE cli_id = :1) user_group_role
    --Inline view ends
    --Actual WHERE clause starts
         WHERE ((Alerts.ID = AlertsGroups.ALT_ID)AND (AlertsGroups.GRP_ID = Groups.ID))AND (AlertsGroups.VRL_ID = VolRoles.ID)
         AND AlertsGroups.VRL_ID = user_group_role.VRL_ID AND AlertsGroups.GRP_ID = user_group_role.GRP_ID
    Please get back to me .
    Regards
    Mohan
    [email protected]

    What happens when you change your Java code to:
    view.volAlertsHistroyView.setWhereClauseParam(0, new Integer(clientId));
    The ":1" does not directly relate to the where clause param index you use in Java. In your query you could also use a ":2" for example. In BC4J you still use "0" for the first param.
    Sascha

  • Tuning query with inline views

    Hi!
    I have a performance problem with the following query. I try to combine v1 and v2 into one inline view but because of the recursive design of the tables workflow and workflow_node it didn't work.
    Does anybody has an idea for tuning this query?
    SELECT distinct v1.u_protocol_id
       FROM ( SELECT workflow_node.workflow_id,u_protocol.u_protocol_id
                   FROM workflow_node,workflow,U_protocol
                   WHERE workflow.workflow_id=workflow_node.workflow_id
                     AND u_protocol.u_protocol_id = workflow_node.parameter_2
                  AND workflow_node.workflow_node_type_id=17
                  AND workflow.workflow_node_type_id=42
             ) v1,
             ( SELECT workflow_node.workflow_id,test_template.test_template_id
               FROM workflow_node,test_template
               WHERE test_template.test_template_id = workflow_node.template
                 AND workflow_node.order_number = 1
                 AND workflow_node.workflow_node_type_id=42
             ) v2,
             ( SELECT aliquot.aliquot_id,test_template.test_template_id
               FROM aliquot,test,test_template
               WHERE aliquot.aliquot_id = test.aliquot_id
                 AND test.test_template_id = test_template.test_template_id
             ) v3
       WHERE v1.workflow_id = v2.workflow_id
         AND v2.test_template_id= v3.test_template_id

    I have found a script (utlxplan.sql) for creating the plan_table so here it is
    SQL> @c:\utlxplan.sql;
    Table created.
    SQL> EXPLAIN PLAN FOR SELECT distinct v1.u_protocol_id
      2     FROM ( SELECT workflow_node.workflow_id,u_protocol.u_protocol_id
      3         FROM lims_sys.workflow_node,lims_sys.workflow,lims_sys.U_protocol
      4         WHERE workflow.workflow_id=workflow_node.workflow_id
      5           AND u_protocol.u_protocol_id = workflow_node.parameter_2
      6        AND workflow_node.workflow_node_type_id=17
      7        AND workflow.workflow_node_type_id=42
      8       ) v1,
      9       ( SELECT workflow_node.workflow_id,test_template.test_template_id
    10         FROM lims_sys.aliquot,lims_sys.test,lims_sys.workflow_node,lims_sys.test_template
    11         WHERE aliquot.aliquot_id = test.aliquot_id
    12           AND test.test_template_id = test_template.test_template_id
    13     AND test_template.test_template_id = workflow_node.template
    14       ) v2
    15     WHERE v1.workflow_id = v2.workflow_id
    16  /
    Explained.
    SQL> SELECT * FROM TABLE(dbms_xplan.display);
    PLAN_TABLE_OUTPUT
    | Id  | Operation                           |  Name                           |
    Rows  | Bytes | Cost  |
    |   0 | SELECT STATEMENT                    |                                 |
    PLAN_TABLE_OUTPUT
          |       |       |
    |   1 |  SORT UNIQUE                        |                                 |
          |       |       |
    |   2 |   FILTER                            |                                 |
          |       |       |
    |   3 |    NESTED LOOPS                     |                                 |
          |       |       |
    PLAN_TABLE_OUTPUT
    |   4 |     NESTED LOOPS                    |                                 |
          |       |       |
    |   5 |      NESTED LOOPS                   |                                 |
          |       |       |
    |   6 |       NESTED LOOPS                  |                                 |
          |       |       |
    |   7 |        NESTED LOOPS                 |                                 |
          |       |       |
    PLAN_TABLE_OUTPUT
    |   8 |         NESTED LOOPS                |                                 |
          |       |       |
    |   9 |          TABLE ACCESS BY INDEX ROWID| WORKFLOW                        |
          |       |       |
    |* 10 |           INDEX RANGE SCAN          | FK_WORKFLOW_WORKFLOW_NODE_TYPE  |
          |       |       |
    |  11 |          TABLE ACCESS BY INDEX ROWID| WORKFLOW_NODE                   |
    PLAN_TABLE_OUTPUT
          |       |       |
    |  12 |           AND-EQUAL                 |                                 |
          |       |       |
    |* 13 |            INDEX RANGE SCAN         | FK_WORKFLOW_NODE_WORKFLOW       |
          |       |       |
    |* 14 |            INDEX RANGE SCAN         | FK_WORKFLOW_NODE_NODE_TYPE      |
          |       |       |
    PLAN_TABLE_OUTPUT
    |  15 |         TABLE ACCESS BY INDEX ROWID | U_PROTOCOL                      |
          |       |       |
    |* 16 |          INDEX UNIQUE SCAN          | PK_U_PROTOCOL                   |
          |       |       |
    |  17 |        TABLE ACCESS BY INDEX ROWID  | WORKFLOW_NODE                   |
          |       |       |
    |* 18 |         INDEX RANGE SCAN            | FK_WORKFLOW_NODE_WORKFLOW       |
          |       |       |
    PLAN_TABLE_OUTPUT
    |  19 |       TABLE ACCESS BY INDEX ROWID   | TEST_TEMPLATE                   |
          |       |       |
    |* 20 |        INDEX UNIQUE SCAN            | PK_TEST_TEMPLATE                |
          |       |       |
    |  21 |      TABLE ACCESS BY INDEX ROWID    | TEST                            |
          |       |       |
    |* 22 |       INDEX RANGE SCAN              | FK_TEST_TEST_TEMPLATE           |
    PLAN_TABLE_OUTPUT
          |       |       |
    |  23 |     TABLE ACCESS BY INDEX ROWID     | ALIQUOT                         |
          |       |       |
    |* 24 |      INDEX UNIQUE SCAN              | PK_ALIQUOT                      |
          |       |       |
    |  25 |    INDEX UNIQUE SCAN                | PK_OPERATOR_GROUP               |
          |       |       |
    PLAN_TABLE_OUTPUT
    |  26 |    INDEX UNIQUE SCAN                | PK_OPERATOR_GROUP               |
          |       |       |
    |  27 |    INDEX UNIQUE SCAN                | PK_OPERATOR_GROUP               |
          |       |       |
    |  28 |    INDEX UNIQUE SCAN                | PK_OPERATOR_GROUP               |
          |       |       |
    |  29 |    INDEX UNIQUE SCAN                | PK_OPERATOR_GROUP               |
          |       |       |
    PLAN_TABLE_OUTPUT
    Predicate Information (identified by operation id):
      10 - access("SYS_ALIAS_5"."WORKFLOW_NODE_TYPE_ID"=42)
      13 - access("SYS_ALIAS_5"."WORKFLOW_ID"="WORKFLOW_NODE"."WORKFLOW_ID")
      14 - access("WORKFLOW_NODE"."WORKFLOW_NODE_TYPE_ID"=17)
    PLAN_TABLE_OUTPUT
      16 - access("SYS_ALIAS_4"."U_PROTOCOL_ID"=TO_NUMBER("WORKFLOW_NODE"."PARAMETER
    _2"))
      18 - access("WORKFLOW_NODE"."WORKFLOW_ID"="WORKFLOW_NODE"."WORKFLOW_ID")
      20 - access("SYS_ALIAS_1"."TEST_TEMPLATE_ID"="WORKFLOW_NODE"."TEMPLATE")
      22 - access("SYS_ALIAS_2"."TEST_TEMPLATE_ID"="SYS_ALIAS_1"."TEST_TEMPLATE_ID")
      24 - access("SYS_ALIAS_3"."ALIQUOT_ID"="SYS_ALIAS_2"."ALIQUOT_ID")
    Note: rule based optimization

  • Is the inline view functions causes more ?

    Hi,
    I am getting ORA-07445 CORE DUMP ERROR...
    IT IS COMING ONLY SOMETIMES WHEN EXECUTING A STRORED PROCEDURE
    WITH 10 STATEMENTS.
    OUT OF THEM ONE REFERES TO REFCURSOR FOR OUT PARAMETER,
    THAT QUERY IS LIKE
    SELECT * FROM(SELECT * FROM (SELECT * FROM(.....))));
    So is this inline view statement causes for such errors?
    Please help me.
    thanks in advance,
    khaleel

    The link for the Resource mentioned in Reply 2 is
    http://digital.ni.com/public.nsf/allkb/F70DB3441DC5AB9986256E97005BA825
    Probably regular FFT functions from Labview Signal Analysis and Processing Pallete can be used as well. In this case the following articles are worth reading:
    http://zone.ni.com/devzone/conceptd.nsf/webmain/C045A890751303A6862568650061EA98
    http://zone.ni.com/devzone/conceptd.nsf/webmain/66A9E8BFA65260F886256C5A00792BC6
    http://zone.ni.com/devzone/conceptd.nsf/webmain/E0F0B1FFE86A14A986256F2E0005AF4D
    Regards

  • Does an inline view execute before the rest of the select?

    Hi,
    The O'Reilly book Mastering Oracle Sql defines an inline view simply as a
    subquery in a select FROM clause. This conforms to the definitions in
    the Oracle 9i and 10g docs.
    But unlike the Oracle docs, the O'Reilly book says the inline view is,
    like a WITH clause, executed before the rest of the query. I can't see
    how this can be done unless the inline view makes no reference to
    other tables joined in the FROM clause.
    Is there a species of inline view in 9i/10g that IS restricted as above -
    no refs to other tables in the FROM clause - and what is it called?
    Thanks for any help.
    Ken Quirici

    As explained above, Oracle can choose to merge the query if feasible to do so. Look at the two queries and their plans below. The plan in second query changes to creating a temporary VIEW since in that case, Oracle is unable to perform the merge:
    SQL> select *
      2          from scott.emp e,
      3                  (select * from scott.dept d where d.deptno = 10) dd
      4  where
      5          e.deptno = dd.deptno
      6  /
         EMPNO ENAME      JOB              MGR HIREDATE           SAL       COMM     DEPTNO     DEPTNO DNAME          LOC
          7782 CLARK      MANAGER         7839 09-JUN-1981       2450                    10         10 ACCOUNTING     NEW YORK
          7839 KING       PRESIDENT            17-NOV-1981       5000                    10         10 ACCOUNTING     NEW YORK
          7934 MILLER     CLERK           7782 23-JAN-1982       1300                    10         10 ACCOUNTING     NEW YORK
    3 rows selected.
    Execution Plan
    Plan hash value: 3570059291
    | Id  | Operation                    | Name           | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT             |                |     3 |   171 |     2   (0)| 00:00:01 |
    |   1 |  NESTED LOOPS                |                |     3 |   171 |     2   (0)| 00:00:01 |
    |   2 |   TABLE ACCESS BY INDEX ROWID| DEPT           |     1 |    20 |     1   (0)| 00:00:01 |
    |*  3 |    INDEX UNIQUE SCAN         | PK_DEPT        |     1 |       |     0   (0)| 00:00:01 |
    |   4 |   TABLE ACCESS BY INDEX ROWID| EMP            |     3 |   111 |     1   (0)| 00:00:01 |
    |*  5 |    INDEX RANGE SCAN          | IDX_EMP_DEPTNO |     3 |       |     0   (0)| 00:00:01 |
    SQL> select *
      2          from scott.emp e,
      3                  (select * from scott.dept d where d.deptno = 10 and rownum > 0) dd
      4  where
      5          e.deptno = dd.deptno
      6  /
         EMPNO ENAME      JOB              MGR HIREDATE           SAL       COMM     DEPTNO     DEPTNO DNAME          LOC
          7782 CLARK      MANAGER         7839 09-JUN-1981       2450                    10         10 ACCOUNTING     NEW YORK
          7839 KING       PRESIDENT            17-NOV-1981       5000                    10         10 ACCOUNTING     NEW YORK
          7934 MILLER     CLERK           7782 23-JAN-1982       1300                    10         10 ACCOUNTING     NEW YORK
    3 rows selected.
    Execution Plan
    Plan hash value: 1670713873
    | Id  | Operation                       | Name           | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT                |                |     5 |   280 |     2   (0)| 00:00:01 |
    |   1 |  NESTED LOOPS                   |                |     5 |   280 |     2   (0)| 00:00:01 |
    |   2 |   VIEW                          |                |     1 |    19 |     1   (0)| 00:00:01 |
    |   3 |    COUNT                        |                |       |       |            |          |
    |*  4 |     FILTER                      |                |       |       |            |          |
    |   5 |      TABLE ACCESS BY INDEX ROWID| DEPT           |     1 |    20 |     1   (0)| 00:00:01 |
    |*  6 |       INDEX UNIQUE SCAN         | PK_DEPT        |     1 |       |     0   (0)| 00:00:01 |
    |   7 |   TABLE ACCESS BY INDEX ROWID   | EMP            |     5 |   185 |     1   (0)| 00:00:01 |
    |*  8 |    INDEX RANGE SCAN             | IDX_EMP_DEPTNO |     5 |       |     0   (0)| 00:00:01 |
    SQL> disconnect
    Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
    With the Partitioning, OLAP and Data Mining options
    SQL>
    can it, in it's WHERE clause, reference other tables in the FROM clause?No. it cannot. but as said above, tha may not stop Oracle from merging the queries.
    SQL> select *
      2          from scott.emp e,
      3                  (select * from scott.dept d where d.deptno = 10 and e.sal > 1000) dd
      4  where
      5          e.deptno = dd.deptno
      6  /
                    (select * from scott.dept d where d.deptno = 10 and e.sal > 1000) dd
    ERROR at line 3:
    ORA-00904: "E"."SAL": invalid identifier
    SQL>

  • Disable inline viewing of attachments in Mavericks mail

    Dear all
    In previous version of the OS, there was an easy terminal fix to disable inline viewing of attachments in mail. Instead of bulky and cumbersome images and PDFs, I used to get nice, neat icons.
    This terminal fix doesn't seem to work in Mavericks.
    Online sources tell me to buy a separate app called Attachment Tamer to fix this.
    Just wanted to find out whether there is a way to do this without additional software.
    Thanks in advance
    Best regards
    Zam

    Sorry, that page is a description of the basic functionality that is supposed to work in Mavericks, but is entirely failing to work for me. I tried calling Apple Support on the phone, and went through many attempted fixes with the experts, but they eventually threw up their hands in despair.

  • Issue with Inline View Criteria

    Hi,
    I have a VO created on two tables that are joined by a 1:1 association(say Opportunity and Revenue). The query is specified in Expert mode because I need some aggregations performed using analytic functions. Data security predicates are applied on top of this query using a dummy View Criteria. My requirement now is that I need to filter these results using another VC. The issue is that both the tables have attributes with the same name(say Cust ID) and I need to filter based on this using an inline View Criteria. I have done the same declaratively. However, I get an error on hitting the page saying the columns have been ambiguously defined.
    On digging through the log, I discovered the test Query fails to prefix the alias before the attribute. So what I get is something similar to this
    select (o.id, r.amt, sum(), count(), avg(), o.custId) from opty o, revn r where (o.id in DATA SECURITY PREDICATE) and (custId = :bindCustId)
    Is there a way to ensure that the custId can be changed to o.custId???
    Note - The View Criteria was created on an attribute from opty table that was exposed i.e in this case, o.custId. Although the query builder shows it correctly while creating the VC declaratively, the issue persists as seen from the logs.
    Thanks,
    Manoj

    Hi experts...
    Any pointers to this issue???
    Please help!
    Regards,
    Debolina

  • [sql performance] inline view , group by , max, join

    Hi. everyone.
    I have a question with regard to "group by" inline view ,
    max value, join, and sql performance.
    I will give you simple table definitions in order for you
    to understand my intention.
    Table A (parent)
    C1
    C2
    C3
    Table B (child)
    C1
    C2
    C3
    C4 number type(sequence number)
    1. c1, c2, c3 are the key columns of tabla A.
    2. c1, c2, c3, c4 are the key columns of table B.
    3. table A is the parent table of Table B.
    4. c4 column of table b is the serial number.
    (c4 increases from 1 by "1" regarding every (c1,c2,c3)
    the following is the simple example of the sql query.
    select .................................
    from table_a,
    (select c1, c2, c3, max(c4)
    from table_b
    group by c1, c2, c3) table_c
    where table_a.c1 = table_c.c1
    and table_a.c2 = table_c.c2
    and table_a.c3 = table_c.c3
    The real query is not simple as above. More tables come
    after "the from clause".
    Table A and table B are big tables, which have more than
    100,000,000 rows.
    The response time of this sql is very very slow
    as everyone can expect.
    Are there any solutions or sql-tips about the late response-time?
    I am considering adding a new column into "Table B" in
    order to identify the row, which has max serial number.
    At this point, I am not sure adding a column is a good
    thing in terms of every aspect.
    I will be waiting for your advice and every response
    will be appreciated even if it is not the solution.
    Have a good day.
    HO.
    Message was edited by:
    user507290

    For such big sources check that
    1) you use full scans, hash joins or at least merge joins
    2) you scan your source data as less as possible. In the best case each necessary table only once (for example not using exists clause to effectively scan all table via index scan).
    3) how much time you are spending on sorts and hash joins (either from v$session_longops directly or some tool that visualises this info). If you are using workarea_size_policy = auto, probably you can switch to manual for this particular select and adjust sort_area_size and hash_area_size big enough to do as less as possible sorts on disk
    4) if you have enough free resources i.e. big box probably you can consider using some parallelism
    5) if your full scans are taking big time check what is your db_file_multiblock_read_count, probably increasing it for this select will give some gain.
    6) run trace and check on what are you waiting for
    7) most probably your problem is IO bound so probably you can do something from OS side to make IO faster
    8) if your query now is optimized as much as you can, disks are running as mad and you are using all RAM then probably it is the most you can get out of your box :)
    9) if nothing helps then you can start thinking about precalculations either using your idea about derived column or some materialized views.
    10) I hope you have a test box and at least point (9) do firstly on it and see whether it helps.
    Gints Plivna
    http://www.gplivna.eu

  • Setting parameter in Detail View Object

    I want to setting parameter in detail view.I have two table.One is master another is detail.I use parameter in master table so I put my page parameter form and I execute it.It work fine.I want to use parameter in detail table.In detail table if I dont use parameter master is execute it automaticly and it shows the result but when I put the parameter in detail it isn't show any result it say no rows return.Please help about to use detail views parameters(bind variables)

    Hmmm, sorry, not sure.
    Can I suggest you change your code to the following:
    RowSetIterator[] iter= getMasterRowSetIterators();
    if (iter != null && iter[0].first() != null) {
      Row row = rsi[0].getCurrentRow();
      .....(etc)....And run it in the debugger. See if it actually gets to the Row line. If not getMasterRowSetIterators() isn't returning any iterators and you should check how you've exposed your VOs in your AM - specifically looking to see if your detail VO is actually a detail VO to a parent VO.
    Also I'm not sure overriding executeQuery() is the best place to be doing this as the doco says it is not always called. The doco seems to indicate executeQueryForCollection() is the preferred method. However in my testing it appears you can't set the query parameters in this method.
    Sorry I couldn't be more helpful.
    CM.

  • Can You Explain This SQL Query - Inline View Included

    The query is taken from "Oracle Database 10g: SQL Fundamentals II" page 3-7 (chapter 3)
    I do not fully understand the following query:
    SELECT a.last_name, a.salary, a.department_id, b.salavg
    FROM   employees a, (SELECT   department_id,
    AVG(salary) salavg
    FROM     employees
    GROUP BY department_id) b
    WHERE  a.department_id = b.department_id
    AND    a.salary > b.salavg;
    The inline view can return several records. Can you please tell me in step by step how does this work. I understand the concept of join tables and aliases, etc. I just need to know the mechanism of this code.
    Thanks

    user11164565 wrote:
    The query is taken from "Oracle Database 10g: SQL Fundamentals II" page 3-7 (chapter 3)
    I do not fully understand the following query:
    SELECT a.last_name, a.salary, a.department_id, b.salavg
    FROM   employees a, (SELECT   department_id,
    AVG(salary) salavg
    FROM     employees
    GROUP BY department_id) b
    WHERE  a.department_id = b.department_id
    AND    a.salary > b.salavg;
    The inline view can return several records. Can you please tell me in step by step how does this work. I understand the concept of join tables and aliases, etc. I just need to know the mechanism of this code.
    The query is returning the last name, salary , department and average salary of all the departments where salary is greater than the average salary.
    HTH
    Aman....

  • Using inline view with NOT IN clause

    I have a query with a NOT IN clause in the where clause that I would like to convert to an inline view. The select looks something like this:
    select uid, SYSDATE from tab1, tab2
    where tab1.uid = tab2.uid
    and ...
    and tab1.uid not in (select uid from tab3 where....)
    I've used inline queries elsewhere to great effect, but this one has me stumped. If anyone can help, it would be greatly appreciated.

    There can be problem with using not in or not exists depending on the amount of data in the tables and the relationship between them.
    I didn't got if you had problem with the existing SQL-statement, created view or both.
    Check statistics and look at explain plan for the sql-statement and the view.
    The problem can actually be some where clause that you have in the sql-statement but not in the view, but apply later when using the view.
    //Anders

  • Need help with SQL Query with Inline View + Group by

    Hello Gurus,
    I would really appreciate your time and effort regarding this query. I have the following data set.
    Reference_No---Check_Number---Check_Date--------Description-------------------------------Invoice_Number----------Invoice_Type---Paid_Amount-----Vendor_Number
    1234567----------11223-------------- 7/5/2008----------paid for cleaning----------------------44345563------------------I-----------------*20.00*-------------19
    1234567----------11223--------------7/5/2008-----------Adjustment for bad quality---------44345563------------------A-----------------10.00------------19
    7654321----------11223--------------7/5/2008-----------Adjustment from last billing cycle-----23543556-------------------A--------------------50.00--------------19
    4653456----------11223--------------7/5/2008-----------paid for cleaning------------------------35654765--------------------I---------------------30.00-------------19
    Please Ignore '----', added it for clarity
    I am trying to write a query to aggregate paid_amount based on Reference_No, Check_Number, Payment_Date, Invoice_Number, Invoice_Type, Vendor_Number and display description with Invoice_type 'I' when there are multiple records with the same Reference_No, Check_Number, Payment_Date, Invoice_Number, Invoice_Type, Vendor_Number. When there are no multiple records I want to display the respective Description.
    The query should return the following data set
    Reference_No---Check_Number---Check_Date--------Description-------------------------------Invoice_Number----------Invoice_Type---Paid_Amount-----Vendor_Number
    1234567----------11223-------------- 7/5/2008----------paid for cleaning----------------------44345563------------------I-----------------*10.00*------------19
    7654321----------11223--------------7/5/2008-----------Adjustment from last billing cycle-----23543556-------------------A--------------------50.00--------------19
    4653456----------11223--------------7/5/2008-----------paid for cleaning------------------------35654765-------------------I---------------------30.00--------------19
    The following is my query. I am kind of lost.
    select B.Description, A.sequence_id,A.check_date, A.check_number, A.invoice_number, A.amount, A.vendor_number
    from (
    select sequence_id,check_date, check_number, invoice_number, sum(paid_amount) amount, vendor_number
    from INVOICE
    group by sequence_id,check_date, check_number, invoice_number, vendor_number
    ) A, INVOICE B
    where A.sequence_id = B.sequence_id
    Thanks,
    Nick

    It looks like it is a duplicate thread - correct me if i'm wrong in this case ->
    Need help with SQL Query with Inline View + Group by
    Regards.
    Satyaki De.

  • [SQL] inline view and order by on oracle 8.0.5

    Hi everyone.
    I am trying to sort data inside "inline view"
    on "Oracle8 Release 8.0.5.0.0 - Production".
    However, it did not work. Is this an oracle-bug?
    I got the oracle error , "ORA-00907".
    The sql script is like this:
    select ..............
    from (select ..... from .. where .... order by ...)
    where rownum <11
    However, the "exactly" same sql has no problem
    on "Oracle8i Enterprise Edition Release 8.1.7.0.0".
    Every response will be greatly appreciated.
    Thanks in advance.
    Ho.

    Order by cannot be used in a subquery while for inline view it is supported but in Oracle8i, release 8.1 and up
    Khurram

  • Problem while using inline view.

    hello everyone, i have a certain problem. i have a query where i have used 3 inline views.which is as follow.
    SELECT X.MC_ID,
    X.PROD,X.EFF,Y.PROD,Y.EFF,Z.PROD,Z.EFF
    FROM
    (SELECT A.MC_ID MC_ID,A.COARSE_FINE,DECODE(A.COARSE_FINE,'F',NVL(A.PRODUCTION,0),0) PROD,
    DECODE(A.COARSE_FINE,'F',(NVL(A.PRODUCTION,0)/NVL(A.FINE_TARGET_PROD,0))* 100,0) EFF
    FROM PR_DAILY_DOFFING_ENTRY A
    WHERE A.SHIFT = 'A'
    AND MC_ID = 24
    AND TO_CHAR(A.DOFFING_DATE,'DD/MM/RRRR') = '28/10/2004') X,
    (SELECT A.MC_ID,A.COARSE_FINE,DECODE(A.COARSE_FINE,'F',NVL(A.PRODUCTION,0),0) PROD,
    DECODE(A.COARSE_FINE,'F',(NVL(A.PRODUCTION,0)/NVL(A.FINE_TARGET_PROD,0))* 100,0) EFF
    FROM PR_DAILY_DOFFING_ENTRY A
    WHERE A.SHIFT = 'B'
    AND MC_ID = 24
    AND TO_CHAR(A.DOFFING_DATE,'DD/MM/RRRR') = '28/10/2004') Y,
    (SELECT A.MC_ID,A.COARSE_FINE,DECODE(A.COARSE_FINE,'F',NVL(A.PRODUCTION,' '),' ') PROD,
    DECODE(A.COARSE_FINE,'F',(NVL(A.PRODUCTION,' ')/NVL(A.FINE_TARGET_PROD,' '))* 100,' ') EFF
    FROM PR_DAILY_DOFFING_ENTRY A
    WHERE A.SHIFT = 'C'
    AND MC_ID = 24
    AND TO_CHAR(A.DOFFING_DATE,'DD/MM/RRRR') = '28/10/2004') Z
    Now my problem is that the view z is returning null as results in the prod and eff coloums.( well that is fine since i actually have no datas in my table against shift 'C') but inline views x and y are returning datas. but when i am selecting this -- SELECT X.MC_ID,
    X.PROD,X.EFF,Y.PROD,Y.EFF,Z.PROD,Z.EFF nothing is being returned as all the coloums are showing null values. when it should show values in (X.PROD,X.EFF,Y.PROD,Y.EFF) coloumns and null in (Z.PROD,Z.EFF) coloumns. please suggest me what to do now.
    Edited by: pari kankaria on Aug 23, 2009 11:02 PM

    is this your complete query? I guess you are missing the joining conditions if this is your complete query.
    it should be like this
    SELECT x.mc_id, x.prod, x.eff, y.prod, y.eff, z.prod, z.eff
      FROM (SELECT a.mc_id mc_id, a.coarse_fine,
                   DECODE (a.coarse_fine, 'F', NVL (a.production, 0), 0) prod,
                   DECODE (a.coarse_fine,
                           'F', (  NVL (a.production, 0)
                                 / NVL (a.fine_target_prod, 0)
                            * 100,
                           0
                          ) eff
              FROM pr_daily_doffing_entry a
             WHERE a.shift = 'A'
               AND mc_id = 24
               AND TO_CHAR (a.doffing_date, 'DD/MM/RRRR') = '28/10/2004') x,
           (SELECT a.mc_id, a.coarse_fine,
                   DECODE (a.coarse_fine, 'F', NVL (a.production, 0), 0) prod,
                   DECODE (a.coarse_fine,
                           'F', (  NVL (a.production, 0)
                                 / NVL (a.fine_target_prod, 0)
                            * 100,
                           0
                          ) eff
              FROM pr_daily_doffing_entry a
             WHERE a.shift = 'B'
               AND mc_id = 24
               AND TO_CHAR (a.doffing_date, 'DD/MM/RRRR') = '28/10/2004') y,
           (SELECT a.mc_id, a.coarse_fine,
                   DECODE (a.coarse_fine,
                           'F', NVL (a.production, ' '),
                          ) prod,
                   DECODE (a.coarse_fine,
                           'F', (  NVL (a.production, ' ')
                                 / NVL (a.fine_target_prod, ' ')
                            * 100,
                          ) eff
              FROM pr_daily_doffing_entry a
             WHERE a.shift = 'C'
               AND mc_id = 24
               AND TO_CHAR (a.doffing_date, 'DD/MM/RRRR') = '28/10/2004') z
    WHERE x.mc_id = y.mc_id AND y.mc_id = z.mc_id     ----something like this should be there change it according to your conditionNOTE : NOT TESTED
    Edited by: Qwerty on Aug 24, 2009 11:46 AM

Maybe you are looking for