Syntax to create the view with 2 inline tables

Hello

If I run this SQL, I can compile a view without error:

CREATE OR REPLACE FORCE VIEW APPS.XX_TEST
(
    period_name
  , ytd
)
AS
with tbl_data AS
(
SELECT '1314-03:OCT' period_name, -100 YTD FROM DUAL UNION ALL
SELECT '1314-03:OCT' period_name, -1250 YTD FROM DUAL UNION ALL
SELECT '1314-03:OCT' period_name, 10922 YTD FROM DUAL UNION ALL
SELECT '1314-02:SEP' period_name, -100 YTD FROM DUAL UNION ALL
SELECT '1314-01:AUG' period_name, 0 YTD FROM DUAL UNION ALL
SELECT '1314-00:OBL' period_name, 0 YTD FROM DUAL UNION ALL
SELECT '1213-14:CBL' period_name, -350 YTD FROM DUAL UNION ALL
SELECT '1213-13:ADJ' period_name, -350 YTD FROM DUAL UNION ALL
SELECT '1213-12:JUL' period_name, -100 YTD FROM DUAL
)    SELECT  period_name
           , ytd
        FROM tbl_data;

I need to create a view that includes the 2 tables inline (sorry if this is the incorrect terminology), using this SQL:

CREATE OR REPLACE FORCE VIEW APPS.XX_TEST2
(
    period_name
  , ytd
)
AS
with tbl_data AS
(
SELECT '1314-03:OCT' period_name, -100 YTD FROM DUAL UNION ALL
SELECT '1314-03:OCT' period_name, -1250 YTD FROM DUAL UNION ALL
SELECT '1314-03:OCT' period_name, 10922 YTD FROM DUAL UNION ALL
SELECT '1314-02:SEP' period_name, -100 YTD FROM DUAL UNION ALL
SELECT '1314-01:AUG' period_name, 0 YTD FROM DUAL UNION ALL
SELECT '1314-00:OBL' period_name, 0 YTD FROM DUAL UNION ALL
SELECT '1213-14:CBL' period_name, -350 YTD FROM DUAL UNION ALL
SELECT '1213-13:ADJ' period_name, -350 YTD FROM DUAL UNION ALL
SELECT '1213-12:JUL' period_name, -100 YTD FROM DUAL
), got_analytics AS
    (
        SELECT  
            period_name,
            ytd,
            ROW_NUMBER () OVER (ORDER BY  period_name)  AS a_num,
            ROW_NUMBER () OVER (ORDER BY  period_name  DESC)  AS d_num,
            FIRST_VALUE (ytd) OVER (ORDER BY  period_name) - FIRST_VALUE (ytd) OVER (ORDER BY  period_name  DESC) AS dif
    FROM    tbl_data
    )
    SELECT  *
       FROM got_analytics;

I get this message:

ORA-24344: success with compilation error

There are no other errors but to provide additional information. I am using TOAD.

I was wondering if it is not possible to create a view in this way, or if I'm missing something?

I had a peek here:

ORA-24344: success with Compilation error

I'm using TOAD, trying to SHOW the ERRORS immediately after the code above only returned 'No Errors'.

I also looked here:

ORA-24344: success with compilation error

Ran the same code SQL/Plus, but "Show Errors" or "see the err" also returned "No. Errors."

Any advice would be much appreciated.

Thank you very much.

Hello

Try this

  CREATE OR REPLACE FORCE VIEW  APPS.XX_TEST2
    (
        period_name
      , ytd
      ,  a_num    -- because you select * you need all rows
      ,  d_num
      ,  dif
    )
    AS  ...

concerning
Kay

Tags: Database

