Using case in prompt sql

Hi,
I'm trying to limit values for my dashboard prompt, but with condition.
I have market channel as the first prompt, and customer as the second prompt. If market channel is, let's say, 'OEM', then I want to limit the second prompt only for specific customers (not all OEM). So as the other market channel, I want to pick only some customers for each of them. This is because the measure applied to only these specific customers.
Thanks in advance.
GT

tHEHi,
Thanku for reply.
I used the same approach what did u reply. But still i am facing the similar issue once i say ok to the query.
It is showing the following error:-
Error Codes: OPR4ONWY:U9IM8TAC:OI2DL65P:OI2DL65P
State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 27002] Near <,>: Syntax error [nQSError: 26012] . (HY000)
SQL Issued: {call NQSGetQueryColumnInfo('SELECT CASE WHEN ''MGMT $''=''MGMT $'' THEN SR_QUOTA_ACHIV_AGGR.MGMT_DOLLARS_MTD_AMT ELSE SR_QUOTA_ACHIV_AGGR.LGL_DOLLARS_MTD_AMT, GEO_DIM.AREA, GEO_DIM.AREA_DESC, ORDER_SPLIT.BOOKED_DT, ORDER_SPLIT.ORD_SHIP_TO_SITE_CITY, ORDER_SPLIT.ORD_SHIP_TO_SITE_NBR, ORDER_SPLIT.ORD_SOLD_TO_SITE_CITY, ORDER_SPLIT.ORD_SOLD_TO_SITE_NBR, SR_QUOTA_ACHIV_AGGR.PROD_LINE_CD, SR_QUOTA_ACHIV_AGGR.QUOTA_CREDIT_COUNTRY_KEY, SR_QUOTA_ACHIV_AGGR.SALES_ORG_ID FROM ROAD_RUNNER')}
SQL Issued: SELECT CASE WHEN 'MGMT $'='MGMT $' THEN SR_QUOTA_ACHIV_AGGR.MGMT_DOLLARS_MTD_AMT ELSE SR_QUOTA_ACHIV_AGGR.LGL_DOLLARS_MTD_AMT, GEO_DIM.AREA, GEO_DIM.AREA_DESC, ORDER_SPLIT.BOOKED_DT, ORDER_SPLIT.ORD_SHIP_TO_SITE_CITY, ORDER_SPLIT.ORD_SHIP_TO_SITE_NBR, ORDER_SPLIT.ORD_SOLD_TO_SITE_CITY, ORDER_SPLIT.ORD_SOLD_TO_SITE_NBR, SR_QUOTA_ACHIV_AGGR.PROD_LINE_CD, SR_QUOTA_ACHIV_AGGR.QUOTA_CREDIT_COUNTRY_KEY, SR_QUOTA_ACHIV_AGGR.SALES_ORG_ID FROM ROAD_RUNNER
Thanks

