Binding parameters to dynamic VO with PL/SQL API call with no where clause

Hi all,
I am required to change exisiting queries to queries with "bind" parameters. Some of our VOs are dynamic and with PL/SQL api calls like below:
String stmtStr = "selectXXX_API_UTILS.chk_urg_since_last_prg("
+ projectId + "," + PPCId + ",'XYZ_TASKS'," + taskId+ ")"
+" from dual ";
ViewObject tmpVO = transaction.createViewObjectFromQueryStmt(stmtStr);
In this regard, I am unsure how to bind the PPCId and taskId parameters to the VO. setWhereClauseParams() would not work here as there is now where clause.
Thanks in advance,
Srini

In case of preparedStatement, we mention bind parameters to be passed using "?". Then we pass paramters sequencially.
But in the your case following is enough:
int projectId = 100 ; (hardcoding values for example)
int taskId = 500 ;
String stmtStr = "selectXXX_API_UTILS.chk_urg_since_last_prg("
+ projectId + "," + PPCId + ",'XYZ_TASKS'," + taskId+ ")"
+" from dual ";
-Anand

Similar Messages

  • How to create a procedure to output REF CURSOR with any WHERE clause?

    I have an requirement like this: I have huge query which need to reuse in my code more than 10 times. This SQL has about 50 lines. Thing is for those 10 odd times sometimes the WHERE clause changes (columns are the same). So I cannot create a view since SQL is not static.
    I thought of writing a procedure with a WHERE_CLAUSE input para. I output a sys refcursor by adding the where clause. But I can't do it since you cannot add a where clause like that.
    i.e.
    PROCEDURE dynamyic_query (p_where_clause IN VARCHAR2, p_out_query OUT SYS_REFCURSOR ) IS
    BEGIN
      OPEN p_out_query FOR SELECT ......... FROM table WHERE || ' ' || p_where_clause;
    END;The above gives error.
    How to handle a situation like this???? Any help would be greatly appreciated.

    I tried this method:
    I created a table tab_test which has these records:
    TNAME                          TABTYPE    CLUSTERID                                                                                                                                                                  
    ABS_V4_P_ERROR_MESSAGES        TABLE                                                                                                                                                                                  
    ABS_V4_P_ORG_PARAM             TABLE                                                                                                                                                                                  
    ABS_V4_P_PARAMETER             TABLE                                                                                                                                                                                  
    ABS_V4_P_SYS_PARAM             TABLE                                                                                                                                                                                  
    ACCINTERFACE_PARAMETERS        TABLE                                                                                                                                                                                  
    ACCOUNTS                       TABLE                                                                                                                                                                                  
    ACCOUNT_EXTRACT_PERIODS        TABLE                                                                                                                                                                                  
    ACCOUNT_EXTRACT_PERIODS#       TABLE                                                                                                                                                                                  
    ACCOUNT_EXTRACT_PERIODS_1      TABLE                                                                                                                                                                                   Now I create this proc:
    PROCEDURE FORMS_TEXT_DYN_SQL_TEST(p_where_cluase IN VARCHAR2, p_out_cursor OUT SYS_REFCURSOR) IS
      v_stmt VARCHAR2(1000);
    BEGIN
      v_stmt := 'SELECT tname FROM tab_test WHERE tname LIKE ''%ABS_V4%'' AND tabtype = :x';
      OPEN p_out_cursor FOR v_stmt using p_where_cluase;
    END;I create this code block and run it:
    declare
      v_tname varchar2(200);
      out_cursor sys_refcursor;
    begin
      forms_text_dyn_sql_test('TABLE', out_cursor );
      LOOP
        fetch out_cursor INTO v_tname;
        exit when out_cursor%NOTFOUND;
        DBMS_OUTPUT.PUT_LINE(v_tname);
      END LOOP;
    end;
    /I get correct output:
    ABS_V4_P_ERROR_MESSAGES
    ABS_V4_P_ORG_PARAM
    ABS_V4_P_PARAMETER
    ABS_V4_P_SYS_PARAMHowever, when I change the proc like this:
    PROCEDURE FORMS_TEXT_DYN_SQL_TEST(p_where_cluase IN VARCHAR2, p_out_cursor OUT SYS_REFCURSOR) IS
      v_stmt VARCHAR2(1000);
    BEGIN
      v_stmt := 'SELECT tname FROM tab_test WHERE tname LIKE ''%ABS_V4%'' AND :y';
      OPEN p_out_cursor FOR v_stmt using p_where_cluase;
    END;And run this code block:
    declare
      v_tname varchar2(200);
      out_cursor sys_refcursor;
    begin
      forms_text_dyn_sql_test(' 1 = 1 ', out_cursor );
      LOOP
        fetch out_cursor INTO v_tname;
        exit when out_cursor%NOTFOUND;
        DBMS_OUTPUT.PUT_LINE(v_tname);
      END LOOP;
    end;
    /I get error:
    [1]: (Error): ORA-00920: invalid relational operator ORA-06512: at "ABS.FORMS_TEXT_DYN_SQL_TEST", line 6 ORA-06512: at line 5Looks like you can only put column_name = :z, column_name = :y type values. You cannot it seems replace it with any WHERE CLAUSE????

  • "create columns with a where clause" in BMM

    Hi All,
    I have a question about OBI EE Meta data layer.
    We have OBIEE sitting on a Data Warehouse with a star schema.
    Our Fact table holds the following fields...
    EmployeeID
    CompanyID
    Measure ID
    Measure Name
    MEASURE
    This is what we have in the physical layer, BMM layer and the presentation layer but I want to be able to "create columns with a where clause"
    So my fact table in the presentation layer would look like this
    Amount Sold
    Unit Cost
    Company Amount
    I thought I could just create a logical column with
    Amount Sold = Measure
    where Measure Name = "Amount Sold"
    But I can't seem to find any to do that.
    Any ideas?
    Thanks

    Or you simply map your measure in the Logical Table source as something like :
    CASE WHEN MEASURE_NAME = 'Amount Sold' THEN MEASURE ELSE 0 END.
    You need to decide if you want the where clause adding in the Logical table source (be careful you will need a seperate LTS for each measure, this will mean more than one SQL being fired when you have more than one measure in the report).
    Or you go with this case method on each measure, be able to have all the measures mapped in 1 LTS, include all those in the report and they will be retrieved by one SQL block.

  • Using SAMPLE with a WHERE clause

    (Oracle 9iR2)
    I am using the SAMPLE keyword in a SELECT statement with a WHERE clause. Is the sample extracted before or after applying the WHERE clause?
    For example, if I have the statement:
    SELECT emp_id FROM employees SAMPLE(10)
    WHERE salary > 50000;
    Does the database first extract a 10% sample of all the rows and then apply the salary filter on the sample (meaning it's possible that no rows are returned even though there are rows with salary > 50000)? Or does it return a 10% sample of the rows that meet the filter condition (meaning rows will always be returned as long as there are rows with salary > 50000)?

    The sample is extracted before the where clause:
    SQL> drop table sample_test;
    Table dropped.
    SQL> create table sample_test (id number, salary number);
    Table created.
    SQL>
    SQL> begin
    2 for i in 1..99 loop
    3 insert into sample_test values (i, 100);
    4 end loop;
    5
    6 insert into sample_test values (100, 1000);
    7 end;
    8 /
    PL/SQL procedure successfully completed.
    SQL>
    SQL> commit;
    Commit complete.
    SQL>
    SQL> select * from sample_test sample(5)
    2 where salary > 100;
    no rows selected

  • Insert Row is visible in other VO with excluded where-clause

    Hi,
    i found something that makes me a little bit confusing about ADF BC...
    TestCase:
    Env:
    JDev 10.1.2     
    HR Schema / Table "regions"
    All Objects created ´by ADF BC Wizards
    - ViewObject A and ViewObject B based on Entity "Regions"
         - ViewObject A with WHERE-CLAUSE region_id=10 at DesignTime
    - ViewObject B with NO WHERE-CLAUSE (select * from regions)
    JUnitTest:
    public void testInsertRow()
    ViewObject viewA = fixture1.getApplicationModule().findViewObject("RegionsAView");
    ViewObject viewB = fixture1.getApplicationModule().findViewObject("RegionsBView");
    System.out.println("ViewA:"+viewA.getRowCount()); //-->0
    assertTrue("Must 0 ! region_id = 10",viewA.getRowCount() == 0);
    Row row = viewB.createRow();
    row.setAttribute("RegionId",new Number(99));
    row.setAttribute("RegionName","NRW");
    viewB.insertRow(row);
    System.out.println("ViewB:"+viewB.getRowCount()); // -> 5
    System.out.println("ViewA:"+viewA.getRowCount()); // -> 1
    //this assert failt !
    assertTrue("Must 0 ! where clause is region_id = 10 and insert region_id was 99 ",viewA.getRowCount() == 0);
    Is this a bug or feature ? Can anybody explain that behavior ? thx :)
    uli

    See this article on my blog for an explanation and a code sample for how to gain more fine-grained control over this View Link Consistency feature...
    http://radio.weblogs.com/0118231/2004/02/27.html#a242

  • Using Parameters in SQL-Query not only in where clauses

    Hi,
    I try to use Publisher parameters in the SQL Query from a Data Set.
    All of them have default values.
    So far, this is no problem, unless I try to use such a parameter value as an ordinary attribute value:
    >
    select
         case when (:pv_Group = 'no') then "DM15D_BETRIEBSTEIL"."BETR_TEIL"
                                            else :pv_some_Text end                                                                  as Betr_Teil,
         case when (:pv_Group = 'no') then "DM15D_BETRIEBSTEIL"."SUVA_NR_FORM"
                                            else :pv_some_Text end                                                        as Suva_Nr,
         case when (:pv_Group = 'no') then "DM15K_RIS_FAKTEN_PRO_BTT_JHR"."RIS_VOLLBESCH"
                                            else sum("DM15K_RIS_FAKTEN_PRO_BTT_JHR"."RIS_VOLLBESCH") end      as Vollbesch
    from "GDWH05"
    where
         "DM15D_BETRIEBSTEIL"."SUVA_NR_FORM" in (:pv_nim100)
         fetch first 65001 rows ONLY
    >
    The parameters 'pv_Group' and 'pv_nim100' are working fine. (when or where clauses)
    The parameter 'pv_some_Text' unfortunately not. (simple literals)
    When I try to validate the above SQL, I get the following Error:
    <font color="red">
    java.io.IOException: prepare query failed[nQSError: 43113] Message returned from OBIS. [nQSError: 46033] Datatype: 25 is not supported.
    </font>
    After use a cast function:
    >
    else CAST(:pv_some_Text AS CHARACTER)
    >
    I get this ERROR:
    <font color="red">
    java.io.IOException: prepare query failed[nQSError: 43113] Message returned from OBIS. [nQSError: 19002] Incorrect use of parameters. The parameters used in CAST cannot be resolved without ambiguity.
    </font>
    We use OBIEE 11.1.1.6.4 on a Win64-System.
    Thank's for any help.

    Hi Alex,
    let's leave away any unnecessary details.
    This is the SQL, inserted in the window 'Edit Data Set' of BIP Data Model:
    >
    select
         '--1'     as Betr_Teil,
         '--2'      as Suva_Nr,
         sum("GDWH05"."DM15K_RIS_FAKTEN_PRO_BTT_JHR"."RIS_VOLLBESCH") as Vollbesch
    from "GDWH05"
    where
         "DM15D_BETRIEBSTEIL"."SUVA_NR_FORM" in ('122-4.4')
         fetch first 65001 rows ONLY
    >
    Everything is fine when I click OK, the script goes back to the metadata.
    Let's try this script with bind values in ORACLE SQL Developer.
    This SQL is the physical part, found in the OBIEE-Log (Log level 5), except the bind values. Therefore we find, in the where clause, the join. In the logical sql, we don't have to join, because it's handled in the Common Enterprise Information Model (CEIM)
    >
    with
    sawith0 as
    select
    sum(t39617.ris_vollbesch) as c1
    from
    dm15d_betriebsteil t39455,
    dm15k_ris_fakten_pro_btt_jhr t39617
    where
    t39455.id_betriebsteil = t39617.id_betriebsteil
    and t39455.suva_nr_form = '122-4.4'
    select
    d1.c1 as c1,
    d1.c2 as c2,
    d1.c3 as c3
    from
    select
    :pv_some_text as c1,
    :pv_some_text as c2,
    sum(d1.c1) as c3
    from
    sawith0 d1
    d1
    where
    rownum <= 65001
    >
    This SQL works fine, even with bind values for 'pv_some_text'.
    But, when using the following SQL in the BIP Data Model:
    >
    select
         :pv_Text as Betr_Teil,
         :pv_Text as Suva_Nr,
         sum("GDWH05"."DM15K_RIS_FAKTEN_PRO_BTT_JHR"."RIS_VOLLBESCH") as Vollbesch
    from "GDWH05"
    where
         "DM15D_BETRIEBSTEIL"."SUVA_NR_FORM" in ('122-4.4')
         fetch first 65001 rows ONLY
    >
    The following ERROR occurs:
    <font color="red">java.io.IOException: prepare query failed[nQSError: 43113] Message returned from OBIS. [nQSError: 46008] Internal error: File server\Query\Optimizer\ServiceInterfaceMgr\Utility\Src\SQOIUTypeVisitor.cpp, line 643.</font>
    In my opinion, either I use a wrong syntax, or BIP has a problem with parsing the script.
    Thank you for your most welcome help.

  • Query SQL datastore with XML where clause source

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

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

  • Outer join with a WHERE clause

    hi, this is driving me round the bend. I thought i was ok with sql joins and the like, but im really struggling on this one.
    I have table A (for argument sake tblRegion) and table B (tblBranch). if i want to return everything i would do something like this:-
    select * from tblRegion join tblBranch on tblRegion.id=tblBranch.reg_id.
    If i wanted to return all regions even if they do have a branch associated i would do something like this:-
    select * from tblRegion left outer join tblBranch on tblRegion.id=tblBranch.reg_id.
    My problem is, I want to return all Regions and use a WHERE clause to narrow the Branch results.
    I've tried something like this but it doesnt work
    select * from tblRegion left outer join tblBranch on tblRegion.id=tblBranch.reg_id WHERE branch.name like 'LONDON%'
    Is there anyway i can return all branches where name is like LONDON, and STILL return all Region if there is no data for that Region?
    Do i need to use a nested select statement maybe?
    Many thanks in anticipation somebody will save me from my current madness. David

    Check this link. It explains the most common problem/coding error while using outer join.
    http://www.orafaq.com/node/855
    Effectively in your case you need the following condition in your where clause
    where nvl(branch.name,'LONDON') like 'LONDON%'
    Hope that helps.
    Regards
    Raj

  • Performance with unspecific where clause

    Hi gurus,
    at the moment I do have a sql statement on a view with an unspecific where clause like
    select from <view> where <textfield> like %whatIsearch%
    The text field is not in the key fields which are used to create the view. An index on <textfield> does not help, because the where clause starts with a %.
    Other databases like Oracle do finish the statement within seconds, maxdb needs minutes.
    I there a possibility to speedup the statement in MaxDB? (Besides telling the user to use better qualified statments.)
    Why is Oracle that fast?
    Thanks for you help.
    Best regards
    Christian G

    > Other databases like Oracle do finish the statement within seconds, maxdb needs minutes.
    > I there a possibility to speedup the statement in MaxDB? (Besides telling the user to use better qualified statments.)
    > Why is Oracle that fast?
    Hi Christian,
    In that case Oracle can take advantage from beeing able to brute-force read many blocks at once (aka multiblock read).
    When we assume that there is an index on the oracle database available, then Oracle will likely decide to read all blocks of that index into the cache and look for matches then. It's called Fast Full Scan.
    It's not a very efficient method to address specific rows, but for this requirement it works well.
    Anyhow, you should be aware that this way of evaluating rows does not scale very well - in fact it get's more expensive with every block the index grows.
    MaxDB cannot easily read all blocks in a row, due to the fact that the pages are mixed over all data volumes. This way of storing data eliminates the need for reorganisations and evens out I/O traffic, but it comes for the price of beeing less performant when people use such unefficient predicates.
    Because of this and the way who indexes work in MaxDB (primary keys instead of rowids), MaxDB does only consider an index access for like conditions that start with a '%' when the query can be answered by only accessing the index (index only access).
    What you may try out to improve the situation is to activate the experimental read-ahead or prefetch feature, which is currently available in MaxDB 7.6. only (not in 7.5 or in 7.7).
    By setting READAHEAD_TABLE_THRESHOLD to a value >0, say 128, MaxDB can choose to
    perform table scans (no index scans!) in parallel with multiple server tasks for all table scans that are expected to pass the threshold (unit here is pages as visible in the execution plan of your statement).
    That way the usertask running the query can work on checking the data in the pages, while the server task load the pages into the cache.
    Another approach would be to have the DB Cache big enough so that most of the table would be found in the cache.
    regards,
    Lars

  • A somewhat more complex use of EXECUTE_QUERY with a Where clause...

    Basically, what I need to be able to do is when the form receives a certain parameter upon opening; it must immediately run a certain query and populate the data blocks.
    I do understand the concept of setting the DEFAULT_WHERE in the PRE_QUERY trigger for the block; but I don't think this will work in my situation.
    The reason being is that each data block must run 2 separate queries; and BOTH resulting queries must be populated to each data block, and not overwrite eachother...
    Not only that, but the query being executed requires me to reference 2 separate tables (the data coming from one, however its comparing results from 2 separate tables, so I don't think simply modifying the where clause for the data block will even be possible to achieve the results I am looking for.
    Maybe further explanation of my queries may help the situation. Basically, each data block is linked to a table for the current logged in user, and then there is a production table as well. When ANYTHING is modified, added, or deleted on the current user's table, they are suppose to "publish" the record to the production table. The EXECUTE_QUERY statement will be responsible for running the query that will populate ALL the records that have yet to be published to the production table. So basically, its running a query that will use an ID and compare each individual field by that ID for any changes from the production table. Then, it runs another query to find records that are in either the production table or user table, and not the other; to flag a new record or deleted record.
    I've been thinking about possible ways to do this, but have had no luck unfortunately;
    ANY guidance will be greatly appreciated it. I do understand that my description of the problem may be hard to comprehend, so if you need further clarification please ask.
    Jason
    Message was edited by:
    user558647

    It would be helpful to give an example of the sort of data in each table and what you want to show in each block. I probably didn't understand most of what you wrote but I think the following may be analogous to your situation and requirements (but you'll have more columns of course):
    SQL> CREATE TABLE t_user AS
      2    SELECT
      3      ROWNUM id,
      4      object_name col1,
      5      object_type col2
      6    FROM all_objects
      7    WHERE ROWNUM < 10;
    Table created.
    SQL>
    SQL> DELETE FROM t_user WHERE id = 1;
    1 row deleted.
    SQL>
    SQL> CREATE TABLE t_published AS
      2    SELECT
      3      ROWNUM id,
      4      CASE Mod(ROWNUM,2)
      5        WHEN 0 THEN SubStr(object_name,1,2)
      6        ELSE object_name
      7        END AS col1,
      8      object_type col2
      9    FROM all_objects
    10    WHERE ROWNUM < 9;
    Table created.
    SQL>
    SQL>
    SQL> SELECT * FROM t_user;
            ID COL1                           COL2
             2 I_USER1                        INDEX
             3 CON$                           TABLE
             4 UNDO$                          TABLE
             5 C_COBJ#                        CLUSTER
             6 I_OBJ#                         INDEX
             7 PROXY_ROLE_DATA$               TABLE
             8 I_IND1                         INDEX
             9 I_CDEF2                        INDEX
    8 rows selected.
    SQL> SELECT * FROM t_published;
            ID COL1                           COL2
             1 ICOL$                          TABLE
             2 I_                             INDEX
             3 CON$                           TABLE
             4 UN                             TABLE
             5 C_COBJ#                        CLUSTER
             6 I_                             INDEX
             7 PROXY_ROLE_DATA$               TABLE
             8 I_                             INDEX
    8 rows selected.
    SQL>
    SQL> -- yet to be published to the production table
    SQL> -- includes records previously published and then updated, but not new
    SQL> -- records which have never been published (these are in the other query)
    SQL> SELECT u.id, u.col1, u.col2
      2  FROM t_user u, t_published p
      3  WHERE u.id = p.id
      4  AND (
      5    u.col1 != p.col1
      6    OR u.col2 != p.col2
      7    )
      8  ;
            ID COL1                           COL2
             2 I_USER1                        INDEX
             4 UNDO$                          TABLE
             6 I_OBJ#                         INDEX
             8 I_IND1                         INDEX
    SQL>
    SQL> -- new and deleted records
    SQL> SELECT * FROM(
      2    SELECT id, col1, col2, 'NEW' status FROM t_user
      3    UNION ALL
      4    SELECT id, col1, col2, 'DELETED' status FROM t_published
      5  )
      6  WHERE id NOT IN(
      7    SELECT id FROM t_user
      8    INTERSECT
      9    SELECT id FROM t_published
    10  )
    11  ;
            ID COL1                           COL2                STATUS
             9 I_CDEF2                        INDEX               NEW
             1 ICOL$                          TABLE               DELETED
    SQL> Basically, I think the answer is in the query and not the Where Clause.
    I think you want one of these queries in each block, so set the blocks' queries (are you changing that query based on the parameter passed in, or just executing the query, you're not clear on that) and then do
    go_block('B2');
    execute_query;
    go_block('B1');
    execute_query;

  • Finding undisplayable characters in a field with a WHERE clause

    Oracle_Rdb7 for_OpenVMS Release 7.0.1. I have a field in my table that has been loaded with data that contains "return/line feed" characters (I'm not sure of the ASCII hex representation) which can't be displayed and show up as "." on my screen. How can I code a WHERE clause that will find these characters, e.g., SELECT * FROM TABLE1 WHERE NAME CONTAINING <here is where I want to put the ASCII hex value for a "return/line feed" character>? Also, how could I get the actual ASCII hex code for these characters to display, e.g., "31" instead of "1"?

    a 'return' is CHR(10) So you can:
    select * from my_table where text_fld like '%'||CHR(10)||'%'

  • Most efficient way to get row count with a where clause

    Have not found a definitive answer on how to do this.  Is there a better way to get a row count from a large table that needs to satisfy a where clause like so:
    SELECT COUNT(*) FROM BigTable WHERE TypeName = 'ABC'
    I have seen several posts suggesting something like 
    SELECT COUNT(*) FROM BigTable(NOLOCK);
    and 
    selectOBJECT_NAME(object_id),row_count from sys.dm_db_partition_stats
    whereOBJECT_NAME(object_id)='BigTable'but I need the row count that satisfies my where clause (i.e.: WHERE TypeName = 'ABC')

    It needs index to improve the performance. 
    - create index on typename column
    - create a indexed view to do the count in advance
    -partition on type name (although it's unlikely) then get count from the system tables...
    all those 3 solutions are about indexing.
    Regards
    John Huang, MVP-SQL, MCM-SQL, http://www.sqlnotes.info

  • How to use division with a Where() clause

    I have to report four specific time periods dynamically so I made Date variables. I cannot use division of the metrics without applying the date codes to the individual metrics. There has to be a way I am not thinking of. This is a massive report so I need to keep variables to a minimum.
    Example:
    [Sales 1] / [Quota 1] = Percent to Quota
    I have a Date Variable for Quarter to Date: [Months in QTD] That returns multiple "Fiscal Periods" (months) per date formulas
    However, to get the right time period data using DIVISION, say for Quarter To Date I have to use:
    [Sales 1] Where( [Fiscal Period] = [Months In QTD]) / [Quota 1] Where( [Fiscal Period] = [Months In QTD])
    The above returns the correct value for the three months in the quarter.
    That would be OK except I need an IF..Then..ElseIf..Else statement to solve for zeros and nulls and it gets very long adding the “Where( [Fiscal Period] = [Months In QTD])” to every measure in the statement.
    I have tried nesting:  =(SUM(  [Sales 1] ) / Sum( [Quota 1) ) Where( [Fiscal Period] = [Months In QTD])
    And that does not work as with other attempts to nest.
    I tried an IF( [Fiscal Period] = [Months In QTD] … but it returns MULTI error I assume becaause the variable [Months in QTD] delivers more that one Fiscal Period.
    Come on brainac’s.  Division has its own rules but there should be a way.
    Thank you.

    Hi,
    Just to give you rough idea. I would suggest you to apply following logic at query level.
    Create a query with prompt and try to get Months in QTD there only a single object.
    Now apply filter on second query "where result from another query" that will filter data for perticular quarter.
    I hope you can understand.
    Thanks,
    Swapnil

  • How do i dynamically reference the contents of an item in a where clause

    I have a select statement that references an item i.e. 'where sysdate=:diary.day1' at the moment, however i want to use this select to loop through every day of the week, so on the fist record it will change depending on where you are in the loop either 'where sysdate=:diary.day1' or 'where sysdate=:diary.day2' etc. I tried using a variable for this but it just uses the characters ':diary.day1' and not the contents of this item.

    Not sure what you want but dynamic reference the content of an item may be done with NAME_IN builtin.
    WHERE sysdate = TO_DATE( NAME_IN(var), 'fmt')
    where var is a variable which contain item name, for example 'DAIRY.DAY1'
    P.S. SYSDATE function contain not only date but time portion too.
    So very little chances that this equation will be true

  • How to select value from database view with * in wher clause

    Hi ,
      I ahve a database view with some fields.
    Now my requirement is to serach a single row on the basis of process type.
    Process type can have values like ZBA,ZBC,ZBD,ZBE or similarly anything starting with ZB.
    Now i know that starting two letters will be ZB , but dont knwo the last letter.
    So how should i use select query for the same?
    Should i use like operator for the same?
    regards
    PG

    hi,
    u can use character '%'.sample code like this
    SELECT reltype
                 instid_a
                 catid_a
                 instid_b
                 FROM /dbm/ord_docflow
                 INTO TABLE it_link
                 FOR ALL ENTRIES IN it_pnwtyh
                 WHERE  instid_a  =  it_pnwtyh-instid_a AND
                 instid_b  LIKE 'QMSM%'  AND
                 typeid_a  = 'BUS2400'  AND
                 typeid_b  = 'BUS2400' AND
                 catid_a   = 'BO' AND
                 catid_b   = 'BO' AND
                 reltype   = 'VONA'.
    this is similar to using* while we fetch values from table.in the above code only i no QMSM rest values not sure,so used QMSM%

Maybe you are looking for