Similar Questions

  • Create the view with the Unique ID column

    I need to create a view.
    The view is created using unions on 4 tables.
    The problem is that I need to create a unique id column in the view that I use in an Oracle Apex application and need to drill down to each line.

    Any help appreciated

    Gus

    You cannot use oracle sequences directly in the query that is connected with other queries using Union or INTERSECT or less cluses.

    Other cases where you cannot use a sequence are:
    -In a WHERE clause
    -In a GROUP BY or ORDER BY clause
    -In a SEPARATE clause
    -Along with a UNION or INTERSECT or LESS
    -In a subquery

    In order to better you will love

    Select seqname.nextval, col1, col2
    Of
    (

    Union

    ..
    ..
    )

    as mentioned in one of the previous answer by the other members of the community...

    Alternatively, you can use rownum speed of sequence to a unique number as below examle:

    Select rownum, col1, col2
    Of
    (

    Union

    ..
    ..
    )

    Kind regards
    Lifexisxnotxsoxbeautiful...

  • Create the view with the dynamic from clause

    Hi all

    you might have some ideas to help me out of my problem I just "created myself" ;-)

    I have an unknown quantity and not constant of the tables using the same structure of the table and I have a main table
    that contains all the names of these table types. Now, I want to create a unique view that contains all the columns in each table
    and an extra column name containing the name of the corresponding table.

    I found a solution for this but only if I knew that all the table names while creating my view.

    Here is what I currently have:

    master_table:
    TABLENAME ID
    1 table_01
    2 table_02


    table_01:
    ID NAME
    1 eins
    zwei 2
    drei 3


    table_02:
    ID NAME
    1 a
    2 two
    3 three


    I think 'tab1tab2' on these 2 table looks like this:

    ID NAME TABLENAME
    1 table_01 eins
    2 zwei table_01
    3 drei table_01
    1 a table_02
    2 two table_02
    3 three table_02


    I have reached this point of view with:

    CREATE OR REPLACE VIEW TAB1TAB2 ('ID', 'NAME', 'TABLENAME')
    AS
    SELECT id, name, 'table_01' AS table_01 FROM tablename
    UNION
    SELECT id, name, 'table_02' AS tablename FROM table_02;



    Is it possible to create as many select statements and union that I entered (tablenames) into my master_table to achieve the same results as my opinion hard?

    Thank you very much in advance for your help

    Best regards

    Majo

    create or replace view v_alltables
    Select * from v_all;

    These two statement contradict each other in some way, Don't they?

    path ID number name 'id', varchar2 (20) 'name' of the path) x;

    the column names are case sensitive - try

      id number path 'ID' , name varchar2(20) path 'NAME' ) x;
    

    assuming that the names of the columns are named like that.

  • Create the view with the CLOB of TABLE data type with the LONG data type

    Please need support to create the table view
    Source table: (itemid varchar2, longrec)
    need to create the table view Source
    (itemid varchar2, CLOBrec)

    A BUSINESS object must have a storage in the database, so you can't have a CLOB column in a view by pointing to a not lob data column.

    Max
    [My Italian blog Oracle | http://oracleitalia.wordpress.com/2010/01/17/supporto-di-xml-schema-in-oracle-xmldb/]

  • Its replacement by the view with a physical table... and then perhaps change its name

    Hi all

    Let's say I have a vision of "Select" as a source on the physical layer. Some time later, I decide to replace it with an ordinary table

    (1) simply changing Select for the physical Table won't be enough in table properties?

    (2) what will happen if I decide to go with a different name for this new table? (I guess that the administration tool would pick up the change and spread throughout of the MDB and presentation - but I try just to make sure)

    Well either you keep the fully qualified name of the object (i.e. change just where it points to the bottom) - in which case there is no need even to touch whatever it is above the physical layer - or otherwise you put the new table/view in place and then use the Admin Utility tool "replace column or logical Table Source Table" for let the wizard remapping for you.

    See you soon,.
    C.

  • Error message of nonsense trying to create the view

    Hello all,.

    Oracle Database 11 g Enterprise Edition Release 11.2.0.1.0 - 64 bit Production on Windows 2008R2

    I get an error when trying to create a view. The error makes no sense in that didn't evoke any attempt to change a user name or password in the error in production.

    I can run the complete select statement very well, I retrieve the results.

    If I comment out the line shown as being in error, the problem moves to the line before the tour. 4 lines before the line specified by the error message are similar. The error occurs on the last of the 5 similar lines of code.

    If I move all 5 lines above in the code the error moves accordingly.

    Function validate_number (near where the error is identified) under certain conditions, it will issue an immediate "alter session set nls_numeric_characters =" execution., "';"

    The number of the column identified in the error message is 2 spaces before the validate_number function call.

    Here is the syntax for creating the view, the error message is at the bottom.

    Figures on the far left indicate the line number. I put 2 blank lines before and after the line of code identified by the error message.

    The error points to the 2-seater before the VALIDATE_NUMBER function call on line 350. just before the code sql == > validate_number(Spend_Qty,'')), 0) < ==

    Thanks for your time,
    Bob
    CREATE OR REPLACE VIEW REPORT_STAGING_V AS
    -  SELECT
    -    SPEND_STAGING.INPUT_FILE_ID,
    -    SPEND_STAGING.SPEND_ID,
    -    SPEND_STAGING.SPEND_DOC_NUM,
    -    SPEND_STAGING.SPEND_DOC_ITM_NUM,
    -    SPEND_STAGING.SPEND_DOC_YR_NUM,
    -    SPEND_STAGING.ACCT_PYBL_INV_DOC_NUM,
    -    SPEND_STAGING.ACCT_PYBL_INV_FSCL_YR_NUM,
    -    SPEND_STAGING.COMPANY_CODE,
    -    SPEND_STAGING.ACCT_PYBL_INV_LN_ITM_NUM,
    -    SPEND_STAGING.SPEND_DOC_TYPE_CD,
    -    SPEND_STAGING.SPEND_MTHD_TXT,
    -    NVL(SPEND_STAGING.SRC_SYS_CD, '<BLANK>') SRS_SYS_CD,
    -    SPEND_STAGING.SPEND_SAVING_DT,
    -    SPEND_STAGING.SPEND_SAVING_FSCL_WK_NUM,
    -    SPEND_STAGING.SPEND_SAVING_FSCL_MTH_NUM,
    -    SPEND_STAGING.SPEND_SAVING_FSCL_QTR_NUM,
    -    SPEND_STAGING.SPEND_SAVING_FSCL_YR_NUM,
    -    SPEND_STAGING.MTRL_GRP_CD,
    -    SPEND_STAGING.MTRL_GRP_DESC_TXT,
    -    SPEND_STAGING.MTRL_GRP_LVL_1_TXT,
    -    SPEND_STAGING.MTRL_GRP_LVL_2_TXT,
    -    SPEND_STAGING.MTRL_GRP_LVL_3_TXT,
    -    SPEND_STAGING.MTRL_GRP_LVL_4_TXT,
    -    SPEND_STAGING.MTRL_GRP_LVL_5_TXT,
    -    SPEND_STAGING.MTRL_GRP_LVL_6_TXT,
    -    SPEND_STAGING.MTRL_GRP_LVL_7_TXT,
    -    SPEND_STAGING.MTRL_GRP_LVL_8_TXT,
    -    SPEND_STAGING.GL_ACCT_NUM,
    -    SPEND_STAGING.GL_ACCT_DESC,
    -    SPEND_STAGING.COST_CENTR_CD,
    -    SPEND_STAGING.PRFT_CENTR_CD,
    -    SPEND_STAGING.FUNCNL_AREA_CD,
    -    SPEND_STAGING.PURCH_GRP_CD,
    -    SPEND_STAGING.PURCH_GRP_NAM,
    -    SPEND_STAGING.PURCH_ORG_CD,
    -    SPEND_STAGING.PURCH_ORG_NAM,
    -    SPEND_STAGING.REGION_CODE,
    -    SPEND_STAGING.VNDR_ACCT_ROOT_NUM,
    -    SPEND_STAGING.VNDR_CORP_NAM,
    -    SPEND_STAGING.VNDR_CORP_TICKER_SYMBL_CD,
    -    SPEND_STAGING.BUYPOINT_VNDR_ACCT_NUM,
    -    SPEND_STAGING.BUYPOINT_VNDR_FIRST_NAM,
    -    SPEND_STAGING.PAYPOINT_VNDR_ACCT_NUM,
    -    SPEND_STAGING.PAYPOINT_VNDR_FIRST_NAM,
    -    SPEND_STAGING.SPEND_PYMNT_TERM_CD,
    -    SPEND_STAGING.SPEND_PYMNT_TERM_DESC,
    -    SPEND_STAGING.SPEND_PYMNT_BSLN_DT,
    -50  SPEND_STAGING.SPEND_PYMNT_CLRNG_DT,
    -    SPEND_STAGING.CONTRACTUAL_PYMNT_TERM_DY_CNT,
    -    SPEND_STAGING.VNDR_MTRL_NUM,
    -    SPEND_STAGING.MTRL_ID_1280,
    -    SPEND_STAGING.MTRL_DESC,
    -    SPEND_STAGING.BAT_NUM,
    -    SPEND_STAGING.SPCL_STOCK_IND,
    -    SPEND_STAGING.INVTY_MVMNT_TYPE_CD,
    -    SPEND_STAGING.GOODS_RCPNT_NAM,
    -    SPEND_STAGING.MFG_PART_NUM,
    -    SPEND_STAGING.PLANT_CD,
    -    SPEND_STAGING.PLANT_DESC,
    -    SPEND_STAGING.STORAGE_LOC_CD,
    -    SPEND_STAGING.STORAGE_LOC_DESC,
    -    SPEND_STAGING.UNLOADING_PT_DESC,
    -    SPEND_STAGING.PO_NUM,
    -    SPEND_STAGING.PO_LN_ITM_NUM,
    -    SPEND_STAGING.PO_LN_ITM_LAST_CHNG_DT,
    -    SPEND_STAGING.PO_DOC_DT,
    -    SPEND_STAGING.PO_TYPE_CD,
    -    SPEND_STAGING.PO_TYPE_DESC,
    -    SPEND_STAGING.PO_UOM_CD,
    -    SPEND_STAGING.PO_PYMNT_TERM_CD,
    -    SPEND_STAGING.ASGND_ACCT_CTGRY_TYPE_CD,
    -    SPEND_STAGING.PO_SHORT_TXT,
    -    SPEND_STAGING.GR_MTRL_DOC_TXT,
    -    SPEND_STAGING.ACCT_PYBL_INV_ITM_TXT,
    -    SPEND_STAGING.PO_RCPT_INV_HST_DOC_POST_DT,
    -    SPEND_STAGING.APPRTN_NUM,
    -    SPEND_STAGING.REQTN_TRK_NUM,
    -    SPEND_STAGING.REQTN_LN_NUM,
    -    SPEND_STAGING.REQTN_LN_ITM_NUM,
    -    SPEND_STAGING.REQTN_PERSN_ACCT_ID,
    -    SPEND_STAGING.NTWRK_NUM,
    -    SPEND_STAGING.NTWRK_CTGRY_CD,
    -    SPEND_STAGING.PROJ_NAM,
    -    SPEND_STAGING.WBS_ELMNT_NAM,
    -    SPEND_STAGING.CPTL_PO_IND,
    -    LU_GAC_STAGING.TIER_SUPPLIER,
    -    CASE
    -      WHEN SPEND_STAGING.PRCRMNT_RPTNG_LVL_3_TXT = 'GAC'
    -      AND LU_GAC_STAGING.PO_SHORT_TXT            = SPEND_STAGING.PO_SHORT_TXT
    -      AND SPEND_STAGING.SRC_SPLR_NAM            IS NULL
    -      THEN LU_GAC_STAGING.TIER_SUPPLIER
    -      ELSE SRC_SPLR_NAM
    -    END SRC_SPLR_NAM,
    -    SPEND_STAGING.TAX_CD,
    -    SPEND_STAGING.TAX_CD_DESC,
    -    SPEND_STAGING.TAX_JURISDICTION_TXT,
    -    SPEND_STAGING.MTRL_DOC_PRCS_UOM_QTY,
    -100 SPEND_STAGING.MTRL_DOC_UNIT_OF_ENTRY_QTY,
    -    SPEND_STAGING.PO_LN_ITM_QTY,
    -    SPEND_STAGING.PO_LN_ITM_NET_PRC_UNIT_QTY,
    -    SPEND_STAGING.PO_LN_ITM_NET_PRC_USD_AMT,
    -    SPEND_STAGING.PO_LN_ITM_NET_PRC_DC_AMT,
    -    SPEND_STAGING.PO_LN_ITM_NET_PRC_BDGT_USD_AMT,
    -    SPEND_STAGING.PO_LN_ITM_TOT_USD_AMT,
    -    SPEND_STAGING.SPEND_USD_AMT,
    -    SPEND_STAGING.SPEND_DOC_CURNCY_AMT,
    -    SPEND_STAGING.SPEND_LOCAL_CURNCY_AMT,
    -    SPEND_STAGING.SPEND_BDGT_USD_AMT,
    -    SPEND_STAGING.SPEND_QTY,
    -    SPEND_STAGING.SPEND_QTY_UOM_CD,
    -    SPEND_STAGING.SPEND_UNIT_OF_ENTRY_QTY,
    -    SPEND_STAGING.SPEND_UNIT_OF_ENTRY_UOM_CD,
    -    SPEND_STAGING.SPEND_DC_FX_MTH_CNVRSN_FCT_VAL,
    -    SPEND_STAGING.SPEND_DC_FX_BDG_CNVRSN_FCT_VAL,
    -    SPEND_STAGING.CMPNY_LOCAL_CURNCY_CD,
    -    SPEND_STAGING.DOC_CURNCY_CD,
    -    SPEND_STAGING.TRANSTN_TYPE_CD,
    -    SPEND_STAGING.ACCT_ASGNMT_SEQ_NUM,
    -    SPEND_STAGING.GLPCA_LN_ITM_REC_NUM,
    -    SPEND_STAGING.PCA_REF_DOC_NUM,
    -    SPEND_STAGING.CO_DOC_NUM,
    -    SPEND_STAGING.CO_FSCL_YR_NUM,
    -    SPEND_STAGING.CO_LN_ITM_NUM,
    -    SPEND_STAGING.VNDR_REF_DOC_NUM,
    -    SPEND_STAGING.SAVING_MTHD_TXT,
    -    SPEND_STAGING.SAVING_CMNT_TXT,
    -    SPEND_STAGING.SAVING_COND_NUM,
    -    SPEND_STAGING.SAVING_COND_ITM_NUM,
    -    SPEND_STAGING.SAVING_COND_TYPE_CD,
    -    SPEND_STAGING.SAVING_COND_TYPE_DESC,
    -    SPEND_STAGING.SAVING_COND_CURNCY_CD,
    -    SPEND_STAGING.SAVING_COND_PRC_UNIT_UOM_CD,
    -    SPEND_STAGING.SAVING_COND_PRC_UNIT_QTY,
    -    SPEND_STAGING.SAVING_COND_RTE_USD_AMT,
    -    SPEND_STAGING.SAVING_COND_CURNCY_CNVRSN_VAL,
    -    SPEND_STAGING.SAVING_COND_CURNCY_BDGT_CNVRSN,
    -    SPEND_STAGING.PO_TRANSTN_COND_DC_AMT,
    -    SPEND_STAGING.PO_TRANSTN_COND_USD_AMT,
    -    SPEND_STAGING.SAVING_RTE_PER_USD_AMT,
    -    SPEND_STAGING.SAVING_PER_USD_AMT,
    -    SPEND_STAGING.SAVING_PER_BDGT_USD_AMT,
    -    SPEND_STAGING.AVOIDANCE_USD_AMT,
    -    SPEND_STAGING.AVOIDANCE_BDGT_USD_AMT,
    -    SPEND_STAGING.SAVING_USD_AMT,
    -    SPEND_STAGING.SAVING_BDGT_USD_AMT,
    -    SPEND_STAGING.NO_FX_SAVING_USD_AMT,
    -    SPEND_STAGING.NO_FX_AVOIDANCE_USD_AMT,
    -150 SPEND_STAGING.TOT_REDUCTN_USD_AMT,
    -    SPEND_STAGING.TOT_REDUCTN_BDGT_USD_AMT,
    -    SPEND_STAGING.TOT_NO_FX_REDUCTN_USD_AMT,
    -    SPEND_STAGING.PAYMENTNET_TRANSTN_NUM,
    -    SPEND_STAGING.PAYMENTNET_TRANSTN_LN_ITM_NUM,
    -    SPEND_STAGING.ROW_CRTE_GMT_DTTM,
    -    SPEND_STAGING.ROW_MODIFY_GMT_DTTM,
    -    SPEND_STAGING.ROW_CRTE_MST_DTTM,
    -    SPEND_STAGING.ROW_MODIFY_MST_DTTM,
    -    SPEND_STAGING.PRCRMNT_DIRECTOR_NAM,
    -    SPEND_STAGING.PRCRMNT_PLANT_DSGNTN,
    -    SPEND_STAGING.PRCRMNT_RPTNG_LVL_1_TXT,
    -    SPEND_STAGING.PRCRMNT_RPTNG_LVL_2_TXT,
    -    SPEND_STAGING.PRCRMNT_RPTNG_LVL_3_TXT,
    -    SPEND_STAGING.SPEND_CAT_ID,
    -    SPEND_STAGING.SPEND_RULE_ID,
    -    SPEND_STAGING.TRANSACTION_DATE,
    -    SPEND_STAGING.SPEND_AMOUNT,
    -    SPEND_STAGING.ITEM_DESCRIPTION,
    -    SPEND_STAGING.SUPPLIER_ID,
    -    CASE
    -      WHEN SPEND_STAGING.SOURCE ='SPEND'
    -      THEN 'Spend and Savings'
    -      WHEN SPEND_STAGING.SOURCE ='TRAVEL'
    -      THEN 'Travel'
    -      ELSE NULL
    -    END SOURCE,
    -    SPEND_STAGING.SUPPLIER_NUMBER,
    -    SPEND_STAGING.TRAVEL_PERSNO,
    -    SPEND_STAGING.TRIP,
    -    SPEND_STAGING.TRAVEL_DOC,
    -    SPEND_STAGING.TRAVEL_EXPTY,
    -    SPEND_STAGING.TRAVEL_EXP_TYPE_DESC,
    -    SPEND_STAGING.TRAVLE_CREDIT_CARD_TRAN_DESC TRAVEL_CREDIT_CARD_TRAN_DESC,
    -    SPEND_STAGING.COUNTRY_CODE,
    -    SPEND_STAGING.TRAVEL_INFO,
    -    SPEND_STAGING.TRAVEL_ID,
    -    SPEND_STAGING.TRAVEL_DOCUMENT_NUMBER,
    -    SPEND_STAGING.TRAVEL_LAST_NAME_FIRST_NAME,
    -    SPEND_STAGING.TRAVEL_TRIP_REASON,
    -    SPEND_STAGING.TRAVEL_TRIP_STATUS,
    -    SPEND_STAGING.TRAVEL_RATE,
    -    SPEND_STAGING.FINANCE_ORG,
    -    SPEND_STAGING.ASSOCIATED_MG_CODE,
    -   SPEND_STAGING.COUNTRY_DESC,
    -   SPEND_STAGING.TRAVEL_ID_DESC_BANKCARD,
    -    SPEND_STAGING.COMPANY_CODE_DESC,
    -    SPEND_STAGING.COST_CENTER_DESC,
    -    'Q'||TO_CHAR(SPEND_STAGING.TRANSACTION_DATE,'Q') QUARTERNAME,
    -    TO_CHAR(SPEND_STAGING.TRANSACTION_DATE,'YYYY') YEARNAME,
    -200 CASE
    -      WHEN SPEND_STAGING.SRC_SYS_CD = 'P-CARD'
    -      THEN SS2.CLEANSED_PARENT_NAME
    -      ELSE SS1.CLEANSED_PARENT_NAME
    -    END CLEANSED_PARENT_NAME,
    -    CASE
    -      WHEN SPEND_STAGING.SRC_SYS_CD = 'P-CARD'
    -      THEN SS2.cleansed_name_1
    -      ELSE SS1.cleansed_name_1
    -    END CLEANSED_NAME1,
    -    CASE
    -      WHEN SPEND_STAGING.MTRL_ID_1280 IS NULL
    -       AND SPEND_STAGING.VNDR_MTRL_NUM IS NOT NULL
    -      THEN SPEND_STAGING.VNDR_MTRL_NUM
    -      WHEN SPEND_STAGING.MTRL_ID_1280 IS NULL
    -       AND SPEND_STAGING.VNDR_MTRL_NUM IS NULL
    -       AND SPEND_STAGING.MFG_PART_NUM  IS NOT NULL
    -      THEN SPEND_STAGING.MFG_PART_NUM
    -      WHEN SPEND_STAGING.MTRL_GRP_LVL_4_TXT = 'EFM'
    -       AND SPEND_STAGING.PO_TYPE_CD         = 'ZAR'
    -       AND SPEND_STAGING.MTRL_ID_1280       IS NOT NULL
    -      THEN SPEND_STAGING.MTRL_ID_1280||'-MIX'
    -      WHEN SPEND_STAGING.MTRL_GRP_LVL_4_TXT = 'EWM'
    -       AND SPEND_STAGING.PO_TYPE_CD          = 'ZAR'
    -       AND SPEND_STAGING.MTRL_ID_1280       IS NOT NULL
    -      THEN SPEND_STAGING.MTRL_ID_1280
    -        ||'-MIX'
    -      WHEN SPEND_STAGING.MTRL_GRP_LVL_4_TXT = 'EWM'
    -      AND SPEND_STAGING.PO_TYPE_CD          = 'ZSA'
    -      AND SPEND_STAGING.MTRL_ID_1280       IS NOT NULL
    -      THEN SPEND_STAGING.MTRL_ID_1280
    -        ||'-ASMBLY'
    -      WHEN SPEND_STAGING.MTRL_GRP_LVL_4_TXT = 'EFM'
    -      AND SPEND_STAGING.PO_TYPE_CD          = 'ZSA'
    -      AND SPEND_STAGING.MTRL_ID_1280       IS NOT NULL
    -      THEN SPEND_STAGING.MTRL_ID_1280
    -        ||'-ASMBLY'
    -      WHEN SPEND_STAGING.MTRL_GRP_LVL_4_TXT = 'EFM'
    -      AND SPEND_STAGING.PO_TYPE_CD          = 'ZST'
    -      AND SPEND_STAGING.MTRL_ID_1280       IS NOT NULL
    -      THEN SPEND_STAGING.MTRL_ID_1280
    -        ||'-TEST'
    -      WHEN SPEND_STAGING.MTRL_GRP_LVL_4_TXT = 'EWM'
    -      AND SPEND_STAGING.PO_TYPE_CD          = 'ZST'
    -      AND SPEND_STAGING.MTRL_ID_1280       IS NOT NULL
    -      THEN SPEND_STAGING.MTRL_ID_1280
    -        ||'-TEST'
    -      WHEN SPEND_STAGING.MTRL_GRP_LVL_4_TXT = 'EFM'
    -      AND SPEND_STAGING.PO_TYPE_CD          = 'ZBI'
    -      AND SPEND_STAGING.MTRL_ID_1280       IS NOT NULL
    -250   THEN SPEND_STAGING.MTRL_ID_1280
    -        ||'-BURN-IN'
    -      WHEN SPEND_STAGING.MTRL_GRP_LVL_4_TXT = 'EWM'
    -      AND SPEND_STAGING.PO_TYPE_CD          = 'ZBI'
    -      AND SPEND_STAGING.MTRL_ID_1280       IS NOT NULL
    -      THEN SPEND_STAGING.MTRL_ID_1280
    -        ||'-BURN-IN'
    -      WHEN SPEND_STAGING.MTRL_GRP_LVL_4_TXT = 'EFM'
    -      AND SPEND_STAGING.PO_TYPE_CD          = 'ZRJ'
    -      AND SPEND_STAGING.MTRL_ID_1280       IS NOT NULL
    -      THEN SPEND_STAGING.MTRL_ID_1280
    -        ||'-REJECT'
    -      WHEN SPEND_STAGING.MTRL_GRP_LVL_4_TXT = 'EWM'
    -      AND SPEND_STAGING.PO_TYPE_CD          = 'ZRJ'
    -      AND SPEND_STAGING.MTRL_ID_1280       IS NOT NULL
    -      THEN SPEND_STAGING.MTRL_ID_1280
    -        ||'-REJECT'
    -      WHEN SPEND_STAGING.MTRL_GRP_LVL_4_TXT = 'EFM'
    -      AND SPEND_STAGING.PO_TYPE_CD          = 'ZPR'
    -      AND SPEND_STAGING.MTRL_ID_1280       IS NOT NULL
    -      THEN SPEND_STAGING.MTRL_ID_1280
    -        ||'-PROBE'
    -      WHEN SPEND_STAGING.MTRL_GRP_LVL_4_TXT = 'EWM'
    -      AND SPEND_STAGING.PO_TYPE_CD          = 'ZPR'
    -      AND SPEND_STAGING.MTRL_ID_1280       IS NOT NULL
    -      THEN SPEND_STAGING.MTRL_ID_1280
    -        ||'-PROBE'
    -      WHEN SPEND_STAGING.MTRL_GRP_LVL_4_TXT = 'EFM'
    -      AND SPEND_STAGING.PO_TYPE_CD          = 'ZEF'
    -      AND SPEND_STAGING.MTRL_ID_1280       IS NOT NULL
    -      THEN SPEND_STAGING.MTRL_ID_1280
    -        ||'-ENG'
    -      WHEN SPEND_STAGING.MTRL_GRP_LVL_4_TXT = 'EWM'
    -      AND SPEND_STAGING.PO_TYPE_CD          = 'ZEF'
    -      AND SPEND_STAGING.MTRL_ID_1280       IS NOT NULL
    -      THEN SPEND_STAGING.MTRL_ID_1280
    -        ||'-ENG'
    -      WHEN SPEND_STAGING.MTRL_GRP_LVL_4_TXT = 'EFM'
    -      AND SPEND_STAGING.PO_TYPE_CD          = 'ZEM'
    -      AND SPEND_STAGING.MTRL_ID_1280       IS NOT NULL
    -      THEN SPEND_STAGING.MTRL_ID_1280
    -        ||'-ENG'
    -      WHEN SPEND_STAGING.MTRL_GRP_LVL_4_TXT = 'EWM'
    -      AND SPEND_STAGING.PO_TYPE_CD          = 'ZEM'
    -      AND SPEND_STAGING.MTRL_ID_1280       IS NOT NULL
    -      THEN SPEND_STAGING.MTRL_ID_1280
    -        ||'-ENG'
    -      WHEN SPEND_STAGING.MTRL_GRP_LVL_4_TXT = 'EFM'
    -      AND SPEND_STAGING.PO_TYPE_CD          = 'ZEU'
    -      AND SPEND_STAGING.MTRL_ID_1280       IS NOT NULL
    -300   THEN SPEND_STAGING.MTRL_ID_1280
    -        ||'-ENGWFR'
    -      WHEN SPEND_STAGING.MTRL_GRP_LVL_4_TXT = 'EWM'
    -      AND SPEND_STAGING.PO_TYPE_CD          = 'ZEU'
    -      AND SPEND_STAGING.MTRL_ID_1280       IS NOT NULL
    -      THEN SPEND_STAGING.MTRL_ID_1280
    -        ||'-ENGWFR'
    -      WHEN SPEND_STAGING.MTRL_GRP_LVL_4_TXT = 'EFM'
    -      AND SPEND_STAGING.PO_TYPE_CD          = 'ZSF'
    -      AND SPEND_STAGING.MTRL_ID_1280       IS NOT NULL
    -      THEN SPEND_STAGING.MTRL_ID_1280
    -        ||'-WFR'
    -      WHEN SPEND_STAGING.MTRL_GRP_LVL_4_TXT = 'EWM'
    -      AND SPEND_STAGING.PO_TYPE_CD          = 'ZSF'
    -      AND SPEND_STAGING.MTRL_ID_1280       IS NOT NULL
    -      THEN SPEND_STAGING.MTRL_ID_1280
    -        ||'-WFR'
    -      WHEN SPEND_STAGING.MTRL_GRP_LVL_4_TXT = 'EFM'
    -      AND SPEND_STAGING.PO_TYPE_CD          = 'ZEF'
    -      AND SPEND_STAGING.MTRL_ID_1280       IS NOT NULL
    -      THEN SPEND_STAGING.MTRL_ID_1280
    -        ||'-ENG'
    -      WHEN SPEND_STAGING.MTRL_GRP_LVL_4_TXT = 'EWM'
    -      AND SPEND_STAGING.PO_TYPE_CD          = 'ZEF'
    -      AND SPEND_STAGING.MTRL_ID_1280       IS NOT NULL
    -      THEN SPEND_STAGING.MTRL_ID_1280
    -        ||'-ENG'
    -      WHEN SPEND_STAGING.MTRL_GRP_LVL_4_TXT = 'EFM'
    -      AND SPEND_STAGING.MTRL_ID_1280       IS NOT NULL
    -      THEN SPEND_STAGING.MTRL_ID_1280
    -        ||'-POTypeCode'
    -      WHEN SPEND_STAGING.MTRL_GRP_LVL_4_TXT = 'EWM'
    -      AND SPEND_STAGING.MTRL_ID_1280       IS NOT NULL
    -      THEN SPEND_STAGING.MTRL_ID_1280
    -        ||'-POTypeCode'
    -      ELSE SPEND_STAGING.MTRL_ID_1280
    -    END ReportingPartNum,
    -    LU_PCARD_STAGING.COST_CENTR_CD PCARD_COST_CENTR_CD,
    -    LU_PCARD_STAGING.CTY_NAM PCARD_CTY_NAM,
    -    LU_PCARD_STAGING.DISABLE_LINE PCARD_DISABLE_LINE,
    -    LU_PCARD_STAGING.DISABLED_OWNED_BIZ_FLG PCARD_DISABLED_OWNED_BIZ_FLG,
    -    LU_PCARD_STAGING.DIVERSITY_VNDR_FLG PCARD_DIVERSITY_VNDR_FLG,
    -    LU_PCARD_STAGING.FIELD PCARD_FIELD,
    -    LU_PCARD_STAGING.GL_ACCT_NUM PCARD_GL_ACCT_NUM,
    -    LU_PCARD_STAGING.HUB_ZONE_SMALL_BIZ_CONCERN_FLG PCARD_HUB_ZONE,
    -    LU_PCARD_STAGING.MINORITY_OWNED_BIZ_FLG PCARD_MINORITY_OWNED_BIZ_FLG,
    -    NVL(validate_number(Po_Ln_Itm_Net_Prc_Usd_Amt,'')/DECODE(validate_number(Po_Ln_Itm_Net_Prc_Unit_Qty,''),0,1,validate_number(Po_Ln_Itm_Net_Prc_Unit_Qty,'')),0) po_unit_price_per_1_usd,
    -    NVL(validate_number(Po_Ln_Itm_Net_Prc_Dc_Amt,'') /DECODE(validate_number(Po_Ln_Itm_Net_Prc_Unit_Qty,''),0,1,validate_number(Po_Ln_Itm_Net_Prc_Unit_Qty,'')),0) po_unit_price_per_1_doc_cur,
    -    NVL(validate_number(Spend_Bdgt_Usd_Amt,'')       /DECODE(validate_number(Spend_Qty,''),0,1,                 validate_number(Spend_Qty,'')),0)                  spend_up_per_1_usd_budgt_rate,
    -    NVL(validate_number(Spend_Usd_Amt,'')            /DECODE(validate_number(Spend_Qty,''),0,1,                 validate_number(Spend_Qty,'')),0)                  spend_up_per_1_usd_mon_rate,
    
    
    -350 NVL(validate_number(Spend_Doc_Curncy_Amt,'')     /DECODE(validate_number(Spend_Qty,''),0,1,                 validate_number(Spend_Qty,'')),0)                  Spend_UP_per_1_Doc_Curr,
    
    
    -
    -    TO_CHAR(TRANSACTION_DATE,'MM-YYYY') MONTH_YEAR,
    -    LU_PCARD_STAGING.MTRL_GRP_CD PCARD_MTRL_GRP_CD,
    -    LU_PCARD_STAGING.PAYMENTNET_TRANSTN_LN_ITM_NUM PCARD_PAY_TRANSTN_LN_ITM_NUM,
    -    LU_PCARD_STAGING.PAYMENTNET_TRANSTN_NUM PCARD_PAY_TRANSTN_NUM,
    -    LU_PCARD_STAGING.PAYMENTNET_TRANSTN_POST_DT PCARD_PAY_TRANSTN_POST_DT,
    -    LU_PCARD_STAGING.PCARD_INV_AMT PCARD_INV_AMT,
    -    LU_PCARD_STAGING.PCARD_INV_CURNCY_CD PCARD_INV_CURNCY_CD,
    -    LU_PCARD_STAGING.PCARD_INV_DT PCARD_INV_DT,
    -    LU_PCARD_STAGING.PCARD_INV_LN_ITM_AMT PCARD_INV_LN_ITM_AMT,
    -    LU_PCARD_STAGING.PCARD_INV_LN_ITM_TAX_AMT PCARD_INV_LN_ITM_TAX_AMT,
    -    LU_PCARD_STAGING.PCARD_INV_LN_ITM_TAX_CD PCARD_INV_LN_ITM_TAX_CD,
    -    LU_PCARD_STAGING.PCARD_INV_REF_NUM PCARD_INV_REF_NUM,
    -    LU_PCARD_STAGING.PCARD_INV_TAX_AMT PCARD_INV_TAX_AMT,
    -    LU_PCARD_STAGING.PCARD_MERCHANT_NAM PCARD_MERCHANT_NAM,
    -    LU_PCARD_STAGING.PCARD_OWNR_ID PCARD_OWNR_ID,
    -    LU_PCARD_STAGING.PCARD_SHORT_TXT PCARD_SHORT_TXT,
    -    LU_PCARD_STAGING.PCARD_SRC_FILE_NAM PCARD_SRC_FILE_NAM,
    -    LU_PCARD_STAGING.PLANT_CD PCARD_PLANT_CD,
    -    LU_PCARD_STAGING.PURCH_GRP_CD PCARD_PURCH_GRP_CD,
    -    LU_PCARD_STAGING.RCPNT_ID PCARD_RCPNT_ID,
    -    LU_PCARD_STAGING.REQTN_CRTE_BY_ID PCARD_REQTN_CRTE_BY_ID,
    -    LU_PCARD_STAGING.REQTN_LN_ITM_NUM PCARD_REQTN_LN_ITM_NUM,
    -    LU_PCARD_STAGING.REQTN_NUM PCARD_REQTN_NUM,
    -    LU_PCARD_STAGING.SERV_DISABLE_VETERAN_BIZ_FLG PCARD_SERV_DIS_VET_BIZ_FLG,
    -    LU_PCARD_STAGING.STATE_CD PCARD_STATE_CD,
    -    LU_PCARD_STAGING.STATE_CD,
    -    LU_PCARD_STAGING.VETERAN_OWNED_BIZ_FLG PCARD_VETERAN_OWNED_BIZ_FLG,
    -    LU_PCARD_STAGING.VNDR_ACCT_NUM PCARD_VNDR_ACCT_NUM,
    -    LU_PCARD_STAGING.WOMAN_OWNED_BIZ_FLG PCARD_WOMAN_OWNED_BIZ_FLG2,
    -    DENSE_RANK() OVER (ORDER BY NVL(TO_CHAR(TRANSACTION_DATE, 'YYYYMM'),'190010') DESC) AS DATE_RANK,
    -    LU_PRICE_BY_UNIT_STAGING.MTRL_GRP PBU_MTRL_GRP,
    -    LU_PRICE_BY_UNIT_STAGING.MTRL_GRP_DES PBU_MTRL_GRP_DES,
    -    LU_PRICE_BY_UNIT_STAGING.MTRL_ID PBU_MTRL_ID,
    -    LU_PRICE_BY_UNIT_STAGING.PLANT PBU_PLANT,
    -    LU_PRICE_BY_UNIT_STAGING.PLANT_DESC PBU_PLANT_DESC,
    -    LU_PRICE_BY_UNIT_STAGING.SUPPLIER PBU_SUPPLIER,
    -    LU_PRICE_BY_UNIT_STAGING.DESCRIPTION PBU_DESCRIPTION,
    -    LU_PRICE_BY_UNIT_STAGING.UOM PBU_UOM,
    -    LU_PRICE_BY_UNIT_STAGING.CONTENT_VOLUME PBU_CONTENT_VOLUME,
    -    LU_PRICE_BY_UNIT_STAGING.UOM_CONTENT_VOLUME PBU_UOM_CONTENT_VOLUME,
    -    LU_PRICE_BY_UNIT_STAGING.CONTENT_WEIGHT PBU_CONTENT_WEIGHT,
    -    LU_PRICE_BY_UNIT_STAGING.UOM_CONTENT_WT PBU_UOM_CONTENT_WT,
    -    LU_PRICE_BY_UNIT_STAGING.PRICE__PACKAGE PBU_PRICE__PACKAGE,
    -    LU_PRICE_BY_UNIT_STAGING.PRICE_PER_UOM_WT PBU_PRICE_PER_UOM_WT,
    -    LU_PRICE_BY_UNIT_STAGING.PRICE_PER_UOM_VOL PBU_PRICE_PER_UOM_VOL,
    -    LU_PRICE_BY_UNIT_STAGING.COMMON_NAME PBU_COMMON_NAME,
    -    LU_GAC_UOM_REFERENCE_STAGING.LU_GAC_UOM_REFERENCE_ID,
    -    LU_GAC_UOM_REFERENCE_STAGING.FSL_PART_NUMBER,
    -    LU_GAC_UOM_REFERENCE_STAGING.SUPPLIER LU_GAC_SUPPLIER,
    -400 LU_GAC_UOM_REFERENCE_STAGING.DESCRIPTION LU_GAC_DESCRIPTION,
    -    LU_GAC_UOM_REFERENCE_STAGING.GAC_MAT_SUBGROUP LU_GAC_MAT_SUBGROUP ,
    -    LU_GAC_UOM_REFERENCE_STAGING.ACTUAL_FILL LU_GAC_ACTUAL_FILL,
    -    LU_GAC_UOM_REFERENCE_STAGING.COMMON__UOM LU_GAC_COMMON_UOM,
    -    LU_GAC_UOM_REFERENCE_STAGING.PACKAGE LU_GAC_PACKAGE
    -  FROM
    -    SPEND_STAGING,
    -    SUPPLIER_STAGING SS1,
    -    SUPPLIER_STAGING SS2,
    -    LU_GAC_STAGING,
    -    lu_card_code_staging,
    -    LU_PCARD_STAGING,
    -    LU_PRICE_BY_UNIT_STAGING,
    -    LU_GAC_UOM_REFERENCE_STAGING
    -  WHERE SS1.SUPPLIER_ID(+)                     = SPEND_STAGING.SUPPLIER_ID
    -  AND SS2.PCARD_INV_REF_NUM(+)             = SPEND_STAGING.PCARD_INV_REF_NUM
    -  AND SS2.PAYMENTNET_TRANSTN_NUM(+)        = SPEND_STAGING.PAYMENTNET_TRANSTN_NUM
    -  AND SS2.PAYMENTNET_TRANSTN_LN_ITM_NUM(+) =
    -    SPEND_STAGING.PAYMENTNET_TRANSTN_LN_ITM_NUM
    -  AND lu_card_code_staging.card_code(+)          = spend_staging.travel_id
    -  AND lu_gac_staging.po_short_txt(+)             = spend_staging.po_short_txt
    -  AND LU_PCARD_STAGING.PCARD_INV_REF_NUM(+)      = SPEND_STAGING.PCARD_INV_REF_NUM
    -  AND LU_PCARD_STAGING.PAYMENTNET_TRANSTN_NUM(+) =
    -    SPEND_STAGING.PAYMENTNET_TRANSTN_NUM
    -  AND LU_PCARD_STAGING.PAYMENTNET_TRANSTN_LN_ITM_NUM(+) =
    -    SPEND_STAGING.PAYMENTNET_TRANSTN_LN_ITM_NUM
    -  AND LU_PRICE_BY_UNIT_STAGING.MTRL_ID(+)             = SPEND_STAGING.MTRL_ID_1280
    -  AND LU_PRICE_BY_UNIT_STAGING.PLANT(+)               = SPEND_STAGING.PLANT_CD
    -  AND lu_gac_uom_REFERENCE_STAGING.fsl_part_number(+) =
    -431 SPEND_STAGING.MTRL_ID_1280;
    Error in the command line: 350 column: 112
    Error report:
    SQL error: ORA-01031: insufficient privileges
    01031 00000 - "insufficient privileges".
    * Cause: An attempt was made to change the user name or password
    without the privilege appropriate. This error also occurs if
    trying to install a database without the need for employment
    access privileges.
    When Trusted Oracle is configure in DBMS MAC, this error may occur
    If the user has been granted the privilege necessary for a higher label
    that the connection is active.
    * Action: Ask the database to perform the operation or grant administrator
    the required privileges.
    For users Trusted Oracle get this error, well that granted the
    the privilege that is suitable for the top label, ask the database
    administrator to grant the privilege to the appropriate label.

    Published by: Snyds on May 24, 2012 07:46

    The text associated with the error number is certainly misleading.

    It simply means that you have not had the privilege to do something.

    Is validate_number in the same pattern when you create the view? If not, what
    privileges that you have about this feature and how is it given?

  • generate the view with the union

    Hello

    I want to create a view

    CREATE VIEW ViewTest AS

    Select ID, Number, to_char (City) in the Fi

    Union

    Select 0,0, "of the double

    But I get an error message:

    shall appoint this expression with a column alias

    What is the correct syntax? I want to get all the rows in the table 'fi' one another line with id = 0.

    The select works, but the creation of the view, then I get the error message

    Best regards

    Thomas

    Hello

    First of all how you can create a Fi table because you can't use number as column name? It is not appropriate for the conventions of name of column in the oracle.after remedy

    and

    Error is very clear and it says you have to. "shall appoint this expression with a column alias.

    When you create the view, you must specify a column name for the expression in the first statement as follows

    CREATE VIEW ViewTest AS

    Select ID, No, to_char (City) city_name fi

    Union

    Select 0,0, "of the double

    Yasin

  • How to create the view in OBIEE

    I have "table 1" with columns, Attr1, Attr2, action 1, measure 2.I need to create the view in the table repository Attr1, Measure1 and new attribute with values like a flag 3 'Y' in it. ". What will be the SQL code of the new view. Please provide the exact syntax for the view.

    Thanks in advance

    Hi Hsekar,

    You are right, it is called a SELECT type.

    Regarding your second question I don't know what you mean. You are using an SQL Select statement in this area. The Alias of the columns must match the columns will place you in the RPD exactly. But in this process, you create a physical view DB object, so there is not need to name it. You just create the select statement that you would use to create a view and OBIEE refers to the statement.

    If you have found the correct answer please give points!

    Best regards

    -Joe

  • How to create a view with "WITH CLAUSE"

    Hello

    I have one query with 'BY' ARTICLE, I need to create a view of this query. But I get the error message like

    ORA-32034: Unsupported sue clause.

    Please help me...!

    Please find below my request...!

    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 );
    Concerning
    KPR

    Published by: BluShadow on March 17, 2011 09:48
    addition of {noformat}
    {noformat} tags for readability                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            

    Try to create the view on the next request, if it helps 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
         )
    ;
    

    Kind regards
    Dipali.l

  • create the view of several tables of days

    Hello
    I'll have existing oracle db with the daily stat data, tables strangely named data_mon, data_tue, data_wed... For my batch that I intend to use the view with multiple day data, let say for the last 5 days.
    Do not know how better to implement my sql with these suffixes _mon statement to make it more or less dynamic.
    I create also ever seen from several tables, then, probably, that I can do something that will add daily updated data and remove data from 5 days?

    You will appreciate comments on the details and the whole concept. I have prev sql server experience.

    Thank you
    T

    user12943718 wrote:
    Hello
    I'll have existing oracle db with the daily stat data, tables strangely named data_mon, data_tue, data_wed... For my batch that I intend to use the view with multiple day data, let say for the last 5 days.
    Do not know how better to implement my sql with these suffixes _mon statement to make it more or less dynamic.
    I create also ever seen from several tables, then, probably, that I can do something that will add daily updated data and remove data from 5 days?

    You will appreciate comments on the details and the whole concept. I have prev sql server experience.

    Thank you
    T

    Change the data model if you have 1 table for a day.

    You have just a DATA table and a column to indicate the day of the application.

    Then you don't need a view, do not need anything dynamic, do not need to break your head against a wall for a simple query... etc.

  • Syntax to create the Type of registration at the schema level.

    Hello

    Could you let me know the syntax to create the type of registration at the schema level.

    I tried to help below.

    create or replace

    TYPE "SR_TBL_TYPE" AS THE SR_REC_TYPE TABLE;

    ----------------------------------------------------------------------------------------------------------------

    create or replace

    BODY OF TYPE 'SR_REC_TYPE' AS

    CONSTRUCTOR FUNCTION SR_REC_TYPE RETURN SELF AS RESULT

    IS

    BEGIN

    task_status: = NULL; -jtf_task_statuses_tl. Name % type

    task_type: = NULL; -jtf_task_types_tl. Name % type

    jt_new_res_id: = NULL; --jtf_task_assignments_audit_b.new_resource_id%type

    jt_source_name: = NULL; --jtf_rs_resource_extns.source_name%type

    jt_sch_start_date: = NULL; -VARCHAR2 (50)

    jt_task_number: = NULL; --jtf_tasks_b.task_number%type

    jt_appointment_scheduled_agent: = NULL; --fnd_user.user_name%type

    cs_old_prblm_code: = NULL; --cs_incidents_audit_b.old_problem_code%type

    cs_problem_code: = NULL; --cs_incidents_audit_b.problem_code%type

    qa_scenario_estimate_rec: = qa_scenario_est_type();

    qa_recall_rec: = qa_recall_type();

    RETURN;

    END SR_REC_TYPE;

    PROCEDURE of MEMBER log_sr_rec_values (SELF IN SR_REC_TYPE)

    IS

    BEGIN

    NULL;

    END log_sr_rec_values;

    END;

    Thank you

    Could you let me know the syntax to create the type of registration at the schema level.

    You do not have - record types are PL/SQL. In SQL, you create OBJECT types. It works for me:

    create or replace TYPE AS OBJECT SR_REC_TYPE)
    task_status varchar2(1),--jtf_task_statuses_tl.name%TYPE
    task_type varchar2(1),--jtf_task_types_tl.name%TYPE
    jt_new_res_id varchar2(1),--jtf_task_assignments_audit_b.new_resource_id%TYPE
    jt_source_name varchar2(1),--jtf_rs_resource_extns.source_name%TYPE
    qa_scenario_estimate_rec emp_table_type,
    qa_recall_rec emp_table_type,
    CONSTRUCTOR FUNCTION SR_REC_TYPE RETURN SELF AS RESULT
    )
    /

    create or replace TYPE of BODY SR_REC_TYPE AS
    CONSTRUCTOR FUNCTION SR_REC_TYPE RETURN SELF AS A RESULT
    BEGIN
    Self.task_status: = null;


    Self.task_type: = null;
    Self.jt_new_res_id: = null;
    Self.jt_source_name: = null;
    Self.qa_scenario_estimate_rec: = emp_table_type();
    Self.qa_recall_rec: = emp_table_type();
    return;
    END;
    END;
    /

    create or replace TYPE SR_TBL_TYPE AS TABLE OF SR_REC_TYPE;

    See 'Definition and Implementing User-Defined constructors' in the object-relational doc

    http://docs.Oracle.com/CD/B28359_01/AppDev.111/b28371/adobjadv.htm#sthref751

  • Create the database with a set of characters

    Hello

    I need to create a database with the character US8PC437 (platform Linux Redhat 5.4 64-bit, database version 11.2.0.3), but this character set do not appear when I create the database with the database assistant (DBCA).

    Any help will be apreciated.


    Best regards

    Antonio Serrano

    Published by: albrotar on March 6, 2012 09:14

    While AL32UTF8 is certainly recommended for the Oracle database character set, use only, if your application provider has confirmed that their application will work with a set of characters to multibyte database.

    To create a database US8PC437 (it is rarely a choice, in fact) with DBCA 11.2, select the "character sets" tab, once shown, then select the option 'Choose from the list of character sets' and uncheck 'Show recommended only character sets '. This will add US8PC437 to the "Database character set" drop-down list. Select "US8PC437" from the list and continue the process of creation.

    But first, contact your provider and ask a compatible Unicode version of your application.

    -Sergiusz

  • syntax used to create the tablespace with autoextend

    Hello

    Thanks for giving me the syntax for creating a tablespace of 15G in size with autoextend on.
    I have 3 5 GB data files each.

    Kind regards
    VN

    Change as needed:

    CREATE TABLESPACE VN DATAFILE
      '/u01/oradata/data3.dbf' SIZE 5120M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED,
      '/u01/oradata/data2.dbf' SIZE 5120M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED,
      '/u01/oradata/data1.dbf' SIZE 5120M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED
    LOGGING
    EXTENT MANAGEMENT LOCAL AUTOALLOCATE
    BLOCKSIZE 8K
    SEGMENT SPACE MANAGEMENT AUTO
    FLASHBACK ON
    /
    

    Best regards

    mseberg

  • create a view with the double data type

    I have Windows XP with 10g 10.2.0.1.0

    I need to create a view of the double and with the type of data, such as NUMBER (5.2), NUMBER or VARCHAR2 (20).
    such as:
    create see test (view_test varchar2 (20)) as (select view_test from double)


    Help, please. Thanks in advance.

    It seems a little strange, but you can do something like this with the CAST function:

    SQL> create view dual_view as
      2  select cast(null as number(5,2)) col1
      3        ,cast(null as date)    col2
      4        ,cast(null as varchar2(30)) col3
      5  from   dual;
    
    View created.
    
    SQL> desc dual_view
     Name                                      Null?    Type
     ----------------------------------------- -------- -------------------------
     COL1                                               NUMBER(5,2)
     COL2                                               DATE
     COL3                                               VARCHAR2(30)
    

    I used the NULL values, but you can use the actual values if you wish.

  • How to create the View object with several editable entity objects

    I want the two entities in the view object to support the creation of new lines, but when I give create insert that it allows to insert only on the parent and not the child. I found this link
    http://docs.Oracle.com/CD/E21043_01/Web.1111/b31974/bcadvvo.htm#CEGCAJCI which replaces the outgoing class. but I would like to do declarative. Is there another way to do it?

    I use Jdeveloper 11g 2 version.

    Thanks in advance,
    Rakesh

    Hello
    There is a checkbox in the tab "Updatable" entity objects, mark it checked and look in your vo
    Then, you can create the ViewObject also editable attribute
    Make sure that the Association is here.

    Rognard