Similar Messages

  • Using CASE in a SQL predicate to return variable IN values ...

    Environment:
    Oracle EE 10.2.0.2 on AIX 5.3
    I am trying to use a CASE statement in a SQL predicate to fill in the values needed in an 'IN' clause.
    Here is my test case:
    create table tt (model varchar2(10), brand varchar2(10));
    insert into tt (model, brand) values ('modela','ajax');
    insert into tt (model, brand) values ('modelb','ajax');
    insert into tt (model, brand) values ('modelc','acme');
    insert into tt (model, brand) values ('modeld','acme');
    insert into tt (model, brand) values ('modele','acme');
    insert into tt (model, brand) values ('modelf','zeus');
    insert into tt (model, brand) values ('modelg','zeus');
    insert into tt (model, brand) values ('modelh','mojo');
    insert into tt (model, brand) values ('modeli','mojo');
    insert into tt (model, brand) values ('modelj','mama');
    Here is what I'm attempting to do. For a given starting letter for a brand I would like all the models printed out whose brand starts with the entered letter.
    Here is what I started with:
    select model, (case '&brandfirstletter'
    when 'a' then '(''ajax'',''acme'')'
    when 'z' then '(''zeus'')'
    when 'm' then '(''mojo'')'
    end) pred
    from tt
    where brand in
    (case '&brandfirstletter'
    when 'a' then '(''ajax'',''acme'')'
    when 'z' then '(''zeus'')'
    when 'm' then '(''mojo'')'
    end);
    When executed I get 'no rows selected'
    I wanted to print out the results of my CASE statement just to be sure it was doing what I thought I wanted.
    When I comment out the WHERE clause to see what the PRED values are I get:
    gww@dwt1> /
    Enter value for brandfirstletter: a
    old 1: select model, (case '&brandfirstletter'
    new 1: select model, (case 'a'
    Enter value for brandfirstletter: a
    old 8: -- (case '&brandfirstletter'
    new 8: -- (case 'a'
    MODEL PRED
    modela ('ajax','acme')
    modelb ('ajax','acme')
    modelc ('ajax','acme')
    modeld ('ajax','acme')
    modele ('ajax','acme')
    modelf ('ajax','acme')
    modelg ('ajax','acme')
    modelh ('ajax','acme')
    modeli ('ajax','acme')
    modelj ('ajax','acme')
    I believe this is what I want the results of the CASE statement to look like when I select 'a' for the substitute variable but I don't get the output I would like from the table.
    What am I missing?
    Thanks very much!!
    -gary

    gwicke wrote:
    select model, (case '&brandfirstletter'
    when 'a' then '(''ajax'',''acme'')'
    when 'z' then '(''zeus'')'
    when 'm' then '(''mojo'')'
    end) pred
    from tt
    where brand in
    (case '&brandfirstletter'
    when 'a' then '(''ajax'',''acme'')'
    when 'z' then '(''zeus'')'
    when 'm' then '(''mojo'')'
    end);You can't do this.
    ok, let's imagine you provide an 'a' as your substitution variable. What you get as a result is...
    select model, (case 'a'
    when 'a' then '(''ajax'',''acme'')'
    when 'z' then '(''zeus'')'
    when 'm' then '(''mojo'')'
    end) pred
    from tt
    where brand in
    (case 'a'
    when 'a' then '(''ajax'',''acme'')'
    when 'z' then '(''zeus'')'
    when 'm' then '(''mojo'')'
    end);
    so if we logically remove the case statement as oracle would do when processing...
    select model, ('(''ajax'',''acme'')') pred
    from tt
    where brand in ('(''ajax'',''acme'')');
    Are you really going to have a brand that is stored as
    (''ajax'',''acme'')as a single value?
    You can't dynamically assign values to an IN list.

  • Help needed in SQL performance - Using CASE in SQL statement versus 2 query

    Hi,
    I have a requirement to find count from a bunch of tables.
    The SQL I have gives the count of all members.
    I have created 2 queries to find count of active and inactive members.
    The key difference is only the active dates.
    Each query takes 20 seconds to execute.
    I modified the SQL to use CASE statement in the SELECT.
    So after the data is fetched the CASE statement will evaluate the active date and gives 2 counts (active and inactive)
    Is it advisable to use this approach. Will CASE improve SQL performance ? I have to justify this.
    Please let me know your thoughts.
    Thanks,
    J

    Hi,
    If it can be done in single SQL do it in single SQL.
    You said:
    Will CASE improve SQL performance There can be both cases to prove if the performance is better or worse.
    In your case you should tell us how it is.
    Regards,
    Bhushan

  • Pure SQL and Border Use Cases?

    Hi Gurus
    I was developing a DB Adapter to select data from Shipping tables. I did it by polling as well as with Custom SQL. While using the custom SQL I got the following error in my domain.log
    (my query that I wrote) failes, Caused by java.sql.SQLException: Invalid column index.
    The Pure SQL option is for border use cases only and provides simple yet minimal functionality. Possibly try the "Perform an operation on a table" option instead.
    What is a border use case, how do I decide that. So BPEL support the custom sql option very loosely?
    Thx

    The thing is that XSLT often doesn't deliver the functionality required when it comes to times.
    You suggest appening "Z" to the time but this means that the time is now in UTC time. What if the system from where the date is being converted is running in NZ using local time? Other systems that recieve the date (and correctly handle the time zone) will now have a time that is out by a number of hours.
    You often can't ignore the time zone (drop the 'Z') as if you send the time to a system it has to either assume the time is local to it (which may not be the case... the other system coudl be in a different time zone) or assume the time is UTC (I think crossfire does this by default).
    Typically can't just append a time zone (e.g. +11:00) either as many places have daylight savings so the value to appended is variable (you then need some way of determining what the value is... either Java Embedding or a Service).
    As you mention it does depend on the use case but in many circumstances using Jaba Embedding, not as suggested above but with the appropriate Java.util.Calendar classes, is the best way to handle date and time in BPEL. Even still you need to ascertain the format of times external to the system and ensure you parse them correctly.
    ANd even if you do all this you can still run into problems. I've seen a real world example where two systems which both handled time zones correctly and had previously been working together for quite a while, satrted reporting different times. It turns out that only one of them had had the most recent Java Time Zone patches applied and there had been a change in the dates for daylight savings here (Australia). Be warned!

  • Getting PL/SQL:ORA-00933 when using CASE logic as a control structure

    Hello Everybody,I have created a PL/SQL block(Control Structure) to calculate bonus of employees based on salary of the employee,but I get errors like ORA-00933 and ORA-06550.Given below is the PL/SQL block which I tried to implement
    SQL> DECLARE
    2
    3 v_EMPNO NUMBER(7,2):= &p_EMPNO;
    4 v_SAL EMP.SAL%TYPE;
    5 v_BONUS NUMBER;
    6
    7 BEGIN
    8 SELECT SAL
    9 FROM EMP
    10 INTO v_SAL
    11 WHERE EMPNO = v_EMPNO;
    12
    13 v_BONUS :=
    14 CASE v_SAL
    15 WHEN v_SAL = 0 THEN 0
    16 WHEN v_SAL < 1500 THEN (0.1*v_SAL)
    17 WHEN v_SAL BETWEEN 1500 AND 3000 THEN (0.15*v_SAL)
    18 WHEN v_SAL > 3000 THEN (0.20*v_SAL)
    19 END;
    20
    21 DBMS_OUTPUT.PUT_LINE(' EMPNO '||v_EMPNO||' SALARY '||v_SAL||' BONUS '||V_BONUS);
    22
    23 END;
    24 /
    Enter value for p_empno: 7100
    old 3: v_EMPNO NUMBER(7,2):= &p_EMPNO;
    new 3: v_EMPNO NUMBER(7,2):= 7100;
    INTO v_SAL
    ERROR at line 10:
    ORA-06550: line 10, column 7:
    PL/SQL: ORA-00933: SQL command not properly ended
    ORA-06550: line 8, column 7:
    PL/SQL: SQL Statement ignored
    Is it that I can not use "CASE" as a control structure in the above block , when I code
    "SELECT SAL
    FROM EMP
    INTO v_SAL
    WHERE EMPNO = v_EMPNO;" to get v_SAL and then use it in CASE exp to calculate a value for v_Bonus.
    Kindly let me know.

    Hi,
    The CASE Expression is also available in PL/SQL.
    Try this code:
    DECLARE
       V_EMPNO   NUMBER (7, 2)  := 7788;
       V_SAL     EMP.SAL%TYPE;
       V_BONUS   NUMBER;
    BEGIN
       SELECT SAL
         INTO V_SAL
         FROM EMP
        WHERE EMPNO = V_EMPNO;
       V_BONUS :=
          CASE
             WHEN V_SAL = 0
                THEN 0
             WHEN V_SAL < 1500
                THEN (0.1 * V_SAL)
             WHEN V_SAL BETWEEN 1500 AND 3000
                THEN (0.15 * V_SAL)
             WHEN V_SAL > 3000
                THEN (0.20 * V_SAL)
          END;
       DBMS_OUTPUT.PUT_LINE (   ' EMPNO '
                             || V_EMPNO
                             || ' SALARY '
                             || V_SAL
                             || ' BONUS '
                             || V_BONUS
    END;As you are Using,Comparison Expression to find a match, Your Searched CASE Expression should be something like this.
    DECLARE
      sal       NUMBER := 2000;
      sal_desc  VARCHAR2(20);
    BEGIN
      sal_desc := CASE
                     WHEN sal < 1000 THEN 'Low'
                     WHEN sal BETWEEN 1000 AND 3000 THEN 'Medium'
                     WHEN sal > 3000 THEN 'High'
                     ELSE 'N/A'
                  END;
      DBMS_OUTPUT.PUT_LINE(sal_desc);
    END;If you are Using CASE as a Value matching then your piece of code should be like this..
    DECLARE
      deptno     NUMBER := 20;
      dept_desc  VARCHAR2(20);
    BEGIN
      dept_desc := CASE deptno
                     WHEN 10 THEN 'Accounting'
                     WHEN 20 THEN 'Research'
                     WHEN 30 THEN 'Sales'
                     WHEN 40 THEN 'Operations'
                     ELSE 'Unknown'
                   END;
      DBMS_OUTPUT.PUT_LINE(dept_desc);
    END;Thanks,
    Shankar

  • Need help in this sql query to use Case Statement

    hi All,
    I have the below query -
    SELECT DISTINCT OFFC.PROV_ID
    ,OFFC.WK_DAY
    ,CASE
    WHEN OFFC.WK_DAY ='MONDAY' THEN 1
    WHEN OFFC.WK_DAY ='TUESDAY' THEN 2
    WHEN OFFC.WK_DAY ='WEDNESDAY' THEN 3
    WHEN OFFC.WK_DAY ='THURSDAY' THEN 4
    WHEN OFFC.WK_DAY ='FRIDAY' THEN 5
    WHEN OFFC.WK_DAY ='SATURDAY' THEN 6
    WHEN OFFC.WK_DAY ='SUNDAY' THEN 7
    END AS DOW
    ,OFFC.OFFC_OPENG_TIME
    ,OFFC.OFFC_CLSNG_TIME
    FROM GGDD.PROV_OFFC_HR OFFC
    WHERE OFFC.PROV_ID='0000600'
    WITH UR;
    this query is bringing results in 6 differnt rows with opening and closing time for each day separately. I want to generate the data in one row with each day having opening and closing time, so for 7 days, total 14 columns with opening and closing time. But i am not able to do that using case statement.
    can somebody help me in achieving that.
    thanks,
    iamhere

    Hi,
    Welcome to the forum!
    That's called a Pivot .
    Instead of having 1CASE expression, have 14, one for the opening and one for the closing time each day, and do GROUP BY to combine them onto one row.
    SELECT       OFFC.PROV_ID
    ,       MIN (CASE WHEN OFFC.WK_DAY ='MONDAY'    THEN OFFC.OFFC_OPENG_TIME END)     AS mon_opn
    ,       MIN (CASE WHEN OFFC.WK_DAY ='MONDAY'    THEN OFFC.OFFC_CLSNG_TIME END)     AS mon_cls
    ,       MIN (CASE WHEN OFFC.WK_DAY ='TUESDAY'   THEN OFFC.OFFC_OPENG_TIME END)     AS tue_opn
    ,       MIN (CASE WHEN OFFC.WK_DAY ='TUESDAY'   THEN OFFC.OFFC_CLSNG_TIME END)     AS tue_cls
    FROM        GGDD.PROV_OFFC_HR OFFC
    WHERE       OFFC.PROV_ID     = '0000600'
    GROUP BY  offc.prov_id
    ;This assumes there is (at most) only one row in the table for each distinct prov_id and weekday. If not, what do you want to do? Post a little sample data (CREATE TABLE and INSERT statements) and the results you want from that data.
    The staement above works in Oracle 8.1 and up, but there's a better way (SELECT ... PIVOT) available in Oracle 11. What version are you using? (It's always a good idea to include this when you post a question.)
    Edited by: Frank Kulash on Jan 6, 2011 8:22 PM

  • Sql proposed to use case statement

    Hi All
    Can anyone help me here
    This code works fine,here inthe inner sub queries(b,c,d,e,f),i am getting the weekly counts of usage data from the table mf_wer_OBI_USAGE_reqq.
    As this is hitting same table with the similar set of queries so i was adviced to use case statement by taking the wk_1...5 in variable and making the query better
    I am unable to figure out how to proceed.
    Appreciate your help here.
    Thanks
    create table mf_wer_OBI_USAGE_reqq_WK
    as select x.user_name id,x.mon MONTH_COUNT,x.wk_1 WEEK1_COUNT,x.wk_2 WEEK2_COUNT,x.wk_3 WEEK3_COUNT,x.wk_4 WEEK4_COUNT,x.wk_5 WEEK5_COUNT,x.subject_area_name,
    y.EMP_FIRST_NAME FIRSTNAME,y.EMP_LAST_NAME SURNAME,y.E_MAIL_ADDRESS USER_MAILID,y.ouc OUC
    from (select a.user_name,a.mon,a.subject_area_name,b.wk_1,c.wk_2,d.wk_3,e.wk_4,f.wk_5
    from (select user_name,sum(count_us_st) mon,subject_area_name from mf_wer_OBI_USAGE_reqq group by user_name,subject_area_name) a,
    (select user_name,sum(count_us_st) wk_1,subject_area_name from mf_wer_OBI_USAGE_reqq where extract(day from start_dt) between 1 and 7
    group by user_name,subject_area_name) b,
    (select user_name,sum(count_us_st) wk_2,subject_area_name from mf_wer_OBI_USAGE_reqq where extract(day from start_dt) between 8 and 14
    group by user_name,subject_area_name) c,
    (select user_name,sum(count_us_st) wk_3,subject_area_name from mf_wer_OBI_USAGE_reqq where extract(day from start_dt) between 15 and 21
    group by user_name,subject_area_name) d,
    (select user_name,sum(count_us_st) wk_4,subject_area_name from mf_wer_OBI_USAGE_reqq where extract(day from start_dt) between 22 and 28
    group by user_name,subject_area_name) e,
    (select user_name,sum(count_us_st) wk_5,subject_area_name from mf_wer_OBI_USAGE_reqq where extract(day from start_dt) between 29 and 31
    group by user_name,subject_area_name) f
    where a.user_name=b.user_name(+)
    and a.subject_area_name=b.subject_area_name(+)
    and a.user_name=c.user_name(+)
    and a.subject_area_name=c.subject_area_name(+)
    and a.user_name=d.user_name(+)
    and a.subject_area_name=d.subject_area_name(+)
    and a.user_name=e.user_name(+)
    and a.subject_area_name=e.subject_area_name(+)
    and a.user_name=f.user_name(+)
    and a.subject_area_name=f.subject_area_name(+)) x,
    dm_employee y
    where x.user_name=y.id and
    y.active_flg='Y';

    Swas_fly wrote:
    This code works fineIf it's fine, why try to fix it?
    Post your table (only the relevant columns as a CREATE TABLE statement) and some sample data (INSERT into) and your required output.
    Post your code between these tags:                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                

  • Using Ranking on MS SQL Server 2005

    Hello,
    We are on BOXI3.1 base version and have a universe on top of MS SQL Server 2005.
    My question is regarding use of rank functions. BO guides state that
    You can perform a database ranking only if your database supports
    it. If this is not the case, the Add a database ranking button is disabled on
    the Query Panel toolbar. Databases that support ranking are Oracle, DB2,
    Terradata and Redbrick.
    So SQL Server is not in the list. However the add database ranking button is enabled on
    my report panel. If i add a ranking the query runs for a long time and times-out.
    Is there any universe parameter i need to enable to use ranking? Has any-one mangaged to
    use ranking functionality with SQL Server 2005.
    Thanks in advance.

    Hi Bashir Awan,
    When we create this Object (using your example) at Universe level is the ranking hardcoded ?
    My questions is, say i have Product object (with values A, B, C, D, E), and sales aggregated (10, 20, 30, 40, 50, 60, 70, 80, 90, 100)
    Say the table is as follows
    Product;        sales
        A;               10
        A;                70*
        B;                 50
        B;                 20*
        C;                 30
        C;                 60*
        D;                 40
        D;                 90
        E;                 80
        E;                100
    Note: * represents Oversees sales outside US
    Case 1: Now when we rank whole data to select top 3 we should get (E, D, C in Desc order)
    Case 2: Now if I apply prompt on Country of sales as US will I get (E, B, D) or is it still (E, D, C as earlier).
    Case 3: Similarly if I apply prompt on Product (no prompt on Country) in the filter pane and select (A, D, E) will my results show (E, D, A) or (E, D) as the value of A may be restricted due to ranking formula based on sales at Universe level.
    I am sorry I may be asking a very basic question. Thanks
    Sudhir.

  • Using a Variable Prompt - In an analysis using Top N filter (URGENT)

    Hi Experts
    I have created a variable prompt that is setup in the following way :
    Prompt Name : Number_of_rows
    User Input : Radio Buttons
    Radio Button Values : *1/ 2* (Custom Values)
    Variable Data Type : Number
    Default Selection : *1* (Specific Custom Value)
    I have an analysis/ report that has the following columns Customer ID | Number of Orders
    I have applied a top N filter to this report using the varibale prompt :
    *Number of Orders  is in top  @{Number_of_rows}* (which is equivelent to Number of Orders is in top 1 or 2)
    However when I view the report im getting the following error
    View Display Error
    Error getting drill information: SELECT "Customer"."Customer ID" saw_0, "Sales Facts"."Number of Orders" saw_1 FROM "Sales" WHERE TOPN("Sales Facts"."Number of Orders",Number_of_rows) <= Number_of_rows
    Error Details
    Error Codes: YQCO4T56:OPR4ONWY:U9IM8TAC:OI2DL65P
    Location: saw.views.evc.activate, saw.httpserver.processrequest, saw.rpc.server.responder, saw.rpc.server, saw.rpc.server.handleConnection, saw.rpc.server.dispatch, saw.threadpool, saw.threadpool, saw.threads
    Odbc driver returned an error (SQLExecDirectW).
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 43113] Message returned from OBIS. [nQSError: 27005] Unresolved column: "Number_of_rows". (HY000)
    SQL Issued: {call NQSGetLevelDrillability('SELECT "Customer"."Customer ID" saw_0, "Sales Facts"."Number of Orders" saw_1 FROM "Sales" WHERE TOPN("Sales Facts"."Number of Orders",Number_of_rows) <= Number_of_rows')}
    Please can you help
    Kind Regards
    Hiten
    Edited by: #:::HITEN:::# on 29-Nov-2012 04:24

    I'll put this as below
    My prompt will have the TopN which can be formated by TopN Orders and setting this as Presentation variable as N
    SELECT TOPN("#Sales",10) FROM "SA" order by Product
    In the report I'm using same column (Orders) with expression as below.
    TOPN("#Sales", cast(@{N}{2} as int))
    If this is not helpful for you then try to pass some default value for the Presentation variable

  • Using DECODE Function in SQL

    I need to know if there is any way to use a range of values from
    database and decode to certain text. I am able to do with one
    value.
    for example:
    DECODE(column_name,'216767111','Unlimited',column_name)
    above argument works with one value only. How about a range,
    ex: 216767000 to 216767111. I need to use only SQL. No PL/SQL.
    Kinldly need some body's help
    Thanks
    Munis

    Which version of the database? If it's 8i+ then you can use
    the CASE function
    for example:
    (CASE WHEN column_name between 216767000 and 216767111
    THEN 'Unlimited' ELSE column_name END)
    This won't work in PL/SQL because they're introducing a CASE
    statement does soemthing different.
    rgds, APCHello Andrew
    Thank you for response. I am using 8i. 8.1.6. However using
    CASE, I get inconsistent data type, ORA-00932: inconsistent
    datatypes. I able to work it out with other response using
    DECODE(sign(. Do you have any idea why i am getting this error.
    If time permits, let me know

  • Using a custom PL/SQL to populate the primary key in a tabular form

    I want to use a Custom PL/SQL Function to populate the primary key when I insert a new record into a tabular form. I want to get the value from a hidden page Item. The code I am using for the primary key source is:
    BEGIN
    INSERT INTO TEAM_MEMBERS(TEAM_ID)
    VALUES(:P75_TEAM_ID);
    END;
    When I try to insert a new record I get the following error:
    Error      ERR-1904 Unable to compute item default: type = Function Body computation_type= BEGIN INSERT INTO TEAM_MEMBERS(TEAM_ID) VALUES(:P75_TEAM_ID); END; .
    ORA-06550: line 5, column 2: PLS-00103: Encountered the symbol ";" when expecting one of the following: begin case declare end exception exit for goto if loop mod null pragma raise return select update while with << close current delete fetch lock insert open rollback savepoint set sql execute commit forall merge pipe The symbol "exit" was substit
    Any ideas what I am doing wrong?
    Thanks!

    Brian - Sometimes whitespace at the end of the block causes this. Be sure to trim everything after the last semicolon including tabs and newlines.
    Scott

  • How to use, Case function and Filter in Column Formula?

    Hello All,
    I am using case function and also would like to filter value to populate.
    Below is showing error :
    case
    when '@{Time}' = 'Year' then "Time"."Fiscal Year"
    when '@{Time}' = 'Quarter' then "Time"."Fiscal Quarter"
    when '@{Time}' = 'Month' then FILTER ("Time"."Fiscal Period" USING "Time"."Fiscal Period" NOT LIKE 'A%')
    else ifnull('@{Time}','Selection Failed') end
    Thanks, AK

    when '@{Time}' = 'Month' then FILTER ("Time"."Fiscal Period" USING "Time"."Fiscal Period" NOT LIKE 'A%')I dont think Filter this works here or any other data types except number.
    Try to use option Column's->Filter->Advanced->Convert this filter to SQL
    If helps mark

  • (new?) performance problem using jDriver after a Sql Server 6.5 to 2000 conversion

    Hi,
    This is similar - yet different - to a few of the old postings about performance
    problems with using jdbc drivers against Sql Server 7 & 2000.
    Here's the situation:
    I am running a standalone java application on a Solaris box using BEA's jdbc driver
    to connect to a Sql Server database on another network. The application retrieves
    data from the database through joins on several tables for approximately 40,000
    unique ids. It then processes all of this data and produces a file. We tuned
    the app so that the execution time for a single run through the application was
    24 minutes running against Sql Server 6.5 with BEA's jdbc driver. After performing
    a DBMS conversion to upgrade it to Sql Server 2000 I switched the jDriver to the
    Sql Server 2000 version. I ran the app and got an alarming execution time of
    5hrs 32 min. After some research, I found the problem with unicode and nvarchar/varchar
    and set the "useVarChars" property to "true" on the driver. The execution time
    for a single run through the application is now 56 minutes.
    56 minutes compared to 5 1/2 hrs is an amazing improvement. However, it is still
    over twice the execution time that I was seeing against the 6.5 database. Theoretically,
    I should be able to switch out my jdbc driver and the DBMS conversion should be
    invisible to my application. That would also mean that I should be seeing the
    same execution times with both versions of the DBMS. Has anybody else seen a
    simlar situation? Are there any other settings or fixes that I can put into place
    to get my performance back down to what I was seeing with 6.5? I would rather
    not have to go through and perform another round of performance tuning after having
    already done this when the app was originally built.
    thanks,
    mike

    Mike wrote:
    Joe,
    This was actually my next step. I replaced the BEA driver with
    the MS driver and let it run through with out making any
    configuration changes, just to see what happened. I got an
    execution time of about 7 1/2 hrs (which was shocking). So,
    (comparing apples to apples) while leaving the default unicode
    property on, BEA ran faster than MS, 5 1/2 hrs to 7 1/2 hrs.
    I then set the 'SendStringParametersAsUnicode' to 'false' on the
    MS driver and ran another test. This time the application
    executed in just over 24 minutes. The actual runtime was 24 min
    16 sec, which is still ever so slightly above the actual runtime
    against SS 6.5 which was 23 min 35 sec, but is twice as fast as the
    56 minutes that BEA's driver was giving me.
    I think that this is very interesting. I checked to make sure that
    there were no outside factors that may have been influencing the
    runtimes in either case, and there were none. Just to make sure,
    I ran each driver again and got the same results. It sounds like
    there are no known issues regarding this?
    We have people looking into things on the DBMS side and I'm still
    looking into things on my end, but so far none of us have found
    anything. We'd like to continue using BEA's driver for the
    support and the fact that we use Weblogic Server for all of our
    online applications, but this new data might mean that I have to
    switch drivers for this particular application.Thanks. No, there is no known issue, and if you put a packet sniffer
    between the client and DBMS, you will probably not see any appreciable
    difference in the content of the SQL sent be either driver. My suspicion is
    that it involves the historical backward compatibility built in to the DBMS.
    It must still handle several iterations of older applications, speaking obsolete
    versions of the DBMS protocol, and expecting different DBMS behavior!
    Our driver presents itself as a SQL7-level application, and may well be treated
    differently than a newer one. This may include different query processing.
    Because our driver is deprecated, it is unlikely that it will be changed in
    future. We will certainly support you using the MS driver, and if you look
    in the MS JDBC newsgroup, you'll see more answers from BEA folks than
    from MS people!
    Joe
    >
    >
    Mike
    The next test you should do, to isolate the issue, is to try another
    JDBC driver.
    MS provides a type-4 driver now, for free. If it is significantly faster,
    it would be
    interesting. However, it would still not isolate the problem, because
    we still would
    need to know what query plan is created by the DBMS, and why.
    Joe Weinstein at BEA
    PS: I can only tell you that our driver has not changed in it's semantic
    function.
    It essentially send SQL to the DBMS. It doesn't alter it.

  • Problems using Quick Migrate in SQL Developer 1.5 for MySQL to Oracle 10g

    Hi all,
    I am trying to use SQL Developer 1.5 migration tools (Quick Migrate) to perform online capture and build source model to migrate from MySQL 5.x to Oracle 10g on Windows platform. I get these errors and the Quick Migrate process fails:
    oracle.dbtools.metadata.persistence.PersistableObject.doInsert(PersistableObject.java:238)
    I did a search and used the sqldeveloper.cmd script but still fails. Then I created a new database and truncated the repository. I now get the above error plus two new ones listed below:
    oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
    Error loading nls:OALL8 is in an inconsistent state
    Error occurred during capture: Protocol violation
    It fails during the capture process for MySQL 5.1 database
    when it begins to capture the tables from MySQL.
    Does anyone know how to resolve these issues when migrating from MySQL to Oracle 10g using Quick Migrate with SQL Developer 1.5 release?
    Regards,
    Ben Prusinski
    Message was edited by:
    benprusinski
    Message was edited by:
    benprusinski

    Hi all,
    I put the following in my sqldeveloper.cmd file:
    SET ORACLE_HOME=%CD%
    What is very confusing is that with SQL Developer 1.5, there are several levels and several SQL Developer executables! I am really not sure which of these to use:
    I created the SQLDeveloper 1.5 directory called SQLDeveloper1_5 on Windows:
    1) cd C:\sqldeveloper1_5\sqldeveloper-5338
    there exists a sqldeveloper.exe
    2) cd c:\sqldeveloper1_5\sqldeveloper-5338\sqldeveloper\sqldeveloper.exe
    3) cd c:\sqldeveloper1_5\sqldeveloper-5338\sqldeveloper\sqldeveloer\bin\sqldeveloper.exe
    Which SQLDeveloper 1.5 executable should I be using and where should I place the
    sqldeveloper.cmd file?
    Also I did try to use a different database and schema for the repository with Quick Migrate but it appears a bug exists in SQL Developer 1.5 version that causes errors with Quick Migrate for MySQL to Oracle? Is this correct?
    As an update, I ran the following commands:
    cd to
    c:\sqldeveloper1_5\sqldeveloper-5338\sqldeveloper\sqldeveloper\bin
    sqldeveloper.cmd sqldeveloper.exe
    Start sqldeveloper.exe
    Perform standard capture for MySQL using the new mig2 schema as the new repository
    It starts the capture but fails on the errors below:
    Error loading nls:OALL8 is in an inconsistent state
    UPDATE
    ============================
    I tried this again and it worked with the exception of one error message listed below:
    Here are the steps that I followed:
    1. Create a Windows cmd script
    Put the following entries in the script:
    SET ORACLE_HOME=%CD%
    save the command windows script as sqldeveloper.cmd
    Copy this script to the base installation directory for SQLDeveloper
    Example:
    1. cd c:\SQLDeveloper1_5\sqldeveloper-5338\sqldeveloper
    2. Start SQLDeveloper with the command script that you created earlier
    Example:
    Open a Windows shell prompt window and execute the following scripts:
    a) sqldeveloper.cmd sqldeveloper.exe
    b) sqldeveloper.exe
    3) In SQL Developer 1.5
    From the Migrate menu,
    a) Delete current repository and create a new schema in Oracle target database call it mig2.
    b) Then create a new repository in SQL Developer 1.5
    c) Right mouse click on the MySQL 5.x database and choose capture
    It worked with the exception of one error message:
    o.jdbc.driver.OracleDriver     
    Error while registering Oracle JDBC Diagnosability MBean.
    So it looks like something is screwed up with my JDBC drivers and configuration for MySQL. How do I diagnose the JDBC driver issue for MySQL?
    Thanks!!!
    Ben
    Thanks
    Ben

  • How to build dynamic query strings in the query using DB adapter 'Pure SQL'

    Dear Forum,
    I am building an application which will access DB to fetch some result set. The query involves retrieving data from multiple tables(nearly 10 tables). So I have created a DB adapter using 'execute pure sql' option. With this query works fine, but my inputs parameters will vary. So I need to make my query dynamic to append the query strings at runtime depending on the inputs.
    For example I have 3 input variables - input1,input2 and input3 (in my request xsd) which are used in the pure sql query. Now if I get a 4th input parameter input4 in the request, I need to append this to query string as 'AND input4=[some value]' at runtime. Otherwise my query should have only 3 parameters. Please suggest how this can be achieved.
    Regards,
    Satya.

    This is a strange requirement, depending on the columns you have and what are optional in them, one way is to have separate operations and each opeartion will have different inputs and for each operation , a different DB Adapter is called. But this way, it results in more number of operations for the service as well as more number of references in the composite. Even if you pass the column inputs to the SQL procedure, it will result in a large number of if-else cases..
    Thanks,
    N

