Issue with WITH CLAUSE

Hi,
I am trying to execute a similar query with With Clause.
With x as (select sysdate from dual)
select * from x;
Its throwing error. My oracle version is 9.2.0.8.0.
What could be the reason. I came to know that with clause is supported from 9i release 2, why is not working for me.
Thanks & Regards,
Subbu S

Hi,
You can use WITH in SQL*Plus 8 (connected to an Oracle 9, or higher, database), but the first word of a statement cannot be WITH.
Instead of
WITH
(<sub_query>) ...
<main_query>
;say
SELECT * FROM (
WITH
(<sub_query>) ...
<main_query>
);Installing a new version of SQL*Plus isn't very difficult, so you should really do that.
As Blushadow said, SQL*Plus has to understand what you're saying, or at least understand if a statemnet is a SQL command (to be passed on to the database) or a SQL*Plus command.
You can't begin a statement with a substitution variable, apparently for the same reason.

Similar Messages

  • No tree displayed with WHERE clause (data issue?)

    I tried this on the apex.oracle.com workspace after it didnt run in our setup, and I ran into the same issue.
    I cant get the tree to display when I add a WHERE clause to the query.
    I know this isnt a problem with the WHERE clause, and has something to do with the data.
    If I just delete the data I dont want from the table (data_type <> 'S'), it WORKS, even with the WHERE clause.
    I have checked running the SQL, and the root element is returned.
    When I look at the HTML source of the page, I can see the js object created, though it seems to be constructed incorrectly.
    select case when connect_by_isleaf = 1 then 0
    when level = 1 then 1
    else -1
    end as status,
    level,
    "DATA_TEXT" as title,
    null as icon,
    "ID" as value,
    null as tooltip,
    null as link
    from "#OWNER#"."T_ROOT_CAUSE_TEMPLATE"
    where (data_type='S' or id=346)
    start with id=346
    connect by prior "ID" = "PARENT"
    order siblings by "DATA_SEQUENCE"

    Just in case if you didn't know it, you can use WITH factoring clause when creating a tree. It makes it possible to create as many "tables" as you need, while the final hierarchical query (that is responsible for the way the tree looks like) is a simple one. This (+WITH+) approach is convenient as you can avoid repeating inline views and/or subqueries.
    For example, your query might have looked like this:
    with s_type as
      (select * from t_template
       where data_type = 'S'
          or id = 346
    select
      case when connect_by_isleaf = 1 then 0
           when level = 1 then 1
           else -1
      end as status,
      level,
      data_text as title,
      null as icon,
      id as value,
      null as tooltip,
      null as link
    from
      s_type
    start with id=346
    connect by prior id = parent
    order siblings by data_sequence

  • Outer Join with Where Clause in LTS

    HI all,
    I have a requirement like this in ANSI SQL:
    select p1.product_id, p1.product_name, p2.product_group
    from product p1 left outer join product_group p2 on p1.product_id = p2.product_id
    and p2.product_group = 'NEW'
    In Regular SQL:
    select p1.product_id, p1.product_name, p2.product_group
    from product p1, product_group p2
    WHERE p1.product_id *= p2.product_id and p2.product_group = 'NEW'
    In OBIEE, I am using a left outer join between these two in Logical table Source, and also, Gave
    p2.product_group = 'NEW' in WHERE clause of LTS.
    This doesn't seem to solve purpose.
    Do you have any idea how to convert WHERE clause in physical query that OBIEE is generating to something like
    product p1 left outer join product_group p2 on p1.product_id = p2.product_id AND p2.product_group = 'NEW'
    I am using Version 10.1.3.4.1
    Creating an Opaque view would be my last option though.

    Hello
    I have read your post and the responses as well. and I understand that you have issues with the Outer Join with where Clause in LTS.
    Try this solution which worked for me (using your example ) -
    1. In the Physical Layer created a Complex join between PRODUCT and PRODUCT_GROUP tables and use this join relationship :
    PRODUCT.PROD_ID = PRODUCT_GROUP.PROD_ID  AND  PRODUCT_GROUP.GROUP_NAME = 'MECHANICAL' 
    2. In the General Tab of PRODUCT table LTS add PRODUCT_GROUP  table and select Join Type as Left Outer Join.
    3. Check Consistency and make sure there are no errors .
    when you run a request you should see the following query generated -
    select distinct T26908.PROD_ID as c1,
         T26908.PROD_NAME as c2,
         T26912.GROUP_NAME as c3
    from
         PRODUCT T26908 left outer join PRODUCT_GROUP T26912 On T26908.PROD_ID = T26912.PROD_ID and T26912.GROUP_NAME = 'MECHANICAL'
    order by c1, c2, c3
    Hope this works for you. If it does please mark this response as 'Correct' .
    Good Luck.

  • Select query with UNION clause in database adapter

    Friends,
    I have got a SQL query with two UNION clause withing it. like
    select a,b,c
    from a
    union
    select a,b,c
    from b
    The schema generated is like below in sequence
    <element>a</element>
    <element>b</element>
    <element>c</element>
    <element>a</element>
    <element>b</element>
    <element>c</element>
    So, the columns from different select queries joined with UNION clause are all appeared in schema instead of the distinct columns.
    Is there any way around to solve this issue ? or will need to with DB function/procedure.

    I think I know what you are saying but your example doesn't make sense, your SQL should produce something like
    I had to change a, b, c with elementA, elementB, elementC as a and b are reserved html tags.
    <elementA>DateA</elementA>
    <elementB>DataB</elementB>
    <elementC>DataC</elementC>
    ...What is the result of the query when you run it in SQLPlus? Is it what you expect?
    cheers
    James

  • Hierarchical query with where clause

    Hi,
    How can I query hierarchically a query with WHERE clause? I have a table with three fields session_id,id and root_id.
    When I try with the following query,
    select id, level from relation
    where session_id = 79977
    connect by prior id = root_id start with id = 5042;
    It gets duplicate values.
    I want the query to show in the hierarchical manner with a filter condition using WHERE clause. Please help me how can I achieve this. If you know any link that describes more about this, please send it.
    Thanks in Advance.
    Regards,
    -Parmy

    Hi Sridhar Murthy an others,
    Thanks a lot for your/the answer. It's working for me. It saved a lot of other work around without the proper knowledge of hierarchical query. Please send me any link that describes these issues in detail and also I hope as I have mentioned in the other message, same cannot be achieved on views or ( on two different tables ???)
    Any way thanks for your reply,
    It's working for me.
    With happiness,
    -Parmy

  • Using bind variable with IN clause

    My application runs a limited number of straight up queries (no stored procs) using ODP.NET. For the most part, I'm able to use bind variables to help with query caching, etc... but I'm at a loss as to how to use bind variables with IN clauses. Basically, I'm looking for something like this:
    int objectId = 123;
    string[] listOfValues = { "a", "b", "c"};
    OracleCommand command = new OracleCommand();
    command.Connection = conn;
    command.BindByName = true;
    command.CommandText = @"select blah from mytable where objectId = :objectId and somevalue in (:listOfValues)";
    command.Parameters.Add("objectId", objectId);
    command.Parameters.Add("listOfValues", listOfValues);
    I haven't had much luck yet using an array as a bind variable. Do I need to pass it in as a PL/SQL associative array? Cast the values to a TABLE?
    Thanks,
    Nick

    Nevermind, found this
    How to use OracleParameter whith the IN Operator of select statement
    which contained this, which is a brilliant solution
    http://oradim.blogspot.com/2007/12/dynamically-creating-variable-in-list.html

  • MB26 ,CO27 - goods issue components with serial number?

    Hi ,everyone!
    I know CO27 and MB26 can do goods issue to production order very easily and quickly!
    But It seems CO27 and MB26 can not work well with the component with serial number.
    I aslo know MB1A and MB1B can post goods issue for component with serial number.But in MB1A and MB11 , it is very difficult to can material by material number quickly while doing more then 100 components issue to one production order.
    And for authorization purpose we restrict MIGO not to use goods issue for production order.
    So I want to ask how CO27 and MB26 do goods issue for the component with serial number?
    Or there is another ways to goods issue component with serial number to production order easily,exclude MB1A,MB11 and MIGO?
    Thanks for any reply!

    Hi Vivek     
    We use CO27 for goods issue to production order ,just like MB1A goods issue to production order.
    But in the BOM components of the production orders ,some semi finished products are with  with serial numbers ,so we can not use CO27 or MB26 to issue these components with serial numbers to production orders!

  • Will the new 10.6.8 update fix SATA3 issues related with 2011 MacBook Pros?

    Will the new 10.6.8 update fix SATA3 issues related with 2011 MacBook Pros?

    It is against TOU to speculate on these message board.  Suggest you post your question on the Mac Rumors site.
    As I already stated, there is no 10.6.8 update.  If there was, it would be listed in Software Update.

  • Export (expdp) with where clause

    Hello Gurus,
    I am trying to export with where clause. I am getting below error.
    Here is my export command.
    expdp "'/ as sysdba'" tables = USER1.TABLE1 directory=DATA_PUMP dumpfile=TABLE1.dmp logfile=TABLE1.log query= “USER1.TABLE1:where auditdate>'01-JAN-10'” Here is error
    [keeth]DB1 /oracle/data_15/db1> DATA_PUMP dumpfile=TABLE1.dmp logfile=TABLE1.log query= USER1.TABLE1:where auditdate>'01-JAN-10'                    <
    Export: Release 11.2.0.3.0 - Production on Tue Mar 26 03:03:26 2013
    Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
    Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    Starting "SYS"."SYS_EXPORT_TABLE_03":  "/******** AS SYSDBA" tables=USER1.TABLE1 directory=DATA_PUMP dumpfile=TABLE1.dmp logfile=TABLE1.log query= USER1.TABLE1:where auditdate
    Estimate in progress using BLOCKS method...
    Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
    Total estimation using BLOCKS method: 386 MB
    Processing object type TABLE_EXPORT/TABLE/TABLE
    Processing object type TABLE_EXPORT/TABLE/GRANT/OWNER_GRANT/OBJECT_GRANT
    Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX
    Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
    Processing object type TABLE_EXPORT/TABLE/TRIGGER
    Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
    ORA-31693: Table data object "USER1"."TABLE1" failed to load/unload and is being skipped due to error:
    ORA-00933: SQL command not properly ended
    Master table "SYS"."SYS_EXPORT_TABLE_03" successfully loaded/unloaded
    Dump file set for SYS.SYS_EXPORT_TABLE_03 is:
      /oracle/data_15/db1/TABLE1.dmp
    Job "SYS"."SYS_EXPORT_TABLE_03" completed with 1 error(s) at 03:03:58Version
    SQL> select * from v$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    PL/SQL Release 11.2.0.3.0 - Production
    CORE    11.2.0.3.0      Production
    TNS for IBM/AIX RISC System/6000: Version 11.2.0.3.0 - Production
    NLSRTL Version 11.2.0.3.0 - Production

    Hello,
    You should use parameter file.Another question i can see you are using 11g.Why don't you use data pump?.
    Data Pump is faster and have more features and enhancement than regular imp and exp.
    You can do the following:
    sqlplus / as sysdba
    Create directory DPUMP_DIR3  for 'Type here your os path that you want to export to';then touch a file:
    touch par.txt
    In this file type the following the following :
    tables=schema.table_name
    dumpfile=yourdump.dmp
    DIRECTORY=DPUMP_DIR3
    logfile=Your_logfile.log
    QUERY =abs.texp:"where hiredate>'01-JAN-13' "then do the following
    expdp username/password parfile='par.txt'
    If you will import from Oracle 11g to version 10g then you have to addthe parameter "version=10" to the parameter file above
    BR
    Mohamed ELAzab
    http://mohamedelazab.blogspot.com/

  • Issues Capturing with Final Cut Express

    Hi
    I am currently having issues capturing with Final Cut Express. I am using a Firewire 800 gold speed cable 9pin/4pin with my Sony LSF-S58 camera. I use mini DV tapes and usually capture on other computers with no problems. However this time I am using Final Cut Express version 4.0.1 along with a Thunderbolt to Firewire adapter so it'll connect with my MAC Book Pro (Operating system OS X 10.6.8). The issue is when I open Final Cut's capture option there is a message at the bottom that says "No Communicatin" I have tried various settings within easy set-up and nothing seems to work as well as browsing this help board along with others looking for the answer. Any help anyone can provide would be great. Thanks.

    When I Google LSF-S58, I get a Sony Lens Hood, not a camera. Are you recording in HD or SD?
    Have you used the Thunderbolt to Firewire convertor successfully on your computer with other devices?
    Have you used the Thunderbolt port successfully with other Thunderbolt devices?
    I don't know if this is applicable to your computer, but there is a Thunderbolt software update for 10.6.8 here:
    http://support.apple.com/kb/DL1452?viewlocale=en_US&locale=en_US
    MtD

  • Apple TV mirroring issues even with Mac mini,airport extreme bought at the end of last year,and an iPad 2

    Apple TV mirroring issues even with Mac mini,airport extreme bought at the end of last year,and an iPad 2

    I have the same issue with ATV3 and iPhone 4S. Everything works properly, no buffering issues when watching netflix, vimeo, youtube BUT when I try mirroring even a small 15sec iPhone movie it stutters and buffers and results to a choppy playback..same with larger mp4 files such as 1-1.5GB, buffers forever and never plays, I just re-encoded the same movie to 700MB and plays perfectly..
    Why Apple, why?..so close..I can accept the bigger movie files issue, but not being able to playback properly an iPhone movie is funny..I recorded a movie with lower bitrate through Filmic Pro (Economy mode, up to 16Mbps)
    and plays properly.
    Is there an upcoming software update going to solve the problem or is it hardware related and therefore not fixable.
    Please don't reply with a network related answer, by 2012 we know how to set up our networks and everything else runs flawlessly.
    I'll apreciate a fast answer, we love Apple, but if it can't play an iphone movie (or a high quality movie from iTunes) it's just not up to my standards.
    Thanks again.
    JP

  • I have been having multiple issues lately with my iMac

    I have been having multiple issues lately with my iMac - starting with insanely slow processing/run speeds. 
    When I run Activity Monitor, consistently the highest usage of CPU is "ReportCrash" - typically shows up as 80-200% of CPU.
    What could this be caused by?
    I posted only a portion of the code from Activity Monitor but not sure what exactly is relevant or not.  I can certainly post more if it's needed.
    Many thanks!
    Analysis of sampling ReportCrash (pid 332) every 1 millisecond
    Process:         ReportCrash [332]
    Path:            /System/Library/CoreServices/ReportCrash
    Load Address:    0x10e14a000
    Identifier:      ReportCrash
    Version:         ??? (???)
    Code Type:       X86-64 (Native)
    Parent Process:  launchd [1]
    Date/Time:       2013-04-23 18:17:29.753 -0400
    OS Version:      Mac OS X 10.8.3 (12D78)
    Report Version:  7
    Call graph:
        2492 Thread_6876   DispatchQueue_1: com.apple.main-thread  (serial)
        + 2492 start  (in libdyld.dylib) + 1  [0x7fff847cd7e1]
        +   2492 ???  (in ReportCrash)  load address 0x10e14a000 + 0xfb9c  [0x10e159b9c]
        +     2492 -[NSConditionLock lockWhenCondition:beforeDate:]  (in Foundation) + 235  [0x7fff815f1e39]
        +       2492 -[NSCondition waitUntilDate:]  (in Foundation) + 357  [0x7fff815f1fe3]
        +         2492 _pthread_cond_wait  (in libsystem_c.dylib) + 927  [0x7fff86326023]
        +           2492 __psynch_cvwait  (in libsystem_kernel.dylib) + 10  [0x7fff8b52f0fa]
        2491 Thread_6877   DispatchQueue_2: com.apple.libdispatch-manager  (serial)
        + 2491 _dispatch_mgr_thread  (in libdispatch.dylib) + 54  [0x7fff887179ee]
        +   2481 _dispatch_mgr_invoke  (in libdispatch.dylib) + 883  [0x7fff88717dea]
        +   ! 2481 kevent  (in libsystem_kernel.dylib) + 10  [0x7fff8b52fd16]
        +   8 _dispatch_mgr_invoke  (in libdispatch.dylib) + 134  [0x7fff88717afd]
        +   ! 4 _dispatch_mgr_thread2  (in libdispatch.dylib) + 43  [0x7fff887180a8]
        +   ! : 3 _dispatch_queue_drain  (in libdispatch.dylib) + 180  [0x7fff88716448]
        +   ! : | 2 _dispatch_queue_invoke  (in libdispatch.dylib) + 72  [0x7fff88716305]
        +   ! : | + 1 _dispatch_source_invoke  (in libdispatch.dylib) + 58  [0x7fff88717022]
        +   ! : | + ! 1 _dispatch_kevent_register  (in libdispatch.dylib) + 280  [0x7fff887173f4]
        +   ! : | + !   1 _dispatch_source_kevent_resume  (in libdispatch.dylib) + 63  [0x7fff88717513]
        +   ! : | + !     1 _dispatch_kevent_resume  (in libdispatch.dylib) + 92  [0x7fff88717588]
        +   ! : | + !       1 _dispatch_kevent_machport_resume  (in libdispatch.dylib) + 96  [0x7fff887175ec]
        +   ! : | + !         1 mach_port_move_member  (in libsystem_kernel.dylib) + 31  [0x7fff8b52e539]
        +   ! : | + !           1 _kernelrpc_mach_port_move_member_trap  (in libsystem_kernel.dylib) + 10  [0x7fff8b52d626]
        +   ! : | + 1 _dispatch_source_invoke  (in libdispatch.dylib) + 257  [0x7fff887170e9]
        +   ! : | +   1 _dispatch_kevent_unregister  (in libdispatch.dylib) + 286  [0x7fff887189ad]
        +   ! : | +     1 free  (in libsystem_c.dylib) + 199  [0x7fff8633a8f8]
        +   ! : | +       1 szone_free_definite_size  (in libsystem_c.dylib) + 211  [0x7fff8634012c]
        +   ! : | +         1 _spin_lock$VARIANT$mp  (in libsystem_c.dylib) + 13  [0x7fff8630ff9d]
        +   ! : | 1 _dispatch_queue_push_list_slow2  (in libdispatch.dylib) + 33  [0x7fff88715e10]
        +   ! : |   1 _dispatch_wakeup  (in libdispatch.dylib) + 132  [0x7fff88715ecd]
        +   ! : |     1 _dispatch_queue_wakeup_global_slow  (in libdispatch.dylib) + 59  [0x7fff88716073]
        +   ! : |       1 pthread_workqueue_addthreads_np  (in libsystem_c.dylib) + 47  [0x7fff86324016]
        +   ! : |         1 __workq_kernreturn  (in libsystem_kernel.dylib) + 10  [0x7fff8b52f6d6]
        +   ! : 1 _dispatch_queue_drain  (in libdispatch.dylib) + 48  [0x7fff887163c4]
        +   ! 3 _dispatch_mgr_thread2  (in libdispatch.dylib) + 71  [0x7fff887180c4]
        +   ! : 3 _dispatch_source_drain_kevent  (in libdispatch.dylib) + 172  [0x7fff887186d2]
        +   ! :   3 _dispatch_source_merge_kevent  (in libdispatch.dylib) + 226  [0x7fff88718858]
        +   ! :     3 _dispatch_wakeup  (in libdispatch.dylib) + 132  [0x7fff88715ecd]
        +   ! :       3 _dispatch_queue_push_list_slow2  (in libdispatch.dylib) + 33  [0x7fff88715e10]
        +   ! :         3 _dispatch_wakeup  (in libdispatch.dylib) + 132  [0x7fff88715ecd]
        +   ! :           3 _dispatch_queue_wakeup_global_slow  (in libdispatch.dylib) + 59  [0x7fff88716073]
        +   ! :             3 pthread_workqueue_addthreads_np  (in libsystem_c.dylib) + 47  [0x7fff86324016]
        +   ! :               3 __workq_kernreturn  (in libsystem_kernel.dylib) + 10  [0x7fff8b52f6d6]
        +   ! 1 _dispatch_mgr_thread2  (in libdispatch.dylib) + 61  [0x7fff887180ba]
        +   !   1 _dispatch_cache_cleanup  (in libdispatch.dylib) + 30  [0x7fff88716695]
        +   !     1 szone_free  (in libsystem_c.dylib) + 473  [0x7fff8633c91d]
        +   !       1 _spin_lock$VARIANT$mp  (in libsystem_c.dylib) + 13  [0x7fff8630ff9d]
        +   2 _dispatch_mgr_invoke  (in libdispatch.dylib) + 858,885  [0x7fff88717dd1,0x7fff88717dec]

    It would help to know more about your iMac.
    What year, screen size, CPU speed and amount of RAM installed?
    How full is your Mac's hard drive?
    How many applications do you run simultaneously in the background while working in another application?
    Do you run any antivirus software on your Mac? Antivirus software can slow down the normal operation of OS X.
    Do you run any "crapware" like Mackeeper or any other type of so called hard drive "cleaning" apps?
    Have you downloaded and installed anything recently that might have caused the erratic behaviour of your iMac?

  • How to create a view  with "WITH CLAUSE"

    Hi,
    I have a query with "WITH" CLAUSE , I need to create a view on this query. But I am getting error like
    ORA-32034 : Unsupported sue of WITH clause.
    Please help me...!!
    Please find below my query...!!
    WITH RANGE
             AS (SELECT A.MASTERMACHINEID,
                        a.startdate,
                        a.enddate,
                        a.startdate - (1 / 3) + (lvl) * 1 / 3 SHIFT_ST_DT,
                        a.startdate + (lvl) * 1 / 3 AS SHIFT_END_DT,
                        a.quantity,
                        (LEAST ( enddate, TODATE) - GREATEST ( FROMDATE, startdate)) * 24 TOTAL_HRS,
                        (enddate - startdate) * 24 AVAIL,
                       todate,
                       fromdate
                  FROM OMP A,
                       (SELECT LEVEL lvl
                          FROM (SELECT MAX (enddate - startdate) AS diff FROM OMPWORKORDER)
                        CONNECT BY LEVEL <= (diff) * 3),
                       MASTER B
                 WHERE A.MASTERMACHINEID = B.MASTERMACHINEID
                   AND lvl / 3 <=(enddate - startdate) + 1
                ORDER BY SHIFT_ST_DT)
       SELECT shift_date,
              shift_num,
              shift_hrs,
              DECODE (SIGN (SHUT_DWN_TIME), -1, 0, SHUT_DWN_TIME),
              8 - DECODE (SIGN (SHUT_DWN_TIME), -1, 0, SHUT_DWN_TIME) shift_avail_hrs,
              qty,
              total_qty
         FROM (SELECT TRUNC (SHIFT_ST_DT) shift_date,
                      ROW_NUMBER () OVER (PARTITION BY TRUNC (SHIFT_ST_DT) ORDER BY SHIFT_ST_DT) shift_num,
                      8 shift_hrs,
                      (LEAST ( SHIFT_END_DT, TODATE) - GREATEST ( FROMDATE, SHIFT_ST_DT)) * 24
                        SHUT_DWN_TIME,
                      quantity / (avail - TOTAL_HRS) qty,
                      round(((SHIFT_END_DT - SHIFT_ST_DT) * 24 - (LEAST (SHIFT_END_DT, TODATE) - GREATEST (FROMDATE, SHIFT_ST_DT)) * 24)  * QuantiTY / (AVAIL - TOTAL_HRS),2)
                         TOTAL_QTY
                 FROM RANGE A );Regards
    KPR
    Edited by: BluShadow on 17-Mar-2011 09:48
    added {noformat}{noformat} tags for readability                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Try creating view on following query, if it can help you:
    SELECT shift_date,
        shift_num,
        shift_hrs,
        decode(SIGN(shut_dwn_time),     -1,     0,     shut_dwn_time),
        8 -decode(SIGN(shut_dwn_time),     -1,     0,     shut_dwn_time) shift_avail_hrs,
        qty,
        total_qty
    FROM
            SELECT TRUNC(shift_st_dt) shift_date,
                 row_number() over(PARTITION BY TRUNC(shift_st_dt)
             ORDER BY shift_st_dt) shift_num,
                 8 shift_hrs,
                (least(shift_end_dt,      todate) -greatest(fromdate,      shift_st_dt)) *24 shut_dwn_time,
                 quantity /(avail -total_hrs) qty,
                 ROUND(((shift_end_dt -shift_st_dt) *24 -(least(shift_end_dt,      todate) -greatest(fromdate,      shift_st_dt)) *24) *quantity /(avail -total_hrs),      2) total_qty
             FROM
                  SELECT a.mastermachineid,
                     a.startdate,
                     a.enddate,
                     a.startdate -(1 / 3) +(lvl) *1 / 3 shift_st_dt,
                     a.startdate +(lvl) *1 / 3 AS
                 shift_end_dt,
                     a.quantity,
                    (least(enddate,      todate) -greatest(fromdate,      startdate)) *24 total_hrs,
                    (enddate -startdate) *24 avail,
                     todate,
                     fromdate
                 FROM omp a,
                        (SELECT LEVEL lvl
                     FROM
                        (SELECT MAX(enddate -startdate) AS
                        diff
                         FROM ompworkorder)
                    CONNECT BY LEVEL <=(diff) *3),
                     master b
                 WHERE a.mastermachineid = b.mastermachineid
                 AND lvl / 3 <=(enddate -startdate) + 1
                 ORDER BY shift_st_dt
             ) a
    ;Regards,
    Dipali.l

  • Exchange Server 2010 SP3 - Rollup 8 - Issue - Problems with client connections - MS Outlook 2013

    Exchange Server 2010 SP3 - Rollup 8 - Issue - Problems with client connections - MS Outlook 2013
    Detected Problems:
    - Access denied for attached mailbox (department mailbox)
    - Access denied for delete or move messages on own mailbox
    - Can't send new messages with error (Error: [0x80004005-00000000-00000000])
    Solution:
    - Rollback to Exchange 2010 SP3 - Rollup 7
    - You can rollback to Exchange 2010 SP3 - RollUp 7 in 30 min
    Algunos de los destinatarios no recibieron su mensaje.
    Asunto:     Hola
    Enviado el: 11/12/2014 8:35
    No se puede localizar a los destinatarios siguientes:
    '[email protected]' en 11/12/2014 8:35
    Este mensaje no se pudo enviar. Inténtelo de nuevo más tarde, o póngase en contacto con el administrador de red. 
    Error: [0x80004005-00000000-00000000].

    See the following forum thread: 
    https://social.technet.microsoft.com/Forums/en-US/1be9b816-b0ab-40ea-a43a-446239f8eae3/outlook-client-issues-following-exchange-2010-rollup-8

  • I have a question about using multiple ipads in our school.  Each of our teachers have a iPad and AppleTV in their classroom.  The issue is, with our classrooms so close in proximity to one another, is there a way to pair teacher

    I have a question about using multiple ipads in our school.  Each of our teachers have a iPad and AppleTV in their classroom.  The issue is, with our classrooms so close in proximity to one another, is there a way to pair teacher #1 iPad to its AppleTV without effecting/projecting onto the adjacent teachers #2 classroom AppleTV?

    Not as such.
    Give the AppleTV units unique names and also enable Airplay password in settings with unique passwords for each teacher.
    AC

