Where case when query not running at all in 11.2.0.3

Hi,
I have a query that was running fine till the time we were in 11.1.0.7. Last month, we had a migration to 11.2.0.3, and the query has stopped running since then. It runs indefinitely, and finally I have to kill it. However, until 11.1.0.7, I had absolutely no problems with it. Not sure what changed in 11.2.0.3 that causes it to never give me a result. The query is as below:
SELECT T1.NAME,T2.AGE,T2.level, T2.AMT,
FROM table1 T1, table2 T2
WHERE (CASE WHEN
(T1.name = 'Peter' AND SUBSTR(T1.desc,1,15)=SUBSTR(T2.description,1,15))
THEN 1
ELSE 0
END)=1;
Please advise!
Thanks in advance.

Hi,
CrazyAnie wrote:
Hi,
I have a query that was running fine till the time we were in 11.1.0.7. Last month, we had a migration to 11.2.0.3, and the query has stopped running since then. It runs indefinitely, and finally I have to kill it. However, until 11.1.0.7, I had absolutely no problems with it. Not sure what changed in 11.2.0.3 that causes it to never give me a result. The query is as below:
SELECT T1.NAME,T2.AGE,T2.level, T2.AMT,
FROM table1 T1, table2 T2
WHERE (CASE WHEN
(T1.name = 'Peter' AND SUBSTR(T1.desc,1,15)=SUBSTR(T2.description,1,15))
THEN 1
ELSE 0
END)=1;
Please advise!I'm surprised it runs in any version. You have a comma right before the keyword FROM. If you were not getting a compile-time error, that was a bug in 11.1.0.7 that they fixed by 11.2.0.3.
It's still strange that the query runs for a long time. I would expect it to give you an error when you tried to compile it. Is there any chance that what you posted is not what you're actually running?
Also, LEVEL, NAME and DESC are not good column names. How Oracle reacts to using keywords like that as column names can vary from version to version. If a word is in v$reserved_words.keyword, then it's best to avoid using it as a column (or table, or variable, or schema) name.
Edited by: Frank Kulash on Nov 21, 2012 1:33 PM
By the way, that WHERE clause is a lot more complicated than it needs to be. Why not use
WHERE      t1.name = 'Peter'
AND      SUBSTR ( t1."DESC"     -- If you must use DESC, double-quote it
            , 1
            , 15
            ) = SUBSTR ( t2.description
                           , 1
                 , 15
                 )? Always think carefully before using CASE in a WHERE (or HAVING, or START WITH, or CONNECT BY) clause.