Maybe you are looking for

  • Multi mapping and message splitting in BPM

    Hi , I am working with this scenario ... /people/sudharshan.aravamudan/blog/2005/12/01/illustration-of-multi-mapping-and-message-split-using-bpm-in-sap-exchange-infrastructure how many message interfaces i have to create . one outbound , one abstract

  • Authorization object coding in ABAP report

    Hi, I am working on a report. The output of the report is details regarding vendor based on purchasing organization. When user executes the reports, they should be only able to see details if they are authorized to (create, change and display) for th

  • HT1310 Mac os x is stuck on creating a user account start up page.  How do I make it actually go through and successfully creating a new user

    Mac is stuck or creating a new administrator account and does not completely do it.  It just goes in circles.  It does not confirm the account was created and does not display the last thank for creating the user message.  Can I fix it from the boot

  • Address book on iCloud

    After having bought a new iMac and register to iCloud, I noticed after a while that certain names on my Address book on iCloud were reproduced a great number of times, contaminating also my new iMac. Yesterday, I erased all the adress book on iCloud,

  • Dump error in alv

    hi all,        I have developed a rewport for excise returns. Inmy final internal table all corresponding datas were updated. but while performing the function module 'reuse_alv_grid_display' i'm getting a dump error        'GETWA_NOT_ASSIGNED