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

Similar Messages

  • How to create a view object and attach with extended AM

    Hi,
    I tried to create new vo and attach this vo with the extended AM. But it is throwing error like 'PC.NAME : invalid identifier' (Actually this PC.NAME is exiting one).
    Now i want to know how to create a view object similar like seeded one but with one additional condition in the where clause.
    It is possible though extension, but i want to create two view object similar like seeded one, one with some other condition in the where clause
    and another one with some other condition.
    So for my requirement, i'll extend one VO and i'll add my condition but how to do it for second condition.
    But i want same seeded VO with two different condition.
    Any suggestions please,
    SAN

    SAN,
    There is no need to attach the newly created VO with extended AM. You need to attach the same with the standard AM.
    Regards,
    Gyan

  • How to create a view on tables with different keys?

    I have to create a View on:
    Z3PVR: Transparent Table
    BSEG: Cluster Table
    CKIS: Transparent Table
    BKPF: Transparent Table
    RV61A: Structure
    T001: Transparent Table
    All the tables have different "Key Fields" and the structure has no "Key Fields". When i create the view, what do I mention in the "JOIN FIELDS" tab. and how do i create the view with the structure?
    Please advise.

    How to create a view on a Non-Transparent Tables.
    how to create view?
    HELP.. How to create a view with the tables with ALV

  • How to create new view without interlinking with gantt chart or resource views

    ok clear
    one another question
       In msp how to create new view without interlinking with gantt chart or resource views

    Hi Shiv PMC--
    I splitted your question above in another thread in order not to have  a huge thread with many topics in it.
    That being said, I'm not sure to understand. A view is just a manner to display MS Project data with columns. A view can have a table with column (left part) associated with a Gantt chart. It can also just contain a table with no Gantt chart (like the task
    table) or a table with a timephased grid (resource and task usage).
    Please give us more information, maybe with a concrete example so we can help you.
    Hope this helps,
    Guillaume Rouyre, MBA, MVP, P-Seller |

  • How to create table view with reference table

    Hi experts,
    How to create table view with reference table in SE11, plz gve me stp by stp procedure.
    pints grnded for hlp.

    Hi
    Go to Tcode se11 choose view and enter the name and create a popup opens up choose database view option
    enter the description
    On the left hand side choose the table name.
    Click on view fields tab and choose your table fields.Here you can choose which fields you want in your view.
    Save and then activate.
    Hope this helps.
    Regards,
    Harish

  • How to create a view with Oracle apps Org initialization ?

    Hi,
    How to create a view which needs Oracle apps org initialization to provide the correct data .
    The purpose of the view is to be accessed in Primavera DB via a DB link for reporting purpose.
    So how should the org be initialized so that the view returns the correct data when accessed from the remote data base using the DB link?
    EX: step1 run fnd_client_info.set_org_context for the org
    step2 query the veiw returns correct data in Oracle.
    How can this be achieved if the view needs to be accessed via DB link?
    sample view sql :
    select po_header_id
    from po_distributions_all pod
    where (apps.po_intg_document_funds_grp.get_active_encumbrance_func
    ('PO',
    pod.po_distribution_id
    ) <> 0
    Thanks in advance!
    Darshini

    Hi,
    This is not possible in Oracle. What u can do is create the view without the where clasue and supply the where clause at runtime.
    Hope this helps...
    Regards,
    Ganesh R

  • How to create a material master with referrence to exsisting material maste

    hi experts
    how to create the material master with reference to an existing material master ?
    please explain in steps
    regards
    jai

    Dear,
    It is very simple.
    Enter  MM01 t-code.
    Enter your existing material code in field of reference material code.
    If your material number range is external number range then enter number of material otherwise direct enter industry sector and material type.
    After enter basic detail system ask you plant/storage location detail and view detail.
    Select reference plant and storage location in left sight of diglog and enter plant and storage location in right sight of diglog screen for which you want to maintain material master.
    Then click on all view, If you want to change some detail change it.
    Due to reference material all detail is come from reference material.
    Then click on save.
    NOTE: - You can create new material with reference of old material but it is prerequest material type should be same of both material old and new.
    Regards,
    Mahesh Wagh

  • How to create production version & Explain with procedure

    how to create production version & Explain with procedure
    Madan

    Hi Madan,
    Production Versions are used to describe the production process to be used for planned / production order.
    Why is it required?
    Suppose you have 2/3 production lines and 2/3 alternative BOMs to produce one Finished Goods.
    How system will come to know which BOM and Routing to be used. This is done thru Prod.Version.
    In production version we maintain the combination of BOM and routing.
    Also it can be designed with lot size or validity period.
    Go to MM02--->MRP4 / Work scheduling view -
    > Prod.Version.
    Enter the validity period and lot size. and the production version should be unlocked.
    After entering the reqd. routing no. and BOM alternative , carry a check.
    After getting the Green signals ,Continue.
    Thus you have saved the prod. version.
    Mass processing TCode- C223.
    Hope it would clarify you the basic of production version.

  • How to create a navigation bar with custom made buttons?

    I'm used to work with a similar program as Muse. In there we can create a single button and link them together into a navigation bar. I have tried all sorts of tutorials but none of them is discussing this possibility.
    To summorize. The idea is to create a button in photoshop and to use this as a theme to build a navigation bar. Possible or not and how? Thanks for assistance. Rgds Rufin

    Hi Brad,
    Thanks for your reply.
    No, not really. I used to work with XARA up till now. And being an Adobe Cloud user I think it a bit silly using two different systems. In XARA I can create a custom button and turn them into a navbar. For your information I include a few links to sites I created with Xara and I would like to know if I can create the same type of navbars with Abobe Muse. I already found out that all the other functions are available and some work a lot better in Muse, but I’m stuck on the navbar issue. I know I can create a button in Adobe PS and use it in Muse. But I didn’t manage to figure out how to create a navbar in Muse on basis of a button created in PS.
    www.restaurant-cedric.be or www.discoamigo.com or www.radioparadijs.be
    Grtz,
    Rufin
    LOGO-RUFIN'S-REISBUREAU-outlook
    Koningslaan 36 – b31
    8300 Knokke – Heist
    Tel: 050621052
    Fax: 050621072
    e-mail:  <mailto:[email protected]> [email protected]
    <http://www.rufins.be/> http://www.rufins.be
    <http://www.travelcoop.be/> travelcoop_logo_2013[1]  <http://ferventreisagent.be/rufins-reisbureau> klein logo
    Van: Brad Lawryk
    Verzonden: zondag 12 oktober 2014 19:40
    Aan: RUFIN DUWEL
    Onderwerp:  How to create a navigation bar with custom made buttons?
    How to create a navigation bar with custom made buttons?
    created by Brad Lawryk <https://forums.adobe.com/people/Brad+Lawryk>  in Help with using Adobe Muse CC - View the full discussion <https://forums.adobe.com/message/6817739#6817739>

  • How to create an unsolved cube with awm???

    hi all,
    I readed the "Oracle Olap developer's guide to the Oalp api" and I found there's 2 type of Cube: Solved and Unsolved Cubes. And this document says: "... if all the data for a cube is specified by the DBA, then the cube is considered to be Solved. If some or all of the aggregate data must be calculated by Oracle OLap, then the cube is unsolved ..."
    I tried with awm 10.2.0.3.0A to create an unsolvedCube but I can't. All cubes I created are solvedCube. To know if a cube is solved or unsolved, I wrotte an program in Java to read informations of package mtm.
    Some one can tell me how to create an unsolved cube with AWM ou other soft please!

    SH is not a relational OLAP data model which is quite different from the GLOBAL schema which is based on an Analytic Workspace.
    If you change the aggregation method you will need to re-compute the whole cube which can be a very big job! You might be able to force the unsolved status be de-selecting all the levels on the Rules tab in AWM. However, I think by default analytic workspace OLAP models always provide a fully solved cube to the outside world. This is the nature of the multi-dimensional model.
    Relationally, as keys are located in separate columns a cube can be unsolved in that the key column only contains values for a single level from the corresponding dimension tables. If more than keys for different levels within the same dimension appear within the fact key column then the cube is deemed as being solved.
    Therefore, I am not sure you are going to get the information you require from the API. To changes the aggregation method you will have to switch off all pre-compute options and also disable the session cache to prevent previously calculated data being returned when you change the aggregation method.
    Hope this helps
    Keith Laker
    Oracle EMEA Consulting
    BI Blog: http://oraclebi.blogspot.com/
    DM Blog: http://oracledmt.blogspot.com/
    BI on Oracle: http://www.oracle.com/bi/
    BI on OTN: http://www.oracle.com/technology/products/bi/
    BI Samples: http://www.oracle.com/technology/products/bi/samples/

  • How to create an explain plan with rowsource statistics for a complex query that include multiple table joins ?

    1. How to create an explain plan with rowsource statistics for a complex query that include multiple table joins ?
    When multiple tables are involved , and the actual number of rows returned is more than what the explain plan tells. How can I find out what change is needed  in the stat plan  ?
    2. Does rowsource statistics gives some kind of  understanding of Extended stats ?

    You can get Row Source Statistics only *after* the SQL has been executed.  An Explain Plan midway cannot give you row source statistics.
    To get row source statistics either set STATISTICS_LEVEL='ALL'  in the session that executes theSQL OR use the Hint "gather_plan_statistics"  in the SQL being executed.
    Then use dbms_xplan.display_cursor
    Hemant K Chitale

  • How to create a Sales order with ref to Contract using Function Module

    How to create a Sales order with ref to Contract using Function Module BAPI_SALESDOCU_CREATEFROMDATA ?

    We have a unique situation where we like change the sold-to customer of the sales order
    once order has been created. These orders have been created using either by function module
    BAPI_SALESDOCUMENT_COPY or using BDC (VA01, Copy with reference).
    These two processes work abosolutely fine except someone might have change the sold-to
    customer of the ship-to customer of the original sales order. If this the case then the new
    sales order will be created with the old sold-to and with not the new sold-to.
    We tried using BAPI_SALESDOCUMENT_CHANGE and commit afterwards. We checked
    the returned parameteres of the BAPIs and they are all successful but sold-to remains the
    same old one.
    Any help would be much more appreciated.

  • How to create a pdf file with CS5

    Hello, I'm new to PhotoShop CS5 and haven't figured out yet (despite two hours of trying) how to create a pdf file with pictures and texts.  Can someone please help me with this ?  The "help" button in CS5 doesn't seem to cover this question.  Nor do the FAQs.
    Thank you very much.

    Save As... Photoshop PDF.

  • How to create  a test plan with specific transactions (or program)

    Hello,
    I'm a new user in Sol Man !
    How to create  a test plan with specific transactions (or program).
    In my Business Blueprint (SOLAR01) I've created in 'transaction tab' the name of my specific transactions and linked it.
    In my test plan (STWB_2) those specific doesn't appear to be selected !
    Thanks in advance.
    Georges HUYNEN

    Hi 
    In solar01 you have defined but you have to assign the test case in solar02 for this test case in the test cases tab.
    When you do so expand the business sceanario node in test plan generation of STWB_2 transaction and now that will appear.
    Also visit my weblog
    /people/community.user/blog/2006/12/07/organize-and-perform-testing-using-solution-manager
    please reward points.

  • How to create a web template with company logo

    how to create a web template with company logo . can any one help me with the steps. or any notes. thnaks in advance .
    2. i have 25000 articles and client want to have a selection feild to see top article ex:50,10,20, 100, 1000 etc . same for bottom articles . plz let me know how to do it . thanks for replay . i am new bw so plz .
    thanks to you all

    Hi
    1) Please read
    http://help.sap.com/saphelp_nw04/helpdata/en/4a/c8353c51aab32be10000000a114084/frameset.htm
    2) Create a condition in the Query Designer: Use a formula variable
    See http://help.sap.com/saphelp_nw04/helpdata/en/73/702e39074dc93de10000000a114084/frameset.htm
    Heike

  • How to create a transport request with query and only with its structure.

    HI guru,
                how to create a transport request with query and only with its structure.transport request should not  include any other query items like ( variables, conditions...etc)
    thanks in advance.
    venkata

    Hi,
    Goto RSA1 and then Transport Connection -> In SAP Transports select Object Types-> Query Elements -> Then select Query->Give Technical name of the query and then select for transfer. In the right side you can choose the components which you wanted to transport.
    Regards,
    anil

Maybe you are looking for