Maybe you are looking for

  • Satellite Pro L300-128 and battery life

    Hello I checked the specifications of this laptop but cannot find the medium-term on a full battery.Although this would depend on its use, but what about the generalization? Say, surfing the web, by email or word processing? Does anyone know this inf

  • How can I add a port to the programs allowed through firewall?

    I'm setting up a fax program to receive faxes on your computer. State of instructions I put the firewall to allow the use of PC-Fax-Rx and add port 54926 for network PC-Fax-Rx with a UDP protocol Moved from feedbackNo specific OS

  • HP2000 369wm: connected replacement screen, the screen remains black.

    Hi I'm new here, I tried to find the solution here, but I can't find what I'm looking for but anyway... My laptop had a broken screen so I used an external monitor via the vga input. One day I was messing around on the web and I got a virus that para

  • On the status report, which is a global state?

    Our "condition" has been designated as a global status, but he was not on the list of status report.  We changed it to a status not aggregated, and he seemed fine.

  • For OAM WebGate

    I installed 11.1.2 for 11.1.2 OAM Webgate and ran into a problem. I uninstalled and reinstalled(webgate/webcache).I use this doc-installation and configuration of server of HTTP in Oracle 11 g WebGate in OAM-11 g Release 2 (11.1.2.2.0)and in this sec