Similar Messages

  • Help: I want to auto schedule a load using file watcher but it runs only once for the first time and after that it is not running at all

    Hi All,
    I am trying  to execute the below code as provided from one of the blogs. i am able to run the job only once based on a file watcher object(i.e. for very first time) and after that the job is not running at all and if  i schedule the job to run automatically based on interval of 10 or more minutes it is executing properly). Please let me know or guide me if i have missed any step or configuration.that is needed.
    Version of Oracle 11.2.0.1.0
    OS : Windows 7 Prof
    Given all the necessary privileges
    BEGIN
      DBMS_SCHEDULER.CREATE_CREDENTIAL(
         credential_name => 'cred',
         username        => 'XXXX',
         password        => 'XXXX');
    END;
    CREATE TABLE ZZZZ (WHEN timestamp, file_name varchar2(100),
       file_size number, processed char(1));
    CREATE OR REPLACE PROCEDURE YYYY
      (payload IN sys.scheduler_filewatcher_result) AS
    BEGIN
      INSERT INTO ZZZZ VALUES
         (payload.file_timestamp,
          payload.directory_path || '/' || payload.actual_file_name,
          payload.file_size,
          'N');
    END;
    BEGIN
      DBMS_SCHEDULER.CREATE_PROGRAM(
        program_name        => 'prog1',
        program_type        => 'stored_procedure',
        program_action      => 'YYYY',
        number_of_arguments => 1,
        enabled             => FALSE);
      DBMS_SCHEDULER.DEFINE_METADATA_ARGUMENT(
        program_name        => 'prog1',
        metadata_attribute  => 'event_message',
        argument_position   => 1);
      DBMS_SCHEDULER.ENABLE('prog1');
    END;
    BEGIN
      DBMS_SCHEDULER.CREATE_FILE_WATCHER(
        file_watcher_name => 'file_watcher1',
        directory_path    => 'D:\AAAA',
        file_name         => '*.txt',
        credential_name   => 'cred',
        destination       => NULL,
        enabled           => FALSE);
    END;
    BEGIN
      DBMS_SCHEDULER.CREATE_JOB(
        job_name        => 'job1',
        program_name    => 'prog1',
        queue_spec      => 'file_watcher1',
        auto_drop       => FALSE,
        enabled         => FALSE);
      DBMS_SCHEDULER.SET_ATTRIBUTE('job1','PARALLEL_INSTANCES',TRUE);
    END;
    EXEC DBMS_SCHEDULER.ENABLE('file_watcher1,job1');
    Regards,
    kumar.

    Please post a copy and paste of a complete run of a test case, similar to what I have shown below.
    SCOTT@orcl12c> SELECT banner FROM v$version
      2  /
    BANNER
    Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
    PL/SQL Release 12.1.0.1.0 - Production
    CORE    12.1.0.1.0    Production
    TNS for 64-bit Windows: Version 12.1.0.1.0 - Production
    NLSRTL Version 12.1.0.1.0 - Production
    5 rows selected.
    SCOTT@orcl12c> CONN / AS SYSDBA
    Connected.
    SYS@orcl12c> -- set file watcher interval to one minute:
    SYS@orcl12c> BEGIN
      2    DBMS_SCHEDULER.SET_ATTRIBUTE
      3       ('file_watcher_schedule',
      4        'repeat_interval',
      5        'freq=minutely; interval=1');
      6  END;
      7  /
    PL/SQL procedure successfully completed.
    SYS@orcl12c> CONNECT scott/tiger
    Connected.
    SCOTT@orcl12c> BEGIN
      2    -- create credential using operating system user and password (fill in your own):
      3    DBMS_SCHEDULER.CREATE_CREDENTIAL
      4       (credential_name     => 'cred',
      5        username          => '...',
      6        password          => '...');
      7  END;
      8  /
    PL/SQL procedure successfully completed.
    SCOTT@orcl12c> -- create table to insert results into:
    SCOTT@orcl12c> CREATE TABLE ZZZZ
      2    (WHEN      timestamp,
      3      file_name varchar2(100),
      4      file_size number,
      5      processed char(1))
      6  /
    Table created.
    SCOTT@orcl12c> -- create procedure to insert results:
    SCOTT@orcl12c> CREATE OR REPLACE PROCEDURE YYYY
      2    (payload IN sys.scheduler_filewatcher_result)
      3  AS
      4  BEGIN
      5    INSERT INTO ZZZZ VALUES
      6        (payload.file_timestamp,
      7         payload.directory_path || '/' || payload.actual_file_name,
      8         payload.file_size,
      9         'N');
    10  END;
    11  /
    Procedure created.
    SCOTT@orcl12c> -- create program, define metadata, and enable:
    SCOTT@orcl12c> BEGIN
      2    DBMS_SCHEDULER.CREATE_PROGRAM
      3       (program_name          => 'prog1',
      4        program_type          => 'stored_procedure',
      5        program_action      => 'YYYY',
      6        number_of_arguments => 1,
      7        enabled          => FALSE);
      8    DBMS_SCHEDULER.DEFINE_METADATA_ARGUMENT(
      9       program_name         => 'prog1',
    10       metadata_attribute  => 'event_message',
    11       argument_position   => 1);
    12    DBMS_SCHEDULER.ENABLE ('prog1');
    13  END;
    14  /
    PL/SQL procedure successfully completed.
    SCOTT@orcl12c> BEGIN
      2    -- create file watcher:
      3    DBMS_SCHEDULER.CREATE_FILE_WATCHER
      4       (file_watcher_name   => 'file_watcher1',
      5        directory_path      => 'c:\my_oracle_files',
      6        file_name          => 'f*.txt',
      7        credential_name     => 'cred',
      8        destination          => NULL,
      9        enabled          => FALSE);
    10  END;
    11  /
    PL/SQL procedure successfully completed.
    SCOTT@orcl12c> BEGIN
      2    -- create job:
      3    DBMS_SCHEDULER.CREATE_JOB
      4       (job_name          => 'job1',
      5        program_name          => 'prog1',
      6        queue_spec          => 'file_watcher1',
      7        auto_drop          => FALSE,
      8        enabled          => FALSE);
      9    -- set attributes:
    10    DBMS_SCHEDULER.SET_ATTRIBUTE ('job1', 'PARALLEL_INSTANCES', TRUE);
    11  END;
    12  /
    PL/SQL procedure successfully completed.
    SCOTT@orcl12c> -- enable:
    SCOTT@orcl12c> EXEC DBMS_SCHEDULER.enable ('file_watcher1, job1');
    PL/SQL procedure successfully completed.
    SCOTT@orcl12c> -- write file (file must not exist previously):
    SCOTT@orcl12c> CREATE OR REPLACE DIRECTORY upncommon_dir AS 'c:\my_oracle_files'
      2  /
    Directory created.
    SCOTT@orcl12c> declare
      2    filtyp utl_file.file_type;
      3  begin
      4    filtyp := utl_file.fopen ('UPNCOMMON_DIR', 'file1.txt', 'W', NULL);
      5    utl_file.put_line (filtyp, 'File has arrived ' || SYSTIMESTAMP, TRUE);
      6    utl_file.fclose (filtyp);
      7  end;
      8  /
    PL/SQL procedure successfully completed.
    SCOTT@orcl12c> -- wait long enough (may take more than one minute) for job to run:
    SCOTT@orcl12c> EXEC DBMS_LOCK.SLEEP (100)
    PL/SQL procedure successfully completed.
    SCOTT@orcl12c> -- check for results:
    SCOTT@orcl12c> SELECT * FROM zzzz
      2  /
    WHEN
    FILE_NAME
    FILE_SIZE P
    22-OCT-13 10.12.28.309000 PM
    c:\my_oracle_files/file1.txt
            57 N
    1 row selected.
    SCOTT@orcl12c> declare
      2    filtyp utl_file.file_type;
      3  begin
      4    filtyp := utl_file.fopen ('UPNCOMMON_DIR', 'file2.txt', 'W', NULL);
      5    utl_file.put_line (filtyp, 'File has arrived ' || SYSTIMESTAMP, TRUE);
      6    utl_file.fclose (filtyp);
      7  end;
      8  /
    PL/SQL procedure successfully completed.
    SCOTT@orcl12c> -- wait long enough (may take more than one minute) for job to run:
    SCOTT@orcl12c> EXEC DBMS_LOCK.SLEEP (100)
    PL/SQL procedure successfully completed.
    SCOTT@orcl12c> -- check for results:
    SCOTT@orcl12c> SELECT * FROM zzzz
      2  /
    WHEN
    FILE_NAME
    FILE_SIZE P
    22-OCT-13 10.12.28.309000 PM
    c:\my_oracle_files/file1.txt
            57 N
    22-OCT-13 10.14.08.580000 PM
    c:\my_oracle_files/file2.txt
            57 N
    2 rows selected.

  • I can't make movie, case when i try do it all time paw disappear-

    I can't make movie, case when i try do it all time paw disappear and i can't drag over part of video than when i try do that again part of video drag over in the place where must be the following piece and remains at this place as I did not change screen and it did not switch the window....  Halp me.

    Apple - Support - Mac Apps - iMovie
    If the linked Support articles do not help you, the video tutorials below may:
    Apple Tutorial Videos
    If you are still having trouble, try to ask your question in different words
    or post it in your native language.  Someone here may be able to help you.
    Message was edited by: EZ Jim
    Mac OSX 10.8.5

  • The Elements 12 Mac disk works fin - I also have a Dell, and the Windows disk will not run at all, sounds like it's grinding, and is almost impossible to remove from the hard drive.  I cannot find any place to tell me who to CALL to ask for a replacement!

    The Elements 12 Mac disk works fine - I also have a Dell, and the Windows disk will not run at all, sounds like it's grinding, and is almost impossible to remove from the hard drive.  I cannot find any place to tell me who to CALL to ask for a replacement!

    Hi Samcat,
    You can use a download instead of the disk as an alternative: Adobe - Download free trial version Adobe Photoshop Elements 12 | Adobe you can license with your serial
    Please test the disk in another windows machine to check if it's caused by the drive or the disk. If you tested with 2 drives please start a support case, i assume Adobe will only provide downloads at this point. They are the same as the trials. If you still need a disk you can burn the trial to a disk as a backup disk. Good luck!

  • JFXPanel: Attempt to call defer when toolkit not running

    Occaisionally receiving exception -
    java.lang.IllegalStateException: Attempt to call defer when toolkit not running
         at com.sun.javafx.tk.quantum.QuantumToolkit.defer(Unknown Source)
         at com.sun.webpane.sg.prism.InvokerImpl.invokeOnEventThread(Unknown Source)
         at com.sun.webpane.webkit.network.URLLoader.callBack(Unknown Source)
    Using JFXPanel with a WebView under JavaFX 2.1 and Java 1.6.0_29. Application works fine most of the time.
    I believe the problem is that we have to move application panels around inside our application and I believe this is sometimes causing the JavaFX platform to believe it is shutting down when it shouldn't.
    Quote from JavaFX application life-cycle definition -
    "•Waits for the application to finish, which happens either when the last window has been closed, or the application calls Platform.exit()
    So, the question is - is there anyway to control when JavaFX deems "the last window has been closed" ? I'm going to try the dummy application route but thought I would post here in case someone has a better/cleaner way.
    Thanks.

    I get a similar problem with a JFXPanel+WebView inside a ToolWindow of the MyDoggy docking framework (cf http://mydoggy.sourceforge.net/docs/mydoggyset.html)
    Hiding/showing the ToolWindow eventually leads to this exception:
    Exception while removing reference: java.lang.IllegalStateException: Attempt to call defer when toolkit not running
    java.lang.IllegalStateException: Attempt to call defer when toolkit not running
         at com.sun.javafx.tk.quantum.QuantumToolkit.defer(QuantumToolkit.java:618)
         at com.sun.webpane.sg.prism.InvokerImpl.invokeOnEventThread(InvokerImpl.java:40)
         at com.sun.webpane.platform.Disposer$DisposerRunnable.enqueue(Disposer.java:92)
         at com.sun.webpane.platform.Disposer$DisposerRunnable.access$100(Disposer.java:76)
         at com.sun.webpane.platform.Disposer.run(Disposer.java:68)
         at java.lang.Thread.run(Thread.java:680)
    Tested on OS X+JavaFX 2.2b18.
    Should we open a bug for that?
    Edited by: 940268 on 24 juil. 2012 14:53

  • Turn off alarms when Ical not running! Bring it back

    It seems that the option to turn off alarms when Ical not running has been removed. The only option now is to simply turn alarms off (then you forget to turn it back on!). i am a professional speaker and when an alarm rings when I'm using Keynote it knocks keynote off the screen. That is a real pain when you are speaking to 1000 people! Anyone got any ideas. And Apple, please bring it back.

    I sure hope the developers at Apple as well as the management team who can make product impacting decisions are reading this thread - do they realize that this makes the *alarm function unusable by professionals* who do presentations? I was in front of a small group doing a powerpoint tonight and the alarm went off in the middle of it - not a good thing.
    So, I will choose to turn them off completely at this point - it is the only option. And I am not going to manually turn them on and off - that's a ridiculous prospect.
    I can only guess at the reason for removing the earlier functionality of turning off the alarms when the application was closed, but this is absolutely a requirement if alarms are to be functional at all for those of us who do presentations.

  • Query not run on initial load

    I have an application with several pages. I have made them in the same way, but they act different.
    What I have:
    One region with a few select lists, and a submit button. The select list has a default value (which is sett identical in all pages in this discussion)
    One region with a report, that runs a SQL based on the choices made with the select lists.
    My problem is on initial loade, when I haven't made any choices in the select list. The defaults are set as expected. In some of the pages it loads as expected and the report looks nice and in accordance with the default values set in the select list. In some other pages it always starts wit ''No data found' in the report. Even when the select list has the correct defaults, and if I press the submit button the page reloads with the proper report. As far as I can tell I have made the two pages in the same manner.
    It also return the expected result the second time you arrive at the page. So if the initial load returned no data found, and you navigate to another page and back again it will show the report with data.
    My question is what can prevent the report from getting the proper defaults set and running the query on initial load of the page that is not the case when the page is resubmitted or loaded a second time.

    I have looked at it without finding anything. I took an example from one page that has 3 out of 4 regions empty. The booked passenger region has data
    This is the log from the initial log:
    .00:
    0.01: S H O W: application="106" page="1" workspace="" request="" session="716623568740864"
    0.01: Language derived from: FLOW_PRIMARY_LANGUAGE, current browser language: en-us
    0.01: alter session set nls_language="AMERICAN"
    0.01: alter session set nls_territory="AMERICA"
    0.01: NLS: CSV charset=WE8MSWIN1252
    0.01: ...NLS: Set Decimal separator="."
    0.01: ...NLS: Set NLS Group separator=","
    0.01: ...NLS: Set date format="DD-MON-RR"
    0.01: ...Setting session time_zone to -05:00
    0.01: Setting NLS_DATE_FORMAT to application date format: DD-MON-RR
    0.01: ...NLS: Set date format="DD-MON-RR"
    0.01: NLS: Language=en-us
    0.01: Application 106, Authentication: CUSTOM2, Page Template: 2233622453240425
    0.01: ...Session ID 716623568740864 can be used
    0.01: ...Application session: 716623568740864, user=CFA
    0.01: ...Determine if user "OPS" workspace "1065304065321761" can develop application "106" in workspace "1065304065321761"
    0.01: ...Check for session expiration:
    0.01: Session: Fetch session header information
    0.01: ...Metadata: Fetch page attributes for application 106, page 1
    0.01: Fetch session state from database
    0.02: Branch point: BEFORE_HEADER
    0.02: Fetch application meta data
    0.02: Setting NLS_DATE_FORMAT to application date format: DD-MON-RR
    0.02: ...NLS: Set date format="DD-MON-RR"
    0.02: Computation point: BEFORE_HEADER
    0.02: Processing point: BEFORE_HEADER
    0.03: Show page template header
    0.03: Computation point: AFTER_HEADER
    0.03: Processing point: AFTER_HEADER
    0.03: Region:  
    0.03: Item: P1_SHIP COMBOBOX
    0.04: Item: P1_DEP_DATE MULTIPLESELECT
    0.04: Item: P1_LEG COMBOBOX
    0.05: Computation point: BEFORE_BOX_BODY
    0.05: ...Perform computation of item: F106_DUMMY, type=FUNCTION_BODY
    0.05: ...Performing function body computation
    0.06: ...Session State: Save "F106_DUMMY" - saving same value: ""
    0.06: Processing point: BEFORE_BOX_BODY
    0.06: Region: Message
    *0.06: Region: Gender Distribution*
    *0.06: Region: Nationality distribution*
    0.06: Computation point: AFTER_BOX_BODY
    0.06: Processing point: AFTER_BOX_BODY
    *0.06: Region: Booked passengers*
    *0.07: Region: Age Distribution*
    0.07: Computation point: BEFORE_FOOTER
    0.07: Processing point: BEFORE_FOOTER
    0.07: Region:  
    0.07: Item: P0_UPDATED DISPLAY_ONLY_HTML
    0.08: Show page tempate footer
    0.08: Computation point: AFTER_FOOTER
    0.08: Processing point: AFTER_FOOTER
    0.08: Log Activity:
    0.08: Execute Count=0
    0.08: End Show:
    This is the log after I press go and I get data in 4 of 4 regions:
    0.00: A C C E P T: Request="Go"
    0.00: Metadata: Fetch application definition and shortcuts
    0.00: NLS: wwv_flow.g_flow_language_derived_from=FLOW_PRIMARY_LANGUAGE: wwv_flow.g_browser_language=en-us
    0.01: alter session set nls_language="AMERICAN"
    0.01: alter session set nls_territory="AMERICA"
    0.01: NLS: CSV charset=WE8MSWIN1252
    0.02: ...NLS: Set Decimal separator="."
    0.02: ...NLS: Set NLS Group separator=","
    0.02: ...NLS: Set date format="DD-MON-RR"
    0.02: ...Setting session time_zone to -05:00
    0.02: Setting NLS_DATE_FORMAT to application date format: DD-MON-RR
    0.02: ...NLS: Set date format="DD-MON-RR"
    0.02: Fetch session state from database
    0.02: ...Check session 640739340114653 owner
    0.02: Setting NLS_DATE_FORMAT to application date format: DD-MON-RR
    0.02: ...NLS: Set date format="DD-MON-RR"
    0.02: ...Check for session expiration:
    0.02: ...Metadata: Fetch Page, Computation, Process, and Branch
    0.03: Session: Fetch session header information
    0.03: ...Metadata: Fetch page attributes for application 106, page 1
    0.03: ...Validate item page affinity.
    0.03: ...Validate hidden_protected items.
    0.03: ...Check authorization security schemes
    0.03: Session State: Save form items and p_arg_values
    0.03: ...Session State: Save Item "P1_SHIP" newValue="CFA" "escape_on_input=""
    0.03: ...Session State: Save Item "P1_DEP_DATE" newValue="20100414" "escape_on_input="N"
    0.03: ...Session State: Save Item "P1_LEG" newValue="All" "escape_on_input=""
    0.03: Processing point: ON_SUBMIT_BEFORE_COMPUTATION
    0.03: Branch point: BEFORE_COMPUTATION
    0.03: Computation point: AFTER_SUBMIT
    0.03: Tabs: Perform Branching for Tab Requests
    0.03: Branch point: BEFORE_VALIDATION
    0.03: Perform validations:
    0.03: Branch point: BEFORE_PROCESSING
    0.03: Processing point: AFTER_SUBMIT
    0.03: Branch point: AFTER_PROCESSING
    0.03: ...Evaluating Branch: AFTER_PROCESSING type: "REDIRECT_URL" button: 7515820301908562 branch: (Unconditional)
    0.00:
    0.00: S H O W: application="106" page="1" workspace="" request="" session="640739340114653"
    0.01: Language derived from: FLOW_PRIMARY_LANGUAGE, current browser language: en-us
    0.01: alter session set nls_language="AMERICAN"
    0.01: alter session set nls_territory="AMERICA"
    0.01: NLS: CSV charset=WE8MSWIN1252
    0.01: ...NLS: Set Decimal separator="."
    0.01: ...NLS: Set NLS Group separator=","
    0.01: ...NLS: Set date format="DD-MON-RR"
    0.01: ...Setting session time_zone to -05:00
    0.01: Setting NLS_DATE_FORMAT to application date format: DD-MON-RR
    0.01: ...NLS: Set date format="DD-MON-RR"
    0.01: NLS: Language=en-us
    0.01: Application 106, Authentication: CUSTOM2, Page Template: 2233622453240425
    0.01: ...Session ID 640739340114653 can be used
    0.01: ...Application session: 640739340114653, user=CFA
    0.01: ...Determine if user "OPS" workspace "1065304065321761" can develop application "106" in workspace "1065304065321761"
    0.01: ...Check for session expiration:
    0.01: Session: Fetch session header information
    0.02: ...Metadata: Fetch page attributes for application 106, page 1
    0.02: Fetch session state from database
    0.03: Branch point: BEFORE_HEADER
    0.03: Fetch application meta data
    0.03: Setting NLS_DATE_FORMAT to application date format: DD-MON-RR
    0.03: ...NLS: Set date format="DD-MON-RR"
    0.03: Computation point: BEFORE_HEADER
    0.03: Processing point: BEFORE_HEADER
    0.04: Show page template header
    0.05: Computation point: AFTER_HEADER
    0.05: Processing point: AFTER_HEADER
    0.05: Region:  
    0.05: Item: P1_SHIP COMBOBOX
    0.06: Item: P1_DEP_DATE MULTIPLESELECT
    0.06: Item: P1_LEG COMBOBOX
    0.06: Computation point: BEFORE_BOX_BODY
    0.06: ...Perform computation of item: F106_DUMMY, type=FUNCTION_BODY
    0.06: ...Performing function body computation
    0.06: ...Session State: Save "F106_DUMMY" - saving same value: ""
    0.06: Processing point: BEFORE_BOX_BODY
    0.07: Region: Message
    0.07: Region: Gender Distribution
    0.07: Region: Nationality distribution
    0.07: Computation point: AFTER_BOX_BODY
    0.07: Processing point: AFTER_BOX_BODY
    0.07: Region: Booked passengers
    0.07: Region: Age Distribution
    0.08: Computation point: BEFORE_FOOTER
    0.08: Processing point: BEFORE_FOOTER
    0.08: Region:  
    0.08: Item: P0_UPDATED DISPLAY_ONLY_HTML
    0.08: Show page tempate footer
    0.08: Computation point: AFTER_FOOTER
    0.08: Processing point: AFTER_FOOTER
    0.08: Log Activity:
    0.08: Execute Count=0
    0.08: End Show:

  • Case when Query in SSRS

    I just want to post another new question based on last week's thread:
    Visakh16 provided me answer to use "CASE When" to handling different regions (see the Select statement below).
    My new question is:  I do need to add a new condition for transaction type = "Billing" after Case when Customer PO In ('12345', '3334444', '23434343'.  These 2 conditions need to be embedded in the region called as
    "America-Hub".
    For the rest of the regions (regions other than America-Hub), I need to filter transaction type = 'Booking".  So How can I combine the above new conditions into One query.
    Please help
    SELECT other columns...,
    CASE WHEN CustomerPO IN ('123456',
    '3343434', '2343434')
    THEN 'AMERICAS (Hub)'
    ELSE RegionFieldHere
    END AS Region
    FROM ...
    Thanks,
    Josephine
    Josey Tang

    Thanks for your reply yesterday.  I think I would like to clarify my requirement.  Below is the table that I expect to see from the query.  Customer PO # 123456', '3343434', '2343434' have 2 transaction types (Billing and Booking, please see BOLD
    sections below) so I do need to list out these 3 POs in "Booking" transaction type as well under "America" region.
    The region called it as "America-Hub" which does not exist, I do need to name this region manually (after filter out by these POs '123456', '3343434', '2343434' and filter by Transaction Type = "Billing"). 
    In the query output, I do need to list out all other customer POs for different regions such as "Japan", "Malaysia', etc.  (See purple section) for "Transaction Type" = Booking
    Below is the final data output that I expect to see in my query. Appreciate if you can help me out.
    Transaction   Type
    Region
    Customer PO
    Billing
    America-Hub
    123456
    Billing
    America-Hub
    3343434
    Billing
    America-Hub
    2343434
    Booking
    Japan
    8898989
    Booking
    Malaysia
    7783838
    Booking
    America
    123456
    Booking
    America
    3343434
    Booking
    America
    2343434
    Thanks,
    Josephine
    Josey Tang

  • Query Not Running Via BEX Analyzer Role Menu

    Hi All,
    I have a problem when executing queries via the BEX Analyzer role menu. I can select a query from a role but, when I select the query to run, nothing happens. When I select the same query from the infoarea it runs without any problems. This behaviour occurs for all our queries so is not specific to a particular query.
    We're running on version 3.5 and I've just upgraded to the latest patch but this hasn't helped at all.
    If I use the role menu via the web application designer the queries all work fine so the problem looks to be pointing at the role menu within BEX Analyzer.
    Any ideas ?
    Dave

    this issue is more related to Security , Roles & authorisation.
    u will have to talk to Security team.
    While installing latest patch,usuallys uch trouble occurs.
    the excel extensions , roles gets affected sometime..

  • Bex Query Not Running

    Hello
    I have built BI7 Query and run it. It goes to the portal where I use my user password and it comes back with the following results
    Portal Runtime Error
    An exception occurred while processing a request for :
    iView : N/A
    Component Name : N/A
    com.sap.ip.bi.base.parameter.ParameterConverter.createFromServletRequest(Ljavax/servlet/ServletRequest;)Lcom/sap/ip/bi/base/parameter/IParameterList;.
    Exception id: 01:49_19/01/08_0045_52644550
    See the details for the exception ID in the log file
    I also cannot save a Web Template neither can I Save a Report using Report Desiner. Both come back with authorisation errror. I think all three could be related or maybe they are differnt.
    Please can you guys help and offer a solution?
    Thanks in advance.
    Steve.

    Hi Lambertus,
    I also face same problem. Please can you elaborate the solution you described or what should I be asking my basis team to do to solve this issue.
    Regards
    Anand

  • Error when query is run

    Hi Gurus,
    When the query is run, it takes forever and hten come with this messages:
    1) An Exception with the type CX_SY_SHARED_MEMORY occured, but was neither handled locally nor declared in RAISING
    2) No space left in memory
    Note: This was running OK some time back.
    I followed the some instruction on OSS note: 702728, but that did not help.
    I would really appreciate some help on this.
    Thanks.

    Hi Suhas,
    I remember having the same error once.
    Have you configured your ODBC driver? This is causing the error.
    For more information, refer to the link below:
    Business Object local ODBC connections and server ODBC connections
    Regards,
    Ashvin
    Message was edited by: Nanreshsing Sungkur

  • Case when statement not working

    hi there, I am trying to work out how to get my case statement to work.
    I have got the following code. 
    select pthproto.pthdbo.cnarole.tpkcnarole, pthproto.pthdbo.cnaidta.formataddr as formataddr, cnaidta.dateeffect as maxdate, isnull(cast (pthproto.pthdbo.cnaaddr.prefix1key as varchar (50)),'') + ' ' + isnull(cast (pthproto.pthdbo.cnaaddr.prefix2key
    as varchar (50)),'')+ ' ' + isnull(cast (pthproto.pthdbo.cnaaddr.prefix3key as varchar (50)),'') + ' ' + isnull (cast (pthproto.pthdbo.cnaaddr.houseidkey as varchar (100)),'') + ' ' + isnull (cast (pthproto.pthdbo.cnaaddr.component1
    as varchar (100)),'') + ' ' + isnull (cast (pthproto.pthdbo.cnaaddr.component2 as varchar (100)),'') + ' ' + isnull (cast (pthproto.pthdbo.cnaaddr.component3 as varchar (100)),'') + ' ' + isnull (cast (pthproto.pthdbo.cnaaddr.component4
    as varchar (100)),'') + ' ' + isnull (cast (pthproto.pthdbo.cnaaddr.component5 as varchar (100)),'') as mailaddress, row_number() over(partition by pthproto.pthdbo.cnarole.tpkcnarole order by cnaidta.dateeffect desc) as rn into #address from pthproto.pthdbo.cnarole
    inner join pthproto.pthdbo.cnaidty on cnarole.tfkcnaidty =cnaidty.tpkcnaidty inner join pthproto.pthdbo.cnaidta on cnaidty.tpkcnaidty = cnaidta.tfkcnaidty inner join pthproto.pthdbo.cnaaddr on cnaidta.tfkcnaaddr = cnaaddr.tpkcnaaddr order by cnaidta.dateeffect
    select *, case when mailaddress is not null then mailaddress else formataddr end as test from #address where tpkcnarole = '18306695'
    The case when statement is struggling with how i have created the column mailaddress.  As it does seem to understand when it is null.  In the example I have got there is no value in any of the columns to create
    the mailaddress.  Hence why I am referencing it from elsewhere.  Due to having a way on the system where it picks up data from 2 different places.    The mailaddress is always correct if there is one, hence why
    trying to reference that one first.  So how do i change this case when statement to work ?            

    It's ok I have fixed my own problem
    when
    (mailaddress
    is
    null 
    or mailaddress

    then formataddr
    else mailaddress
    end
    as test
    case

  • Query not running in report builder 3.0

    hi, i can run my query in mgmt studio (version 2008R2) and within the query designer of report builder 3.0 but it will not run from report builder. i get a generic error message of "an error has occurred during report processing. (rsProcessingAborted)".
    the query uses report parameters and is written with dynamic sql (using a pass-through to oracle). any ideas why the query doesn't execute in report builder ? thanks a bunch,

    Hi KanataPablo,
    According to your description, it seems that you are using linked server to pass value to oracle. Seeing that the query is worked well in Management Studio, you may have the permission to connect to oracle (In this scenario, make sure the users to run the
    query in SSMS and Report Builder are the same user). So this issue can be caused by the user’s permission to connect to report server, the credential of data source and the dynamic query.
    We can add the current user as a Login, then click Properties and navigate to User Mappings page, enable ReportServer and ReportServerTempDB options.
    We can try to type user name and password, and enable “Use as Windows credentials” as the credential used to connect to data source.
    Try with dynamic query:
    ="Select column1, column2 From tableName where ID IN (" + JOIN(Parameters!param1.value, ",") + ")"
    Hope this helps.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • Query not running in Dashboard query browser.

    Hi,
    Kindly provide me some light on the issue i am facing.
    I have prepared one universe in IDT and published it to repository. In the Dashboard i am able to select the universe and when i am running the query in query panel, it is showing me one issue. The error is : Datasource name not found and no default driver specified.
    But i have created ODBC connection and using it in IDT also. There in IDT, i am able to run the query in business layer query panel.
    Regards
    Archit Sarwal

    HI,
    Great, thank you for the reply
    i'm not really sure but i think if we have a problem on BI Launch pad so you will ever be able to run a query in Dashbaord
    so the first think is fix this problem
    but before this please be sure that you have no preblem by running the a query using the Webi Rich Client (very important test)
    no in order to run the query in BI Launch pad you Should have the same ODBC (64bit) configured in BI server Box
    Best regards,
    Mohamed AISSA

  • Case when then not working

    In my database, two variable ID and time (varchar2) are there. I want to populate another variable using case when then by putting below conditon to convert like this
    But its not working. Can anyone help me
    if time =1 day then '1 Day'
    time > 2 days and time <=7 days then '2 to 7 days'
    time > 8 days and time <=15 days then '8 to 15 days'
    else 'not matching'
    ID Time
    12 1 days
    23 244 days
    12 2 days
    14 4 days
    15 6 days
    17 9 days
    select time,
    case WHEN
    UPPER(Time) = '1 DAY'
    THEN
    '1 day'
    WHEN
    UPPER(Time) Between '2 DAYS' and '7 DAYS'
    THEN
    '2 to 7 days'
    WHEN
    UPPER(Time) Between '8 DAYS' and '15 DAYS'
    THEN
    '8 to 15 days'
    ELSE
    'Not matching'
    END "update time"
    from table1

    900487 wrote:
    In my database, two variable ID and time (varchar2) are there. If you are storing Days in a column store it as NUMBER or INTERVAL data type. The way you have stored the value looks incorrect.
    What you can do is extract the number portion of your time column and apply the CASE statement. Something like this
    SQL> with t
      2  as
      3  (
      4  select 12 id, '1 days' time1 from dual union all
      5  select 23 id, '244 days' time1 from dual union all
      6  select 12 id, '2 days' time1 from dual union all
      7  select 14 id, '4 days' time1 from dual union all
      8  select 15 id, '6 days' time1 from dual union all
      9  select 17 id, '9 days' time1 from dual
    10  )
    11   select id,
    12          time1,
    13          case when time1 = 1              then '1 day'
    14               when time1 between 2 and 7  then '2 to 7 days'
    15               when time1 between 8 and 15 then '8 to 15 days'
    16               else 'not matching'
    17          end "update time"
    18     from (
    19              select id, to_number(regexp_substr(time1, '^[[:digit:]]*')) time1
    20                from t
    21          )
    22  /
            ID      TIME1 update time
            12          1 1 day
            23        244 not matching
            12          2 2 to 7 days
            14          4 2 to 7 days
            15          6 2 to 7 days
            17          9 8 to 15 days
    6 rows selected.

Maybe you are looking for