I need help on lexical parameter in cursor

Dear Experts,
Hope you are fine.
I'm using oracle DB 10.1.2 and forms 10.1.2.3. I want to write a cursor where  "few where condition" may exist or not exist.
Like bellow are the main cursor SQL.
SELECT TEMP_DATA
FROM TAB1
WHERE BDATE BETWEEN :B_DATE AND :E_DATE
AND DEPT_ID=:P1
AND DIVM_ID=:P2
ORDER BY BDATE;
Here i want, user may pass the value of  P1,P2 or any one or none. With more information. B_DATE and E_DATE must entered by user and
If user pass the both value of P1 and P2 then the above sql is ok for cursor. but if user don't pass the valu of P1 then cursor sql should like
SELECT TEMP_DATA
FROM TAB1
WHERE BDATE BETWEEN :B_DATE AND :E_DATE
AND DIVM_ID=:P2
ORDER BY BDATE;
How i do this in one cursor ?
Thanks for your time.
Ask2Learn

Thanks Etbin, Ramin,
We are all victims of profiling (I mean performance related) from time to time. One thing I have come to firmly believe, over years is that, Oracle Optimizer for the most part is way more intelligent than me ;-)
Got my 12c test DB few days back and tried this scenario out.
In my very limited testing it seems column = nvl(:P1,column) performs better than :P1 is null or column = :P1 (From explain plan and consistent gets perspective)
Moral of the story is as far as performance in Oracle is concerned, for your specific case test it out o find what works better!!!
Also,
With column = nvl(:P1,column) construct Oracle 12c builds and access path using TABLE ACCESS BY INDEX ROWID BATCHED operation. I guess this new in 12c. Need to read more about this.
SQL> select * from v$version;
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
SQL>
SQL> set autotrace traceonly statistics explain;
SQL> set timing on;
SQL> set line 200;
SQL>
SQL> var e1 number;
SQL> -- E1 is null
SQL> select * from employees
  2  where employee_id = :e1 OR :e1 is null;
107 rows selected.
Elapsed: 00:00:00.00
Execution Plan
Plan hash value: 1445457117
| Id  | Operation         | Name      | Rows  | Bytes | Cost (%CPU)| Time     |
|   0 | SELECT STATEMENT  |           |     6 |   414 |     3   (0)| 00:00:01 |
|*  1 |  TABLE ACCESS FULL| EMPLOYEES |     6 |   414 |     3   (0)| 00:00:01 |
Predicate Information (identified by operation id):
   1 - filter(:E1 IS NULL OR "EMPLOYEE_ID"=TO_NUMBER(:E1))
Statistics
          0  recursive calls
          0  db block gets
         15  consistent gets
          0  physical reads
          0  redo size
      10121  bytes sent via SQL*Net to client
        621  bytes received via SQL*Net from client
          9  SQL*Net roundtrips to/from client
          0  sorts (memory)
          0  sorts (disk)
        107  rows processed
SQL>
SQL> select * from employees
  2  where employee_id  = nvl( :e1 ,employee_id);
107 rows selected.
Elapsed: 00:00:00.00
Execution Plan
Plan hash value: 929977954
| Id  | Operation                             | Name          | Rows  | Bytes | Cost (%CPU)| Time     |
|   0 | SELECT STATEMENT                      |               |   108 |  7452 |     0   (0)| 00:00:01 |
|   1 |  CONCATENATION                        |               |       |       |            |          |
|*  2 |   FILTER                              |               |       |       |            |          |
|   3 |    TABLE ACCESS BY INDEX ROWID BATCHED| EMPLOYEES     |   107 |  7383 |     0   (0)| 00:00:01 |
|*  4 |     INDEX FULL SCAN                   | EMP_EMP_ID_PK |   107 |       |     0   (0)| 00:00:01 |
|*  5 |   FILTER                              |               |       |       |            |          |
|   6 |    TABLE ACCESS BY INDEX ROWID        | EMPLOYEES     |     1 |    69 |     0   (0)| 00:00:01 |
|*  7 |     INDEX UNIQUE SCAN                 | EMP_EMP_ID_PK |     1 |       |     0   (0)| 00:00:01 |
Predicate Information (identified by operation id):
   2 - filter(:E1 IS NULL)
   4 - filter("EMPLOYEE_ID" IS NOT NULL)
   5 - filter(:E1 IS NOT NULL)
   7 - access("EMPLOYEE_ID"=:E1)
Statistics
          0  recursive calls
          0  db block gets
         19  consistent gets
          0  physical reads
          0  redo size
      10121  bytes sent via SQL*Net to client
        621  bytes received via SQL*Net from client
          9  SQL*Net roundtrips to/from client
          0  sorts (memory)
          0  sorts (disk)
        107  rows processed
SQL>
SQL> -- E1 is 10 KNOWN to be not found;
SQL> begin :e1 := 10; end;
  2  /
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.00
SQL>
SQL> select * from employees
  2  where employee_id = :e1 OR :e1 is null;
no rows selected
Elapsed: 00:00:00.00
Execution Plan
Plan hash value: 1445457117
| Id  | Operation         | Name      | Rows  | Bytes | Cost (%CPU)| Time     |
|   0 | SELECT STATEMENT  |           |     6 |   414 |     3   (0)| 00:00:01 |
|*  1 |  TABLE ACCESS FULL| EMPLOYEES |     6 |   414 |     3   (0)| 00:00:01 |
Predicate Information (identified by operation id):
   1 - filter(:E1 IS NULL OR "EMPLOYEE_ID"=TO_NUMBER(:E1))
Statistics
          0  recursive calls
          0  db block gets
          7  consistent gets
          0  physical reads
          0  redo size
       1061  bytes sent via SQL*Net to client
        533  bytes received via SQL*Net from client
          1  SQL*Net roundtrips to/from client
          0  sorts (memory)
          0  sorts (disk)
          0  rows processed
SQL>
SQL> select * from employees
  2  where employee_id  = nvl( :e1 ,employee_id);