Maybe you are looking for

  • IIS Proxy SAR file needed

    Hi all:    I would like to implement the IIS Proxy SSO solution. Is there anybody can send me the IIS Proxy SAR file ?    I cannot find it in service.sap.com/patches    my mail : [email protected]    I will give you the reward points.    thanks.

  • Nokia IM on E51, problem with Yahoo.

    Hey. Since I got my phone I've been trying to get the IM in it to work with my yahoo. Anyway, I've got it so far, that I can sign on and send messages with yahoo using the IM client, but I can't recieve any IMs back, which is annoying. Has anyone got

  • Macbook Pro 2011 SATA III support

    I would like to know if the new Macbook Pro 2011 supports SATA III SSD's. I know the thunderbolt needs the Sandy Bridge to work, however I am not sure if that means that the chip will definitely support a SATA III SSD. Does anyone know ????

  • How to do a specific report

    Hello! I have an assignment to do. In my dashboard page I have a time prompt with this format (25/06/2011) and I want to do a chart with axis X with all days of month of my prompt. I mean, if user select in page prompt (25/06/2011) I should see in my

  • IPod Software Version 1.2 - UPDATE?

    When will there be an UPDATE to the 1.2 iPod Version Software that fixes many of the problems being reported? I am still wary of downloading the new update (1.2)...