no rows selected
Elapsed: 00:00:00.00
Execution Plan
Plan hash value: 929977954
| Id  | Operation                             | Name          | Rows  | Bytes | Cost (%CPU)| Time     |
|   0 | SELECT STATEMENT                      |               |   108 |  7452 |     0   (0)| 00:00:01 |
|   1 |  CONCATENATION                        |               |       |       |            |          |
|*  2 |   FILTER                              |               |       |       |            |          |
|   3 |    TABLE ACCESS BY INDEX ROWID BATCHED| EMPLOYEES     |   107 |  7383 |     0   (0)| 00:00:01 |
|*  4 |     INDEX FULL SCAN                   | EMP_EMP_ID_PK |   107 |       |     0   (0)| 00:00:01 |
|*  5 |   FILTER                              |               |       |       |            |          |
|   6 |    TABLE ACCESS BY INDEX ROWID        | EMPLOYEES     |     1 |    69 |     0   (0)| 00:00:01 |
|*  7 |     INDEX UNIQUE SCAN                 | EMP_EMP_ID_PK |     1 |       |     0   (0)| 00:00:01 |
Predicate Information (identified by operation id):
   2 - filter(:E1 IS NULL)
   4 - filter("EMPLOYEE_ID" IS NOT NULL)
   5 - filter(:E1 IS NOT NULL)
   7 - access("EMPLOYEE_ID"=:E1)
Statistics
          0  recursive calls
          0  db block gets
          1  consistent gets
          0  physical reads
          0  redo size
       1061  bytes sent via SQL*Net to client
        533  bytes received via SQL*Net from client
          1  SQL*Net roundtrips to/from client
          0  sorts (memory)
          0  sorts (disk)
          0  rows processed
SQL>
SQL> -- E1 is 107 KNOWN to be found;
SQL> begin :e1 := 107; end;
  2  /
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.00
SQL>
SQL> select * from employees
  2  where employee_id = :e1 OR :e1 is null;
Elapsed: 00:00:00.00
Execution Plan
Plan hash value: 1445457117
| Id  | Operation         | Name      | Rows  | Bytes | Cost (%CPU)| Time     |
|   0 | SELECT STATEMENT  |           |     6 |   414 |     3   (0)| 00:00:01 |
|*  1 |  TABLE ACCESS FULL| EMPLOYEES |     6 |   414 |     3   (0)| 00:00:01 |
Predicate Information (identified by operation id):
   1 - filter(:E1 IS NULL OR "EMPLOYEE_ID"=TO_NUMBER(:E1))
Statistics
          0  recursive calls
          0  db block gets
          8  consistent gets
          0  physical reads
          0  redo size
       1323  bytes sent via SQL*Net to client
        544  bytes received via SQL*Net from client
          2  SQL*Net roundtrips to/from client
          0  sorts (memory)
          0  sorts (disk)
          1  rows processed
SQL>
SQL> select * from employees
  2  where employee_id  = nvl( :e1 ,employee_id);
Elapsed: 00:00:00.00
Execution Plan
Plan hash value: 929977954
| Id  | Operation                             | Name          | Rows  | Bytes | Cost (%CPU)| Time     |
|   0 | SELECT STATEMENT                      |               |   108 |  7452 |     0   (0)| 00:00:01 |
|   1 |  CONCATENATION                        |               |       |       |            |          |
|*  2 |   FILTER                              |               |       |       |            |          |
|   3 |    TABLE ACCESS BY INDEX ROWID BATCHED| EMPLOYEES     |   107 |  7383 |     0   (0)| 00:00:01 |
|*  4 |     INDEX FULL SCAN                   | EMP_EMP_ID_PK |   107 |       |     0   (0)| 00:00:01 |
|*  5 |   FILTER                              |               |       |       |            |          |
|   6 |    TABLE ACCESS BY INDEX ROWID        | EMPLOYEES     |     1 |    69 |     0   (0)| 00:00:01 |
|*  7 |     INDEX UNIQUE SCAN                 | EMP_EMP_ID_PK |     1 |       |     0   (0)| 00:00:01 |
Predicate Information (identified by operation id):
   2 - filter(:E1 IS NULL)
   4 - filter("EMPLOYEE_ID" IS NOT NULL)
   5 - filter(:E1 IS NOT NULL)
   7 - access("EMPLOYEE_ID"=:E1)
Statistics
          0  recursive calls
          0  db block gets
          2  consistent gets
          0  physical reads
          0  redo size
       1323  bytes sent via SQL*Net to client
        544  bytes received via SQL*Net from client
          2  SQL*Net roundtrips to/from client
          0  sorts (memory)
          0  sorts (disk)
          1  rows processed
SQL>
vr,
Sudhakar

Similar Messages

  • ACE - need help implementing basic parameter map

    Hi,
    I'm trying to implement a connection parameter on an ACE module that sumply sets the TCP timeout to 0.
    I can get this to work fine if I permit all TCP traffic in the class-map, but it doesn't work if I use an ACL;
    >>Match all TCP;
    parameter-map type connection TCP-Timeout
    set timeout inactivity 0
    class-map match-all TCP-Timeout-Out-Class
    2 match port tcp any
    class-map match-all TCP-Timeout-in-Class
    2 match port tcp any
    policy-map multi-match TCP-Timeout-Out-Policy
    class TCP-Timeout-Out-Class
    connection advanced-options TCP-Timeout
    policy-map multi-match TCP-Timeout-in-Policy
    class TCP-Timeout-in-Class
    connection advanced-options TCP-Timeout
    Interface vlan 920
    service-policy input TCP-Timeout-in-Policy
    Interface vlan 923
    service-policy input TCP-Timeout-Out-Policy
    >>Match ACL;
    access-list TCP-Timeout-Group-Out line 10 extended permit ip 10.221.178.0 0.0.0.255 any
    access-list TCP-Timeout-Group-in line 10 extended permit ip any 10.221.178.0 0.0.0.255
    parameter-map type connection TCP-Timeout
    set timeout inactivity 0
    class-map match-all TCP-Timeout-Out-Class
    match access-list TCP-Timeout-Group-Out
    class-map match-all TCP-Timeout-in-Class
    match access-list TCP-Timeout-Group-in
    policy-map multi-match TCP-Timeout-Out-Policy
    class TCP-Timeout-Out-Class
    connection advanced-options TCP-Timeout
    policy-map multi-match TCP-Timeout-in-Policy
    class TCP-Timeout-in-Class
    connection advanced-options TCP-Timeout
    Interface vlan 320
    service-policy input TCP-Timeout-in-Policy
    Interface vlan 323
    service-policy input TCP-Timeout-Out-Policy
    Any ideas?
    Many Thanks

    Try changing the class-map from "type match-all" to "type match-any". Match all implies both statments need to be true. The match-any is probably what you want. Either of the ACL statements can be true.
    Also try to apply the policy globally instead of the interfaces, simplifying the config might help as well.
    e.g.:
    access-list TCP-Timeout-Group line 10 extended permit ip 10.221.178.0 0.0.0.255 any
    access-list TCP-Timeout-Group line 20 extended permit ip any 10.221.178.0 0.0.0.255
    class-map match-any TCP-Timeout-Class
    match access-list TCP-Timeout-Group
    parameter-map type connection TCP-Parameter-Map
    set timeout inactivity 0
    policy-map multi-match TCP-Timeout-Out-Policy
    class TCP-Timeout-Out-Class
    connection advanced-options TCP-Parameter-Map
    service policy input TCP-Timeout-Out-Policy <- apply it globally
    Hope it helps.
    Roble

  • Need help for retrieving parameter containing "\" char from ServletRequest

    I'm implementing a portal using Jetspeed 1.4, and I would like to include the "\" character in the login name of a HTML form like below:
    login_name=INTRANET\Guest
    And in many parts of the programs, it needs to interpret the path to identify the login name via the code segments below:
    StringTokenizer st = new StringTokenizer(req.getPathInfo(), "/");
    boolean name = true;
    String pathPart = null;
    while (st.hasMoreTokens()) {
    if (name == true) {
    tmp = URLDecoder.decode(st.nextToken());
    name = false;
    else {
    pathPart = URLDecoder.decode(st.nextToken());
    if (tmp.length() != 0) {
    /* start debug */
    System.out.println(pathPart);
    /* end debug */
    add(convert(tmp), pathPart);
    name = true;
    I expect that I should be able to be retrieved the login name as INTRANET\Guest. However, this is not the case, and I got INTRANET/Guest instead. By looking at the value of req.getPathInfo() of the 1st line, the path has already been wrongly interpreted as:
    /media-type/html/user/INTRANET/Guest/page/...
    Is there any way I can get the same parameter if "/" character is included? On the other hand, I want to reference the source code of Servlet 2.2 or above, but I can't find it available from java.sun.com, while the only v2.1.1 available here is simply a rubbish. Please help.
    Thank you for your attention.

    Thank you for your reply. However, because I'm trying to modify the open source, and the login name is hard-coded appended into the path, where effort modifying this is very huge. It will be very convenient if I ca n find an alternative to get the value of getPathInfo() but with "\", or I can reach the source code and modify it straightly.
    However, I can't imagine even Servlet 2.2+ source code (2.1.1 is available, but no use) is not made available by anywhere of java.sun.com, including the SCSL. What's so-called open source?!

  • Need help loading xml parameter into component

    I am using a third-party flash component (no source access)
    that takes in a location of an xml file and manipulates it. The
    problem is, I want that file's location to be dynamic and be loaded
    from an argument to the end .swf that can then be forwarded to the
    internal component. How can I load a component at runtime and set
    it's xml_file parameter before/during construction of the object? I
    have tried to drag it to the stage from components and change the
    xml_file parameter in actionscript directly, but by the time this
    change gets triggered the xml has already been read in and it
    doesn't work.
    This may be really simple, but I just can't figure it out. I
    would appreciate anyone who could help. Thanks.

    First, set the size of the component with the setSize method,
    not "height" and "width". That may be the entire source of your
    problem.
    e.g.: this.componentInstanceName.setSize(175, 175);
    Second, I am unsure all the parameters you specify in the
    initialization object are valid {x:10, y:10, height:20, width:20,
    font_color:'#333333', player:"vidPlayer", xml_file:"list.xml"}.
    Only put in the initialization object parameters that are valid for
    the component you are instantiating.
    Third, make sure you are specifying the correct import
    statements for your component at the top of your code. Since it is
    a custom one, I can't help with knowing what to import. The code I
    attached in my first post assumed import statements and the
    components needed in the library, but here are the import
    statements that I used:
    import mx.controls.*;
    import mx.containers.*;//for scrollPane
    import mx.styles.CSSStyleDeclaration;
    import mx.transitions.easing;
    Fourth, don't forget the ignoreWhite method for importing XML
    into Flash:
    XML.prototype.ignoreWhite = true;// sets ignoreWhite
    globally

  • Need help in passing parameter from base page to popup page

    Dear ALL,
    I have a requirement as below.
    I have a page having one LOV, I need to select one value from that LOV and select one button from the page then it should open a popup page with the required data in tabular format for the field i selecetd.
    so i created a lov in my page and able to invoke the popup page through java script but how i can execute the query in popup page by taking the parameter whta i selected from base page.
    Please help me out.

    Mukul's Oracle Technology Blog: JavaScript In OA Framework
    --Sushant

  • Need Help: Dynamically displaying parameter values for a procedure.

    Problem Statement: Generic Code should display the parameter values dynamically by taking "package name" and "procedure name" as inputs and the values needs to be obtained from the parameters of the wrapper procedure.
    Example:
    a) Let us assume that there is an application package called customer.
    create or replace package spec customer
    as
    begin
    TYPE cust_in_rec_type IS RECORD
    cust_id NUMBER,
    ,cust_name VARCHAR2(25) );
    TYPE cust_role_rec_type IS RECORD
    (cust_id NUMBER,
    role_type VARCHAR2(20)
    TYPE role_tbl_type IS TABLE OF cust_role_rec_type INDEX BY BINARY_INTEGER;
    Procedure create_customer
    p_code in varchar2
    ,p_cust_rec cust_in_rec_type
    ,p_cust_roles role_tbl_type
    end;
    b) Let us assume that we need to test the create customer procedure in the package.For that various test cases needs to be executed.
    c) We have created a testing package as mentioned below.
    create or replace package body customer_test
    as
    begin
    -- signature of this wrapper is exactly same as create_customer procedure.
    procedure create_customer_wrapper
    p_code in varchar2
    ,p_cust_rec customer.cust_in_rec_type
    ,p_cust_roles customer.role_tbl_type
    as
    begin
    //<<<<<---Need to display parameter values dynamically for each test case-->>>>>
    Since the signature of this wrapper procedure is similar to actual app procedure, we can get all the parameter definition for this procedure using ALL_ARGUMENTS table as mentioned below.
    //<<
    select * from ALL_ARGUMENTS where package_name = CUSTOMER' and object_name = 'CREATE_CUSTOMER'
    but the problem is there are other procedures exists inside customer package like update_customer, add_address so need to have generalized code that is independent of each procedure inside the package.
    Is there any way to achieve this.
    Any help is appreciated.
    // >>>>
    create_customer
    p_code => p_code
    ,p_cust_rec => p_cust_rec
    ,p_cust_roles => p_cust_roles
    end;
    procedure testcase1
    as
    l_cust_rec customer.cust_in_rec_type ;
    l_cust_roles customer.role_tbl_type;
    begin
    l_cust_rec.cust_id := 1;
    l_cust_rec.cust_name := 'ABC';
    l_cust_roles(1).cust_id := 1;
    l_cust_roles(1).role_type := 'Role1';
    create_customer_wrapper
    p_code => 'code1'
    ,p_cust_rec => l_cust_rec
    ,p_cust_roles => l_cust_role
    end;
    procedure testcase2
    as
    l_cust_rec customer.cust_in_rec_type ;
    l_cust_roles customer.role_tbl_type;
    begin
    l_cust_rec.cust_id := 2;
    l_cust_rec.cust_name := 'DEF';
    l_cust_roles(1).cust_id := 2;
    l_cust_roles(1).role_type := 'Role2';
    create_customer_wrapper
    p_code => 'code2'
    ,p_cust_rec => l_cust_rec
    ,p_cust_roles => l_cust_role
    end;
    end;

    Not possible to dynamically in a procedure, deal with the parameter values passed by a caller. There is no struct or interface that a procedure can use to ask the run-time to give it the value of the 1st or 2nd or n parameter.
    There could perhaps be some undocumented/unsupported method - as debugging code (<i>DBMS_DEBUG</i>) is able to dynamically reference a variable (see Get_Value() function). But debugging requires a primary session (the debug session) and the target session (session being debugged).
    So easy answer is no - the complex answer is.. well, complex as the basic functionality for this do exists in Oracle in its DBMS_DEBUG feature, but only from a special debug session.
    The easiest way would be to generate the wrapper itself, dynamically. This allows your to generate code that displays the parameter values and add whatever other code needed into the wrapper. The following example demonstrates the basics of this approach:
    SQL> -- // our application proc called FooProc
    SQL> create or replace procedure FooProc( d date, n number, s varchar2 ) is
      2  begin
      3          -- // do some stuff
      4          null;
      5  end;
      6  /
    Procedure created.
    SQL>
    SQL> create or replace type TArgument is object(
      2          name            varchar2(30),
      3          datatype        varchar2(30)
      4  );
      5  /
    Type created.
    SQL>
    SQL> create or replace type TArgumentList is table of TArgument;
      2  /
    Type created.
    SQL>
    SQL> -- // create a proc that creates wrappers dynamically
    SQL> create or replace procedure GenerateWrapper( procName varchar2 ) is
      2          procCode        varchar2(32767);
      3          argList         TArgumentList;
      4  begin
      5          select
      6                  TArgument( argument_name, data_type )
      7                          bulk collect into
      8                  argList
      9          from    user_arguments
    10          where   object_name = upper(procName)
    11          order by position;
    12 
    13          procCode := 'create or replace procedure Test'||procName||'( ';
    14          for i in 1..argList.Count
    15          loop
    16                  procCode := procCode||argList(i).name||' '||argList(i).datatype;
    17                  if i < argList.Count then
    18                          procCode := procCode||', ';
    19                  end if;
    20          end loop;
    21 
    22          procCode := procCode||') as begin ';
    23          procCode := procCode||'DBMS_OUTPUT.put_line( '''||procName||''' ); ';
    24 
    25          for i in 1..argList.Count
    26          loop
    27                  procCode := procCode||'DBMS_OUTPUT.put_line( '''||argList(i).name||'=''||'||argList(i).name||' ); ';
    28          end loop;
    29 
    30          -- // similarly, a call to the real proc can be added into the test wrapper
    31          procCode := procCode||'end;';
    32 
    33          execute immediate procCode;
    34  end;
    35  /
    Procedure created.
    SQL>
    SQL> -- // generate a wrapper for a FooProc
    SQL> exec GenerateWrapper( 'FooProc' );
    PL/SQL procedure successfully completed.
    SQL>
    SQL> -- // call the FooProc wrapper
    SQL> exec TestFooProc( sysdate, 100, 'Hello World' )
    FooProc
    D=2011-01-07 13:11:32
    N=100
    S=Hello World
    PL/SQL procedure successfully completed.
    SQL>

  • Need help on changing parameter NLS_LENGTH_SEMANTICS

    hi All,
    Oracle is 11.2.0.1.0
    Initially our db parameter NLS_LENGTH_SEMANTICS='CHAR' for one table I am getting error
    like
    ORA-01450: maximum key length (6398) exceeded Missing Resource String.
    I changed it NLS_LENGTH_SEMANTICS='BYTE'
    now I am able to create that table
    Is there any side effect if I am changing NLS_LENGTH_SEMANTICS from CHAR to BYTE
    like
    ALTER SYSTEM SET NLS_LENGTH_SEMANTICS='BYTE' scope=both;
    Please help me .
    Thanks In advance.

    Hi;
    Please check below notes which could be helpful to get your answer
    SCRIPT: Changing columns to CHAR length semantics ( NLS_LENGTH_SEMANTICS ) [ID 313175.1]
    Examples and limits of BYTE and CHAR semantics usage (NLS_LENGTH_SEMANTICS) [ID 144808.1]
    Changing NLS_Length_semantics from BYTE to CHAR [ID 974744.1]
    Can The Parameter NLS_LENGTH_SEMANTICS Be Changed From BYTE To CHAR? [ID 906801.1]
    Regard
    Helios

  • Need help with Default Parameter selection

    Hi there ,
    I'm using SSRS 2012 and I've 2 level cascading parameter (section depends on division parameter).
    Division 10 has 2 sections which are 10 and 11.
    Division 20 has 2 section which are 20 and 21.
    Division 30 has 1 section which is 31.
    Division 60 has 2 sections which are 60 and 61.
    I want to set default values to min - max values of Section parameter depends on current values of division parameter.
    In the picture below is the correct result.
    Problem will occur when changing Division.To from 20 to 60.
    I expect the Section.To must changed to max value of it(61) instead the current value(21) like picture below.
    I've checked the query operation using SQL Profiler that tell me the Min - Max dataset of Section parameter NOT BEING FIRED when I change
    Division.To selection.
    FYI.
    I'm using 2 datasets separate for available,default values in each parameter.
    i.e. Section.To parameter  
    1. available values
    SELECT DISTINCT(SectionCode)
    FROM Section
    WHERE DivisionCode BETWEEN @DivFrom and @DivTo
    2. default values
    SELECT MAX(SectionCode) Max
    FROM Section
    WHERE DivisionCode BETWEEN @DivFrom and @DivTo
    Can you give me some advice how to fix this problem ?
    Thank you in advance.
    SweNz

    Hi,
    I had used one sample table to populate your data on top of it i had created report with parameters and got the result as u expected (Hope). Check the below contents to simulate the requirement.
    =====================================================
    CREATE TABLE div_sec
    division int,
    section int,
    range int
    INSERT INTO div_sec (division,section,[range]) values ()
    INSERT INTO div_sec (division,section,[range]) values (10,10,0)
    INSERT INTO div_sec (division,section,[range]) values (10,11,1)
    INSERT INTO div_sec (division,section,[range]) values (20,20,0)
    INSERT INTO div_sec (division,section,[range]) values (20,21,1)
    INSERT INTO div_sec (division,section,[range]) values (30,31,0)
    INSERT INTO div_sec (division,section,[range]) values (30,31,1)
    INSERT INTO div_sec (division,section,[range]) values (60,60,0)
    INSERT INTO div_sec (division,section,[range]) values (60,61,1)
    SELECT * FROM div_sec
    --Created 3 Datasets with the below queries
    --ds_Div
    SELECT distinct division FROM div_sec
    --ds_Sec_Min
    SELECT division, section
    FROM div_sec
    WHERE (range = 0) AND division = @div
    --here for @div assign the value from @DivFrom Parameter
    --ds_Sec_Max
    SELECT division, section
    FROM div_sec
    WHERE (range = 1) AND division = @div
    --here for @div assign the value from @DivTo Parameter
    --Create the 4 parameters
    --DivFrom
    --in available value select the ds_Div dataset
    --DivTo
    --in available value select the ds_Div dataset
    --SecFrom
    --in available and default value select the ds_Sec_Min dataset
    --SecTo
    --in available and default value select the ds_Sec_Max dataset
    =====================================================
    Sridhar

  • Need help about If parameter

    Hello,
    I am a beginner in Java, but I have a little problem that I cannot resolve and I cannot find an answer. Could you please help me.
    My problem is that even when id[n] == Search, found never becomes true.
    Could you tell me where is a mistake please.
    Thanks in advance.
    case 2:
    System.out.println();
    System.out.println("** Search **");
    Search = tast.inWord();
    while (n < i && !found){
    if (id[n] == Search){
    found = true ;
    else {n++;}
    if (found){
    system.out.print("Found");
    else { system.out.print("Not found");
    break;

    If what your comparing is two strings then you can use the .equals() method. If they are not two strings you could try the .toString().equals() methods but this may or may not work depending on the results of toString().

  • I need help getting the kde default cursor in openbox

    I know how to install the kde cursor but I do not no what it is called in archlinux. Can somebody please tell me what it is called

    If I understand, you are using openbox but you want the KDE's cursor, without using KDE.
    You have the theme but :
    - you don't know how to install it ?
    - you dont know the name/ the file path of the current cursor to change it by the new one ?
    - the two options above are the same thing ?
    I found that, but if i didn't understand your problem don't mind.
    http://urukrama.wordpress.com/openbox-g … ousethemes

  • Lexical Parameter help

    Hello,
    In my beforereport trigger, I have Lexical parameter defined as:
    :LP_CUSIP := 'WHERE F.TS_CUSIP = SUBSTR(A.FUND_CUSIP,1,9) AND F.TS_CUSIP = SUBSTR('||''||:PM_FUND||''||',1,9)
    But It gives a REP-1401 :'beforereport': Fatal PL/SQL error occured.
    ORA-06502 : PL/SQL : numeric or value error.
    But the query works fine with :
    where
    f.ts_cusip = substr(a.FUND_CUSIP,1,9)
    and f.ts_cusip = SUBSTR('351899992000',1,9)
    Any help would be appreciated.
    Thanks.

    hi,
    How are you building the query in the data model?
    I'd do this in the data model:
    select
    from
    where ...(another conditions you have or 1=1) &lp_cusip
    And in the "after parameter form",I'd put this code:
    :LP_CUSIP := 'and F.TS_CUSIP = SUBSTR(A.FUND_CUSIP,1,9) AND F.TS_CUSIP = SUBSTR('||''''||:PM_FUND||',1,9)'||'''';
    aguero
    ================
    Gives the compilation error

  • Need help about ref cursor using like table

    Hi Guys...
    I am devloping package function And i need help about cursor
    One of my function return sys_refcursor. And the return cursor need to be
    join another table in database . I don't have to fetch all rows in cursor
    All i need to join ref cursor and another table in sql clause
    like below
    select a.aa , b.cc form ( ref_cursor ) A, table B
    where A.dd = B.dd
    I appeciate it in advance

    My understanding is that you have a function that returns a refcursor and is called by a java app.
    Because this is a commonly used bit of code, you also want to reuse this cursor in other bits of sql and so you want to include it like table in a bit of sql and join that refcursor to other tables.
    It's not as easy as you might hope but you can probably achieve this with pipelined functions.
    Is it a direction that code should be going down? yes, eventually. I like the idea of pulling commonly used bits of code into a SQL statement especially into the WITH section, provided it could be used efficiently by the CBO.
    Is it worth the effort given what you have to do currently to implement it? possibly not.
    what else could you do? construct the sql statement independently of the thing that used it and reuse that sql statement rather than the refcursor it returns?
    Message was edited by:
    dombrooks

  • Passing Condition as lexical parameter

    Hi All,
    I am developing one XML report by using XML Dtata templet.
    I have the require ment like to check the cdition on bassis of the USER Parameter value if the parameter is null then place the min and max value of the column.
    In my data templet I declare the lexical parameter
    And in my PL/SQL package I declare the function where I am building the string.
    When I am submitting the cuncorrent program it is throughing me the error.
    Data templet
    <?xml version="1.0" encoding="UTF-8" ?>
    <dataTemplate name="XXGLR005_1" defaultPackage="XXX_GL_GLSPF_XMLP_PKG" version="1.0">
    <properties>
    <property name="include_parameters" value="true"/>
    <property name ="debug_mode" value="on" />
    </properties>
    <parameters>
              <parameter name="p_ledger" dataType="varchar2"/>
              <parameter name="p_balancing" dataType="varchar2"/>
              <parameter name="p_start_period" dataType="varchar2"/>     
              <parameter name="p_end_period" dataType="varchar2"/>
              <parameter name="p_start_fc" dataType="varchar2"/>
              <parameter name="p_end_fc" dataType="varchar2"/>
              <parameter name="p_start_site" dataType="varchar2"/>          
              <parameter name="p_end_site" dataType="varchar2"/>
              <parameter name="p_where" dataType="varchar2"/>
         </parameters>
    <lexicals>
    </lexicals>
    <dataQuery>
    <sqlStatement name="Q_1">
    <![CDATA[
    SELECT account,
    account_description,
    SUM (amount_period_range) amount_period_range,
    SUM (fisical_ytd_amount) fisical_ytd_amount,
    SUM (cumilative_found) cumilative_found,
    account_type,actual_flag,period_name
    FROM (SELECT gcc.segment4 ACCOUNT, ffv.description account_description,
    (CASE ba.currency_code
    WHEN 'CAD'
    THEN (ba.period_net_dr - ba.period_net_cr)
    ELSE (ba.period_net_dr_beq - ba.period_net_cr_beq)
    END
    ) AS amount_period_range,
    (CASE ba.currency_code
    WHEN 'CAD'
    THEN ( (ba.begin_balance_dr - ba.begin_balance_cr)
    + (ba.period_net_dr - ba.period_net_cr)
    ELSE ( (ba.begin_balance_dr_beq
    - ba.begin_balance_cr_beq
    + (ba.period_net_dr_beq - ba.period_net_cr_beq)
    END
    ) AS fisical_ytd_amount,
    (CASE ba.currency_code
    WHEN 'CAD'
    THEN ( (ba.begin_balance_dr - ba.begin_balance_cr)
    + (ba.project_to_date_dr - ba.project_to_date_cr
    ELSE ( (ba.begin_balance_dr_beq
    - ba.begin_balance_cr_beq
    + ( ba.project_to_date_dr_beq
    - ba.project_to_date_cr_beq
    END
    ) AS cumilative_found,
    gcc.account_type account_type, ba.period_name,
    ba.actual_flag
    FROM gl_code_combinations gcc,
    gl_balances ba,
    gl_periods gp,
    fnd_flex_value_sets fvs,
    fnd_flex_values_vl ffv
    WHERE gcc.code_combination_id = ba.code_combination_id
    AND ba.period_name = gp.period_name
    AND ffv.flex_value_set_id = fvs.flex_value_set_id
    AND ffv.flex_value = gcc.segment4
    AND fvs.flex_value_set_name = 'AHS_ACCOUNT'
    AND ba.actual_flag <> 'B'
    AND gcc.segment1 = '101'
    &p_where
    AND gcc.segment2 BETWEEN '0006' AND '0006'
    AND gcc.segment4 = '31030000'
    AND gp.start_date >= TO_DATE ('01/08/2010', 'DD-MM-YYYY')
    AND gp.end_date <= TO_DATE ('30/11/2010', 'DD-MM-YYYY')
    AND gcc.account_type IN ('E', 'R'))
    GROUP BY period_name, actual_flag, ACCOUNT, account_description, account_type
    ]]>
    </sqlStatement>
    <sqlStatement name="Q_2">
    <![CDATA[
    SELECT NAME LEDGER_NAME
    FROM gl_ledgers
    WHERE ledger_id =:p_ledger
    ]]>
    </sqlStatement>
    </dataQuery>
    <dataTrigger name="beforeReportTrigger" source="XXX_GL_GLSPF_XMLP_PKG.XXX_GL_SPF_SUMMARY_REP" />
    <dataStructure>
         <group name="G_1" source="Q_1">
                   <element name="account" value="account"/>
                   <element name="account_description" value="account_description"/>
                   <element name="amount_period_range" value="amount_period_range"/>
                   <element name="fisical_ytd_amount" value="fisical_ytd_amount"/>
                   <element name="cumilative_found" value="cumilative_found"/>
                   <element name="account_type" value="account_type"/>
         </group>
         <group name="G_2" source="Q_2">
              <element name="LEDGER_NAME" dataType="varchar2" value="LEDGER_NAME"/>
         </group>
         </dataStructure>
    </dataTemplate>
    Package Specification
    CREATE OR REPLACE PACKAGE APPS.XXX_GL_GLSPF_XMLP_PKG AUTHID CURRENT_USER AS
    -- Package Name : XXX_GL_GLSPFDETAIL_XMLP_PKG
    -- Author's Name : Nihar Ranjan Panda
    -- RICE Object id : GL-REP-05
    -- Purpose : Package Specification
    -- Program Style :
    -- Maintenance History
    -- Date Version# Name Remarks
    -- 28-Nov-2010 1.0 Nihar Ranjan Panda Initial Devp
    --Global Parameters
    p_ledger varchar2(100);
    p_balancing varchar2(10);
    p_start_period varchar2(10);
    p_end_period varchar2(10);
    p_start_fc varchar2(20);
    p_end_fc varchar2(20);
    p_start_site varchar2(10);
    p_end_site varchar2(10);
    p_start_mail_id varchar2(30);
    p_end_mail_id varchar2(30);
    p_purge_history varchar2(10);
    p_where varchar2(1000);
    P_CONC_REQUEST_ID number;
    type spf_ref_cursor is REF CURSOR;
    type rec_spf is record
    account varchar2(20),
    account_description varchar2(100),
    amount varchar2(20),
    account_type varchar2(1),
    currency varchar2(3),
    gl_date varchar2(11),
    je_category varchar2(50),
    code_combination_id varchar2(100),
    line_description gl_je_lines.description%Type,
    batch_name gl_je_batches.NAME%Type,
    je_line_num gl_je_lines.je_line_num%TYPE,
    --transaction_date varchar2(11),
    je_header_num gl_je_headers.je_header_id%Type
    function XXX_GL_SPF_SUMMARY_REP return boolean;
    END XXX_GL_GLSPF_XMLP_PKG;
    Package body
    CREATE OR REPLACE PACKAGE BODY APPS.XXX_GL_GLSPF_XMLP_PKG
    AS
    -- Package Name : XXX_GL_GLSPFDETAIL_XMLP_PKG
    -- Author's Name : Nihar Ranjan Panda
    -- RICE Object id : GL-REP-05
    -- Purpose : Package Body
    -- Program Style :
    -- Maintenance History
    -- Date Version# Name Remarks
    -- 28-Nov-2010 1.0 Nihar Ranjan Panda Initial Devp
    FUNCTION XXX_GL_SPF_SUMMARY_REP
    RETURN BOOLEAN
    IS
    l_min_fc VARCHAR2 (20) := '';
    l_max_fc VARCHAR2 (20) := '';
    l_min_site VARCHAR2 (20) := '';
    l_max_site VARCHAR2 (20) := '';
    l_start_date VARCHAR2 (11) := '';
    l_end_date VARCHAR2 (11) := '';
    BEGIN
    IF p_start_fc IS NULL
    THEN
    SELECT MIN (flex_value)
    INTO l_min_fc
    FROM fnd_flex_values_vl
    WHERE flex_value_set_id =
    (SELECT flex_value_set_id
    FROM fnd_flex_value_sets
    WHERE flex_value_set_name = 'AHS_FUNCTIONAL_CENTRE');
    p_start_fc := l_min_fc;
    END IF;
    IF p_end_fc IS NULL
    THEN
    SELECT MAX (flex_value)
    INTO l_max_fc
    FROM fnd_flex_values_vl
    WHERE flex_value_set_id =
    (SELECT flex_value_set_id
    FROM fnd_flex_value_sets
    WHERE flex_value_set_name = 'AHS_FUNCTIONAL_CENTRE');
    p_end_fc := l_max_fc ;
    END IF;
    IF p_start_site IS NULL
    THEN
    SELECT MIN (flex_value)
    INTO l_min_site
    FROM fnd_flex_values_vl
    WHERE flex_value_set_id = (SELECT flex_value_set_id
    FROM fnd_flex_value_sets
    WHERE flex_value_set_name = 'AHS_SITE');
    p_start_site :=l_min_site;
    END IF;
    IF p_end_site IS NULL
    THEN
    SELECT MAX (flex_value)
    INTO l_max_site
    FROM fnd_flex_values_vl
    WHERE flex_value_set_id = (SELECT flex_value_set_id
    FROM fnd_flex_value_sets
    WHERE flex_value_set_name = 'AHS_SITE');
    p_end_site := l_max_site;
    END IF;
    SELECT TO_CHAR (start_date, 'DD-MM-YYYY')
    INTO l_start_date
    FROM gl_periods
    WHERE period_name = p_start_period;
    SELECT TO_CHAR (end_date, 'DD-MM-YYYY')
    INTO l_end_date
    FROM gl_periods
    WHERE period_name = p_end_period;*/
    p_where := ('AND gcc.segment3 BETWEEN '''|| p_start_fc ||''' AND '''||p_end_fc||''
    AND gcc.segment2 BETWEEN '''|| p_start_site ||''' AND '''||p_end_site||'''
    AND gp.start_date >= '''||TO_DATE (l_start_date,'DD-MM-YYYY')||'''
    AND gp.end_date <= '''||TO_DATE (l_end_date,'DD-MM-YYYY')||''''*/
    RETURN (TRUE);
    EXCEPTION
    WHEN OTHERS
    THEN
    raise_application_error (-20101,NULL);
    NULL;
    END XXX_GL_SPF_SUMMARY_REP;
    END XXX_GL_GLSPF_XMLP_PKG;
    Error file
    Custom Extensions: Version : UNKNOWN
    Copyright (c) 1979, 1999, Oracle Corporation. All rights reserved.
    XXGLR005 module: AHS GL SPF Summary Report
    Current system time is 07-DEC-2010 23:39:22
    XDO Data Engine Version No: 5.6.3
    Resp: 20434
    Org ID : 82
    Request ID: 3275555
    All Parameters: p_ledger=2021:p_balancing=101:p_start_period=AUG-10:p_end_period=NOV-10:p_start_fc=71110600018:p_end_fc=71110600018:p_start_site=0006:p_end_site=0006
    Data Template Code: XXGLR005
    Data Template Application Short Name: XXX
    Debug Flag: N
    {p_end_period=NOV-10, p_end_fc=71110600018, p_end_site=0006, p_start_fc=71110600018, p_balancing=101, p_start_period=AUG-10, p_ledger=2021, p_start_site=0006}
    Calling XDO Data Engine...
    [120710_113928978][][STATEMENT] Start process Data
    [120710_113928979][][STATEMENT] Process Data ...
    [120710_113928981][][STATEMENT] Executing data triggers...
    [120710_113928981][][STATEMENT] BEGIN
    XXX_GL_GLSPF_XMLP_PKG.p_ledger := :p_ledger ;
    XXX_GL_GLSPF_XMLP_PKG.p_balancing := :p_balancing ;
    XXX_GL_GLSPF_XMLP_PKG.p_start_period := :p_start_period ;
    XXX_GL_GLSPF_XMLP_PKG.p_end_period := :p_end_period ;
    XXX_GL_GLSPF_XMLP_PKG.p_start_fc := :p_start_fc ;
    XXX_GL_GLSPF_XMLP_PKG.p_end_fc := :p_end_fc ;
    XXX_GL_GLSPF_XMLP_PKG.p_start_site := :p_start_site ;
    XXX_GL_GLSPF_XMLP_PKG.p_end_site := :p_end_site ;
    XXX_GL_GLSPF_XMLP_PKG.p_where := :p_where ;
    :XDO_OUT_PARAMETER := 1;
    END;
    [120710_113928985][][STATEMENT] 1:2021 :
    [120710_113928985][][STATEMENT] 2:101 :
    [120710_113928985][][STATEMENT] 3:AUG-10 :
    [120710_113928985][][STATEMENT] 4:NOV-10 :
    [120710_113928985][][STATEMENT] 5:71110600018 :
    [120710_113928985][][STATEMENT] 6:71110600018 :
    [120710_113928985][][STATEMENT] 7:0006 :
    [120710_113928985][][STATEMENT] 8:0006 :
    [120710_113928985][][STATEMENT] 9:null :
    [120710_113929388][][STATEMENT] Executing data triggers...
    [120710_113929388][][STATEMENT] Declare
    l_flag Boolean;
    BEGIN
    l_flag := XXX_GL_GLSPF_XMLP_PKG.XXX_GL_SPF_SUMMARY_REP ;
    if (l_flag) then
    :XDO_OUT_PARAMETER := 1;
    end if;
    end;
    [120710_113929420][][STATEMENT] p_ledger
    [120710_113929420][][STATEMENT] p_balancing
    [120710_113929420][][STATEMENT] p_start_period
    [120710_113929420][][STATEMENT] p_end_period
    [120710_113929420][][STATEMENT] p_start_fc
    [120710_113929420][][STATEMENT] p_end_fc
    [120710_113929421][][STATEMENT] p_start_site
    [120710_113929421][][STATEMENT] p_end_site
    [120710_113929421][][STATEMENT] p_where
    [120710_113929421][][STATEMENT] Writing Data ...
    [120710_113929426][][STATEMENT] &p_where
    java.lang.NullPointerException
         at oracle.apps.xdo.dataengine.DataTemplateParser.getObjectVlaue(DataTemplateParser.java:1754)
         at oracle.apps.xdo.dataengine.DataTemplateParser.replaceSubstituteVariables(DataTemplateParser.java:1473)
         at oracle.apps.xdo.dataengine.XMLPGEN.processSQLDataSource(XMLPGEN.java:456)
         at oracle.apps.xdo.dataengine.XMLPGEN.writeData(XMLPGEN.java:445)
         at oracle.apps.xdo.dataengine.XMLPGEN.writeGroupStructure(XMLPGEN.java:308)
         at oracle.apps.xdo.dataengine.XMLPGEN.processData(XMLPGEN.java:273)
         at oracle.apps.xdo.dataengine.XMLPGEN.processXML(XMLPGEN.java:215)
         at oracle.apps.xdo.dataengine.XMLPGEN.writeXML(XMLPGEN.java:254)
         at oracle.apps.xdo.dataengine.DataProcessor.processDataStructre(DataProcessor.java:390)
         at oracle.apps.xdo.dataengine.DataProcessor.processData(DataProcessor.java:355)
         at oracle.apps.xdo.oa.util.DataTemplate.processData(DataTemplate.java:334)
         at oracle.apps.xdo.oa.cp.JCP4XDODataEngine.runProgram(JCP4XDODataEngine.java:294)
         at oracle.apps.fnd.cp.request.Run.main(Run.java:157)
    Start of log messages from FND_FILE
    End of log messages from FND_FILE
    Executing request completion options...
    Finished executing request completion options.
    Concurrent request completed
    Current system time is 07-DEC-2010 23:39:29
    Could any body please help me fixing this issue...

    Nihaapps,
    It seems like you are missing a default value for p_where. If data templates have the same requirements as RDFs, then lexicals must have a default value that will be valid when the query is verified. The query would have to be checked for validity, and to do that, it has to fill in a value where &p_where is.
    Kurz

  • Problem when using WEB.SHOW_DOCUMENT and passing in lexical parameter

    Hi,
    I got a blank page with error "An error has occured while trying to use this document" when I tried to use web.show_document and passing a lexical parameter to 10g report on 10gAS. The URL in the web.show_document is:
    http://<srvname>:<portnum>/reports/rwservlet?server=repserver90&report=myrpt.rdf&destype=Cache&desformat=pdf&userid=<usr>/<pw>@<db>&where_clause=where%20product_type%20in%20('REPORT')
    If I change the desformat to htmlcss, it is fine to display the report. But doesn't work with desformat=pdf. The pdf file has been generated in the cache. Why can't it display on the screen.
    Also I tried to use double quote the value for where_clause. The pdf report showed up. But it ignored the where clause.
    Experts please help.
    Ying

    I use lexical parameters and they work fine, but I use a parameter list. The code is contained in a form that is called by all forms that wish to run a report. This way you only need the logic for printing in a single form. If you want the form, email me at [email protected]

  • Need help in multisim 11? I want to get the transient response of RL circuit....

    Need help in multisim 11?
    I want to get the transient response of RL circuit....i can get the increasing exponential graph in multisim 7 during simulation.....but i am getting a decreasing exponential curve(i.e,decay response) in multisim 11 when i do the same procedure as i did in multisim 7.....how can i get the initial or growth transient response for RL circuit in multisim 11 so that i can get increasing exponential curve....which satisfies time constant = L/R

    Hello,
    The process is the same for any circuit (in this case it is an RC circuit which you sent me). You can find the response on the voltage (which I think it's what you're looking for) at any point of the circuit, as well as any parameter really (R,V,I,L..etc).
    Please refer to the image attached (an analysis on the voltage at an inductor and the wires connected to it).
    The way to set it up (once you're in the transient analysis set up) is, select the Output tab, under Variables in circuit, you can select which parameters to take. V(1) and V(2) refer to the voltage in the circuit at Net 1/2 (or wire 1/2).
    This differs from the voltage change within the capacitor/inductor/resistor. If you would like to see the voltage change of an inductor/capacitor/resistor/etc, you can select under the More options box, the button Add device/model parameter, which will take you to a window to select the device type, its name (in the circuit) and the parameter which you wish to analyse. Once you click on Simulate, you can select Cursor >> Show Cursors, to view information for y and x axis (like rise time, decay time, voltage difference...etc)
    Hope this helps,
    Miguel V
    National Instruments
    Attachments:
    untitled.jpg ‏178 KB

Maybe you are looking for