Trouble Creating Views

I'm not sure if this is a SQL Developer issue or a SQL issue, so if I'm in the wrong place, someone please let me know.
Using SQL Developer 1.5.0.53, I'm trying to create a view. I've written my SQL for the view and I can run it in a SQL worksheet and it works just like I expect. So I go to my "Views" folder, right click and choose "New View" and enter the exact same SQL (without a semicolon at the end) that works in the SQL worksheet into the "SQL Query" window of the "Create View" dialog box. Then when I press the "Test Syntax" button I get the following error message
     The SQL syntax is valid, however the query is invalid or uses functionality that is not supported.
This error sort of ticks me off, so I go to the SQL Worksheet and do a
     CREATE OR REPLACE FORCE VIEW… bla bla bla
And it creates my view, and it seems to work just like I expect it to. Does anyone have any ideas why I can manually create this view in a SQL worksheet, but not through the "New View" dialog box?
Below is the exact SQL I use to create my view
SELECT
"HS_FPR_ACCOUNT_T"."PARENT" "PARENT",
"HS_FPR_ACCOUNT_T"."CHILD" "CHILD",
"HS_FPR_ACCOUNT_T"."CHILD_ALIAS" "CHILD_ALIAS",
"HS_FPR_ACCOUNT_T"."CHILD_STORAGE" "CHILD_STORAGE",
"HS_FPR_ACCOUNT_T"."CHILD_AGG" "CHILD_AGG",
"HS_FPR_ACCOUNT_T"."VAR_REPORTING" "VAR_REPORTING",
"HS_FPR_ACCOUNT_T"."TIME_BALANCE" "TIME_BALANCE",
"HS_ACCOUNT_MEMBER_V"."MEMBERFORMULA" "MEMBERFORMULA",
level "PARENT_GEN"
FROM
"HS_FPR_ACCOUNT_T" "HS_FPR_ACCOUNT_T" left outer join "HS_ACCOUNT_MEMBER_V"
on "HS_FPR_ACCOUNT_T"."CHILD" = "HS_ACCOUNT_MEMBER_V"."NAME"
start with PARENT = 'Account'
connect by prior CHILD= PARENT
order by level,
decode(CHILD, 'ZZZZZZ', '0',
'COP', '1',
'ZZZZ'),
CHILD
and it gives me this error:
The SQL syntax is valid, however the query is invalid or uses functionality that is not supported.
Cannot find relation "HS_ACCOUNT_MEMBER_V".
Any insight anyone might have on this would be appreciated.
Thanks

I had this same problem.
You have a corrupted file somewhere in this directory:
C:\Documents and Settings\<your_user_name>\Application Data\SQL Developer
Before you read further, recognize that this may be the default directory where sql developer will put your sql files, so make sure you don't harm those! Plus, you will lose your preferences and database connections, so make sure you know how to set them up again before you continue. Backups of this directory would be wise. :)
I solved this problem (and a host of others, by the way), by deleting this directory (after backing up my sql files elsewhere) and running sql developer again.
Of course, I lost all the preference settings, database connections, etc., so I had to type those in again.
I believe it happened by importing a set of preferences built on another machine, but I haven't had time to go back and prove that.

Similar Messages

  • Trouble Creating View on External Table in Diff Schema

    I am unable to create a view in a different schema on an external table in a different schema, even when I am connected to my database as SYS as SYSDBA.
    CREATE VIEW WH1.EXT1VIEW AS SELECT * FROM WH1.EXT1VIEW;
    returns the error:
    ORA-06564: object ER_ADMIN_DIR does not exist
    I created a directory:
    CREATE DIRECTORY ER_ADMIN_DIR AS 'C:\ER_Init';
    Granted privs:
    grant read,write on directory ER_ADMIN_DIR to public;
    Created the external table EXT1 in a different schema WH1:
    CREATE TABLE WH1.EXT1 (TABLE_NAME VARCHAR2(100), COLUMN_NAME VARCHAR2(100))
    ORGANIZATION EXTERNAL (TYPE ORACLE_LOADER DEFAULT DIRECTORY SYS.ER_ADMIN_DIR
    ACCESS PARAMETERS
    (RECORDS DELIMITED BY NEWLINE
    FIELDS TERMINATED BY ','
    MISSING FIELD VALUES ARE NULL
    LOCATION ('FILE1.TXT')
    REJECT LIMIT UNLIMITED;
    I can query from the table successfully connected as SYS:
    SQL> select count(*) from wh1.ext1;
    1008
    1 row selected.
    However when I try to create a view on that table connected as SYS:
    CREATE VIEW WH1.EXT1VIEW AS SELECT * FROM WH1.EXT1VIEW;
    I get the following error:
    ORA-06564: object ER_ADMIN_DIR does not exist
    I can connect over to the WH1 schema and create the view successfully, however due to a specific situation I need to be able to create the view from the SYS schema. I can create the view FORCE and it creates with compilation errors, however the view cannot be compiled successfully from SYS.
    Is there a known bug on creating views on external tables remotely?
    Thanks for any help!
    Tina

    I have been able to reproduce your error, using scott instead of sys, and resolve it, as demonstrated below. The combination that I found that worked consisted of having wh1 grant select on ext1 to scott explicitly and using set current_schema to wh1, so that ext1view did not require the wh1 qualifier.
    scott@ORA92> CREATE USER wh1 IDENTIFIED BY wh1
      2  /
    User created.
    scott@ORA92> GRANT CONNECT, RESOURCE TO wh1
      2  /
    Grant succeeded.
    scott@ORA92> CREATE OR REPLACE DIRECTORY er_admin_dir AS 'c:\er_init'
      2  /
    Directory created.
    scott@ORA92> CREATE TABLE wh1.ext1
      2    (table_name  VARCHAR2(100),
      3       column_name VARCHAR2(100))
      4  ORGANIZATION EXTERNAL
      5    (TYPE ORACLE_LOADER
      6       DEFAULT DIRECTORY er_admin_dir
      7       ACCESS PARAMETERS
      8         (RECORDS DELIMITED BY NEWLINE
      9          FIELDS TERMINATED BY ','
    10          MISSING FIELD VALUES ARE NULL)
    11       LOCATION ('file1.txt'))
    12  REJECT LIMIT UNLIMITED
    13  /
    Table created.
    scott@ORA92> CREATE OR REPLACE VIEW wh1.ext1view AS SELECT * FROM wh1.ext1
      2  /
    CREATE OR REPLACE VIEW wh1.ext1view AS SELECT * FROM wh1.ext1
    ERROR at line 1:
    ORA-06564: object ER_ADMIN_DIR does not exist
    scott@ORA92> CONNECT wh1/wh1
    Connected.
    scott@ORA92> @ LOGIN
    scott@ORA92> SET ECHO OFF
    GLOBAL_NAME
    [email protected]2
    wh1@ORA92> GRANT SELECT ON ext1 TO scott
      2  /
    Grant succeeded.
    wh1@ORA92> CONNECT scott/tiger
    Connected.
    wh1@ORA92> @ LOGIN
    wh1@ORA92> SET ECHO OFF
    GLOBAL_NAME
    [email protected]A92
    scott@ORA92> ALTER SESSION SET CURRENT_SCHEMA = wh1
      2  /
    Session altered.
    scott@ORA92> CREATE OR REPLACE VIEW ext1view AS SELECT * FROM wh1.ext1
      2  /
    View created.
    scott@ORA92> ALTER SESSION SET CURRENT_SCHEMA = scott
      2  /
    Session altered.
    scott@ORA92> SELECT * FROM wh1.ext1view
      2  /
    TABLE_NAME
    ---------------------------------------------------------COLUMN_NAME
    ---------------------------------------------------------tab1
    col1
    tab2
    col2
    scott@ORA92>

  • Trouble Creating View Using Derived Values From With

    I want to use the two values derived from the sql statements in my WITH to use in a view. This is my code:
    WITH a AS(
    SELECT
    CASE
    WHEN (SELECT stvterm_code
    FROM stvterm
    WHERE sysdate >= stvterm_start_date
    AND sysdate <= stvterm_end_date) IS NOT NULL
    THEN (SELECT stvterm_code
    FROM stvterm
    WHERE sysdate >= stvterm_start_date
    AND sysdate <= stvterm_end_date)
    ELSE
    (SELECT min(stvterm_code)
    FROM stvterm
    WHERE stvterm_start_date > sysdate)
    END cur_term
    FROM dual),
    b AS (
    SELECT
    CASE
    WHEN (SELECT substr(cur_term,5, 2) FROM a) = '60' OR (SELECT substr(cur_term,5, 2) FROM a) = '40'
    THEN (SELECT substr(cur_term,0, 4)||'20' FROM a)
    WHEN (SELECT substr(cur_term,5, 2) FROM a) = '20'
    THEN (SELECT to_char(to_number(cur_term)-100) FROM a)
    END endof_prior_aidy_term
    FROM dual
    CREATE OR REPLACE VIEW jbartling.current_term AS
    SELECT cur_term, endof_prior_aidy_term
    FROM a,bHowever, I get the error ORA-00928: missing SELECT keyword. Is it possible to use WITH like this in creating a view? If not can someone show me another way to accomplish what I'm trying to do?

    Hi,
    You need to put the CREATE at top, i.e
    CREATE OR REPLACE VIEW jbartling.current_term AS
    WITH a
    SELECT ..  FROM a,bRegards
    Peter

  • To create View for the following req

    Hi Gurus
    Table view is to be generated for tables ZFUNCTION, ZPFUNCTION, and ZLOCATION.
    Assignment of T Code to this table so that SSC team can update as and when there is change in business requirement.
    Pls suggest me to create view for the above req and to assigning T code for the same.
    Regards
    Suresh

    I seem to recall (don't have the docs handy) that there is a higher level
    PDDest object and a PDAction object - you might want to look at using those
    higher level objects (created via PDXXXFromCosObj) if you are having trouble
    working with Cos.
    Leonard

  • Problem with embeding the same view in dynamically created view container

    Hello Experts,
                  I am getiing a dump when i try to embed the same view inside the dynamically created view container of
    dynamically created tabs of a tabstrip
    The requirement go like this, i have 2 views in which i have have to embed the 2nd view to view1 where i have an empty
    tabstrip without tabs. During runtime i create tabs as well as view containers accordingly and then try to embed view2 in tabs.
    I have put the below mentioned code in HANDLEIN,
      DATA: lref_vcntlr  TYPE REF TO if_wd_view_controller,
            lref_comp    TYPE REF TO if_wd_component_usage,
            lv_embed_pos TYPE string.
      lref_vcntlr = wd_this->wd_get_api( ).
      lv_embed_pos = 'FILE_PERS_EDIT/VC_GENERAL'.
      TRY.
          CALL METHOD lref_vcntlr->do_dynamic_navigation
            EXPORTING
              source_window_name        = 'FILE_PERSISTENCE_WND'          " Window
              source_vusage_name        = 'FILE_PERS_EDIT_USAGE_1'       " Source View usage
              source_plug_name          = 'TO_EDIT_LAYOUT'                       " Outbound plug
              target_view_name          = 'PERS_EDIT_LAYOUT'                  " Second view to be embedded
              target_plug_name          = 'IN'                                                  " Second view inboun plug
              target_embedding_position = lv_embed_pos
            RECEIVING
              component_usage           = lref_comp.
        CATCH cx_wd_runtime_repository .
      ENDTRY.
      wd_this->fire_to_edit_layout_plg( ).
    This works fine for the first time.
    However onaction tab select i change the embeding position( 'FILE_PERS_EDIT/view container name of different tab') of the view2 an try to embed view2 in a different tab.
    At this point i get a dump stating View2 already present in the window 'FILE_PERSISTENCE_WND' of component.
    I think, the view2 embediing has to be removed before i add the view2 in a different tab
    Kindly let me know how to remove view2 embedding from tab1 before i add a view2 to a different tab or is there any other
    means to handle this problem?
    Thanks & Best Regards,
    Srini.

    Hello Srini,
    I found a solution to your problem, because I had a similar task.
    In WDDOINIT I changed the method do_dynamic_navigation to if_wd_navigation_services_new~prepare_dynamic_navigation:
    DATA:
        l_view_controller_api TYPE REF TO if_wd_view_controller.
      l_view_controller_api = wd_this->wd_get_api( ).
      TRY.
          CALL METHOD l_view_controller_api->if_wd_navigation_services_new~prepare_dynamic_navigation
            EXPORTING
              source_window_name        = 'WDW_MAIN'
              source_vusage_name        = 'VW_SUB_USAGE_1'
              source_plug_name          = 'TO_VW_CONTENT'
              target_component_name     = 'ZTEST_DYNAMIC'
              target_view_name          = 'VW_CONTENT'
              target_plug_name          = 'DEFAULT'
              target_embedding_position = 'VW_MAIN/VC_TAB.VW_SUB/TAB1_VC'
            RECEIVING
              repository_handle         = wd_this->g_rep_handle.
        CATCH cx_wd_runtime_repository .
      ENDTRY.
      wd_this->fire_to_vw_content_plg( param1 = 'TAB1' ).
    In the action I first deleted the navigation targets, then navigated to the empty-view and last I called my target view:
      DATA:
        lv_position           TYPE string,
        l_view_controller_api TYPE REF TO if_wd_view_controller,
        lr_view_usage         TYPE REF TO if_wd_rr_view_usage,
        lr_view_***_t         TYPE wdrr_vca_objects,
        lr_view_***           LIKE LINE OF lr_view_***_t.
      l_view_controller_api = wd_this->wd_get_api( ).
      lr_view_usage = wd_this->g_view->get_view_usage( ).
      lr_view_usage->delete_all_navigation_targets( plug_name = 'TO_VW_CONTENT' ).
      CLEAR lv_position.
      CONCATENATE 'VW_MAIN/VC_TAB.VW_SUB/' old_tab '_VC' INTO lv_position.
      TRY.
          l_view_controller_api->if_wd_navigation_services_new~do_dynamic_navigation(
          source_window_name = 'WDW_MAIN'
          source_vusage_name = 'VW_SUB_USAGE_1'
          source_plug_name   = 'TO_EMPTYVIEW'
          target_component_name = 'ZTEST_DYNAMIC'
          target_view_name   = 'EMPTYVIEW'
          target_plug_name   = 'DEFAULT'
          target_embedding_position = lv_position ).
        CATCH cx_wd_runtime_repository.
      ENDTRY.
      CLEAR lv_position.
      CONCATENATE 'VW_MAIN/VC_TAB.VW_SUB/' tab '_VC' INTO lv_position.
      TRY.
          wd_this->g_rep_handle = l_view_controller_api->if_wd_navigation_services_new~prepare_dynamic_navigation(
            source_window_name = 'WDW_MAIN'
            source_vusage_name = 'VW_SUB_USAGE_1'
            source_plug_name   = 'TO_VW_CONTENT'
            target_component_name = 'ZTEST_DYNAMIC'
            target_view_name   = 'VW_CONTENT'
            target_plug_name   = 'DEFAULT'
            target_embedding_position = lv_position ).
        CATCH cx_wd_runtime_repository.
      ENDTRY.
      wd_this->fire_to_vw_content_plg( param1 = tab ).
    Ann.: I my example, I had 3 views: VW_MAIN which embedds VW_SUB. VW_SUB has the tabs in it and VW_SUB embedds VW_CONTENT.
    BR,
    Roland

  • Create view and alter Session gets 0RA-01031

    I can't create a view after using ALTER SESSION set current_schema without using an explicit schema. I get ORA-01031. Is this a known bug? Here are the details:
    1. Log on as SYSTEM
    2. ALTER SESSION set current_schema=FRED;
    3. CREATE VIEW vFoo as select * from Foo;     -- ORA-01031: insufficient privileges
    4. CREATE VIEW FRED.vFoo as select * from Foo;     -- this works!
    I've read where some privileges need to be granted directly. In fact, if Fred grants select privilege on Foo to SYSTEM, the statement in #3 above works. However, something doesn't seem right because why does #4 succeed without the GRANT?
    In case you're wondering why I don't just use #4 above, which does work, it's because I've got a script that will be run by customers to create tables, views, etc. in an arbitrary schema and the schema is associated with a user with limited permissions. Hence, the use of the ALTER SESSION.

    See, You looged as SYSTEM (Scheme = SYSTEM)
    Now you alter your session to another schema FRED.
    Now if you want to access SCHEMA of FRED, You need to connect first.
    SQL > connect user/password@host
    Then
    SQL > CREATE VIEW vFoo as select * from Foo;
    View created.

  • In generic extration how to create view

    HI
    In se11 i try to create view using two table vbap and vbak .
    vbak            mandt                          vbap                     mandt
    vbak             vbeln                           vbap                     vbeln        for join condion
    and also i fill view field tab but the view is no cretated. It give error field name MANDT is not unique. please anyoone clar the error.
    By
    Rajan

    Hi Rajan,
    You cannot use one field twice in a View.
    If you need the Field "MANDT" from both the tables, change the description as MANDT_VBAK & MANDT_VDAT in View Field column & select it from the respective tables in "Table column".
    Hope it helps!
    Regards,
    Pavan

  • How to CREATE VIEW to merge two tables each of which has CLOB-typed column

    I failed in creating a view to merge two tables that have CLOB-type column each.
    The details are:
    Database: Oracle 9i (9.2.0)
    Two tables "test" and "test_bak", each of which has the following structure:
    ID Number(10, 0)
    DUMMY VARCHAR2(20)
    DUMMYCLOB CLOB
    The following operation fails:
    create view dummyview (id, dummy, dummyclob) as
    select id, dummy, dummyclob from test
    union
    select id, dummy, dummyclob from test_bak;
    I was announced:
    select test.id, test.dummy, test.dummyclob
    ERROR in line 2:
    ORA-00932: inconsistent data type: required - , but CLOB presented.
    But if creating views from only ONE table with CLOB-type columns, or from two tables WITHOUT CLOB-typed columns, the creation will succeed. The following 1) and 2) will succeed, both:
    1) one table, with CLOB-typed column
    create view dummyview (id, dummy, dummyclob) as
    select id, dummy, dummyclob from test;
    2) two tables, without CLOB-typed columns
    create view dummyview (id, dummy) as
    select id, dummy from test
    union
    select id, dummy from test_bak;
    I want to merge the two tables all, with complete columns, how to write the CREATE VIEW SQL statement?
    many thanks in advance

    Dong Wenyu,
    No.
    But you could do this:
    SELECT source.*, nvl (tab1.clob_column, tab2.clob_column)
    FROM your_table1 tab1, your_table2 tab2, (
    SELECT primary_key, ...
    FROM your_table1
    UNION
    SELECT primary_key, ...
    FROM your_table2
    ) source
    WHERE source.primary_key = tab1.id (+)
    AND source.primary_key = tab2.id (+)
    In other words, do the set operation (UNION (ALL)/INTERSECT/MINUS) on just the PK columns before pulling in the LOB columns.
    d.

  • Error while creating view

     Hello,
    I am trying to create view which is based on multiple source tables and I am receiving following error 
    Internal error: An expression services limit has been reached. Please look for potentially complex expressions in your query, and try to simplify them.
    Can anyone know how to resolve this.
    Thanks,

    See MS Support for how to solve it:
    Error message when you run a query in SQL Server 2005: "Internal error: An expression services limit has been reached"
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

  • Error while creating view in component - BT115H_SLSO

    Hi All,
    When I am creating view in the BSP Component workbench(T/code: BSP_WD_CMPWB), I
    am getting the error "Invalid GUI INPUT DATA :INVALID XMLBLOB DATA" shot and suggest me how to come out of this error.
    Component: BT115H_SLSO
    Regards,
    Praveen

    Hello,
    The problem could be a SAPGUI related problem... Whats the current sapgui patch level ? Does it work when you try on another wokstation with the same user ?
    Could you please use SAPGUI 720 and update your patch level to 7 ? Then check the behaviour again.
    Best regards
    Rene

  • Non-sense error message trying to create view

    Greetings All,
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production on Windows 2008R2
    I am getting an error while trying to create a view. The error makes no sense in that no attempt to change a user name or password as the error message being produced suggests.
    I can execute the entire select statement fine, I get results back.
    If I comment out the line indicated as being in error, the problem moves to the line prior to the one commented out. The 4 lines prior to the line indicated by the error message are similar. The error is occurring on the last of the 5 similar lines of code.
    If I move all 5 lines further up in the code the error moves accordingly.
    The function validate_number (near where the error is identified) under certain conditions will issue a execute immediate 'alter session set nls_numeric_characters = ''.,''';
    The column number identified in the error message is 2 spaces prior to the validate_number function call.
    Below is the syntax for the creation of the view, the error message is at the bottom.
    The numbers to 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-spaces in front of the VALIDATE_NUMBER function call on line 350. just before the sql code ==> 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 at 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 current username or password
    without the appropriate privilege. This error also occurs if
    attempting to install a database without the necessary operating
    system privileges.
    When Trusted Oracle is configure in DBMS MAC, this error may occur
    if the user was granted the necessary privilege at a higher label
    than the current login.
    *Action:   Ask the database administrator to perform the operation or grant
    the required privileges.
    For Trusted Oracle users getting this error although granted the
    the appropriate privilege at a higher label, ask the database
    administrator to regrant the privilege at the appropriate label.
    Edited by: Snyds on May 24, 2012 7:46 AM

    Checking for privileges was the first thing I did.
    User has create view and create any view.
    Also has alter session privilege which is needed within the validate_number function (see below).
    I was able to create the view you suggested.
    I believe there is a privilege problem, just cant figure which.
    create or replace function validate_number(p_number      in varchar2,
                                               p_format_mask in varchar2)
    return number
    AUTHID CURRENT_USER is
      v_number number;
      v_mask   varchar2(100) := '999999999999999999999.00000000000000000000';
      cursor get_number_masks is
      select mask,upper(is_i18n) is_i18n from cm_master.format_mask
      where type = 'NUMBER' order by sequence, is_i18n; 
    begin
      if p_format_mask is not null then
        begin
          return to_number(p_number, p_format_mask);   
        exception
          when others then null;
        end;
      end if;
      for a in get_number_masks
      loop
        if a.is_i18n = 'Y' then
          -- We are applying an international number format mask
          begin
            -- Attempt #1
            -- Set the decimal to a ',' and the group separator to a '.'
            execute immediate 'alter session set nls_numeric_characters = '',.''';
            v_number := to_number(ltrim(rtrim(to_char(to_number(p_number, a.mask),v_mask))),v_mask);
            execute immediate 'alter session set nls_numeric_characters = ''.,''';
            return v_number;
          exception
            when others then
              -- First Attempt Failed - Attempt #2
              -- Set the decimal to a ',' and the group separator to a ' '
              begin
                execute immediate 'alter session set nls_numeric_characters = '', ''';
                v_number := to_number(ltrim(rtrim(to_char(to_number(p_number, a.mask),v_mask))),v_mask);
                execute immediate 'alter session set nls_numeric_characters = ''.,''';
                return v_number;
              exception
                when others then
                  -- Second Attempt Failed - Attempt #3
                  -- Set the decimal to a '.' and the group separator to a ' '
                  begin
                    execute immediate 'alter session set nls_numeric_characters = ''. ''';
                    v_number := to_number(ltrim(rtrim(to_char(to_number(p_number, a.mask),v_mask))),v_mask);
                    execute immediate 'alter session set nls_numeric_characters = ''.,''';
                    return v_number;
                  exception
                    when others then null;
                  end;
              end;
          end;
        else
          begin
            return to_number(p_number, a.mask);
          exception
            when others then null;
          end;
        end if;
      end loop;
      return null;
    exception
      when others then return null;
    end validate_number;Edited by: Snyds on May 24, 2012 7:48 AM

  • What is the use for CREATING VIEW WITH CHECK OPTION?

    Dear Legends,
    I have a doubt
    What is the use for creating view?
    A: First Data Integrity, Selecting Particular Columns..
    What is the use for creating a view with check option?
    A: As per oracle manual I read that its a referential integrity check through views.
    A: Enforcing constraints at DB level.
    A: using CHECK OPTION we can do INSERTS UPDATES for a view for those columns who have no constraints... is it right??
    A: If we do a INSERT OR UPDATE for columns who have constraints it will show error... is it right???
    Please clear my doubt's Legends
    Lots of Thanks....
    Regards,
    Karthik

    Hi, Karthick,
    karthiksingh_dba wrote:
    ... What is the use for creating view?
    A: First Data Integrity, Selecting Particular Columns..Most views are created and used for convenience. A view is a saved query. If the same operations are often done, then it can be very convenient to code those operations once, in a view, and refer to the view rather than explicitly doing those operations.
    Sometimes, views are created and used for security reasons. For example, you many want to allow some users to see only certain rows or certain columns of a table.
    Views are necessary for INSTEAD OF triggers.
    What is the use for creating a view with check option?
    A: As per oracle manual I read that its a referential integrity check through views.The reason is integrity, not necessarily referential integrity. The CHECK option applies only when DML is done through the view. It prohibits certain changes. For example, if a user can't see certain rows through a view, the CHECK option keeps the user from creating such rows.
    A: Enforcing constraints at DB level.I'm not sure what you mean. Please give an example.
    A: using CHECK OPTION we can do INSERTS UPDATES for a view for those columns who have no constraints... is it right??No. Using CHECK OPTION, you can do some inserts and updates, but not others. The columns involved may or may not have constraints in either case.
    A: If we do a INSERT OR UPDATE for columns who have constraints it will show error... is it right???If you try to violate a constraint, you'll get an error. That happens in views with or without the CHECK OPTION, and also in tables.

  • Creating View for a table with parent child relation in table

    I need help creating a view. It is on a base table which is a metadata table.It is usinf parent child relationship. There are four types of objects, Job, Workflow, Dataflow and ABAP dataflow. Job would be the root parent everytime. I have saved all the jobs
    of the project in another table TABLE_JOB with column name JOB_NAME. Query should iteratively start from the job and search all the child nodes and then display all child with the job name. Attached are the images of base table data and expected view data
    and also the excel sheet with data.Picture 1 is the sample data in base table. Picture 2 is data in the view.
    Base Table
    PARENT_OBJ
    PAREBT_OBJ_TYPE
    DESCEN_OBJ
    DESCEN_OBJ_TYPE
    JOB_A
    JOB
    WF_1
    WORKFLOW
    JOB_A
    JOB
    DF_1
    DATAFLOW
    WF_1
    WORKFLOW
    DF_2
    DATAFLOW
    DF_1
    DATAFLOW
    ADF_1
    ADF
    JOB_B
    JOB
    WF_2
    WORKFLOW
    JOB_B
    JOB
    WF_3
    WORKFLOW
    WF_2
    WORKFLOW
    DF_3
    DATAFLOW
    WF_3
    WORKFLOW
    DF_4
    DATAFLOW
    DF_4
    DATAFLOW
    ADF_2
    ADF
    View
    Job_Name
    Flow_Name
    Flow_Type
    Job_A
    WF_1
    WORKFLOW
    Job_A
    DF_1
    DATAFLOW
    Job_A
    DF_2
    DATAFLOW
    Job_A
    ADF_1
    ADF
    Job_B
    WF_2
    WORKFLOW
    Job_B
    WF_3
    WORKFLOW
    Job_B
    DF_3
    DATAFLOW
    Job_B
    DF_4
    DATAFLOW
    Job_B
    ADF_2
    ADF
    I implemented the same in oracle using CONNECT_BY_ROOT and START WITH.
    Regards,
    Megha

    I think what you need is recursive CTE
    Consider your table below
    create table basetable
    (PARENT_OBJ varchar(10),
    PAREBT_OBJ_TYPE varchar(10),
    DESCEN_OBJ varchar(10),DESCEN_OBJ_TYPE varchar(10))
    INSERT basetable(PARENT_OBJ,PAREBT_OBJ_TYPE,DESCEN_OBJ,DESCEN_OBJ_TYPE)
    VALUES('JOB_A','JOB','WF_1','WORKFLOW'),
    ('JOB_A','JOB','DF_1','DATAFLOW'),
    ('WF_1','WORKFLOW','DF_2','DATAFLOW'),
    ('DF_1','DATAFLOW','ADF_1','ADF'),
    ('JOB_B','JOB','WF_2','WORKFLOW'),
    ('JOB_B','JOB','WF_3','WORKFLOW'),
    ('WF_2','WORKFLOW','DF_3','DATAFLOW'),
    ('WF_3','WORKFLOW','DF_4','DATAFLOW'),
    ('DF_4','DATAFLOW','ADF_2','ADF')
    ie first create a UDF like below to get hierarchy recursively
    CREATE FUNCTION GetHierarchy
    @Object varchar(10)
    RETURNS @RESULTS table
    PARENT_OBJ varchar(10),
    DESCEN_OBJ varchar(10),
    DESCEN_OBJ_TYPE varchar(10)
    AS
    BEGIN
    ;With CTE
    AS
    SELECT PARENT_OBJ,DESCEN_OBJ,DESCEN_OBJ_TYPE
    FROM basetable
    WHERE PARENT_OBJ = @Object
    UNION ALL
    SELECT b.PARENT_OBJ,b.DESCEN_OBJ,b.DESCEN_OBJ_TYPE
    FROM CTE c
    JOIN basetable b
    ON b.PARENT_OBJ = c.DESCEN_OBJ
    INSERT @RESULTS
    SELECT @Object,DESCEN_OBJ,DESCEN_OBJ_TYPE
    FROM CTE
    OPTION (MAXRECURSION 0)
    RETURN
    END
    Then you can invoke it as below
    SELECT * FROM dbo.GetHierarchy('JOB_A')
    Now you need to use this for every parent obj (start obj) in view 
    for that create view as below
    CREATE VIEW vw_Table
    AS
    SELECT f.*
    FROM (SELECT DISTINCT PARENT_OBJ FROM basetable r
    WHERE NOT EXISTS (SELECT 1
    FROM basetable WHERE DESCEN_OBJ = r.PARENT_OBJ)
    )b
    CROSS APPLY dbo.GetHierarchy(b.PARENT_OBJ) f
    GO
    This will make sure it will give full hieraracy for each start object
    Now just call view as below and see the output
    SELECT * FROM vw_table
    Output
    PARENT_OBJ DESCEN_OBJ DESCEN_OBJ_TYPE
    JOB_A WF_1 WORKFLOW
    JOB_A DF_1 DATAFLOW
    JOB_A ADF_1 ADF
    JOB_A DF_2 DATAFLOW
    JOB_B WF_2 WORKFLOW
    JOB_B WF_3 WORKFLOW
    JOB_B DF_4 DATAFLOW
    JOB_B ADF_2 ADF
    JOB_B DF_3 DATAFLOW
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • I have trouble creating a pdf portfolio from Outlook: the result does not have "From" or "Subject"

    I have trouble creating a pdf portfolio from Outlook: it creates the portfolio, but the result does not have "From" or "Subject" in the index.  Please help!

    Thank you, I am aware of this function.  The fields are present, but blank.  (It seems that the data is not getting exported…)
    Please keep trying to help me!
    -Nancie

  • Create view link programatically

    Hi all,
    I am working on this weird requirement.
    Basically, I have to create a detail table on a search resullt table. The search result is seeded search, for Item Advance search in Oracle PIM module which is not based upon a VO. The search result table is dynamically built at run time in the EgoItemSearchHelper class and that's where they build the search result VO (EgoItemSearchResultsVO).
    Now, I need to access this VO in the controller class, and create a view link programatically between details table VO and this VO. The problem is since I do not have Impl class for the EgoItemSearchResultsVO, how do I accees the column that is the key attribute. Second I do not know how to create view link between the two VOs programatically.
    Please help it's urgent.
    Thanks

    Pratap, My problem is the seeded VO is in seeded AM and my details VO will be in my custom AM, I don't know if we can have a view link between View objects that are in different AMs.
    To bypass that problem, I tried to create a VO in the seeded AM programatically and then created a view link. Now since the AM is seeded, and I am adding my details VO to this AM programatically, I thought of creating a table also programatically on the detais VO.
    In the end it does not work, I end up getting a show button on the main table, but when I click I get an error (Cannot find <null> attribute in the EOGITEMSEARCHRESULTVO) which is the seeded VO class. Unfortunately there is no boolean variable on the dynamic seeded VO, so don't know what to put in oatablebean.setDetailViewAttributeName("") method;
    Any clues on this, appreciate all responses from the forum gurus.
    ViewObject voEmp = oaapplicationmodule.createViewObject("MyEmp", "xxuss.oracle.apps.ego.item.eu.server.DetailsOrderLinesVO");
    ViewObject voEmp = am.createViewObject("MyEmp", "xxuss.oracle.apps.ego.item.eu.server.DetailsOrderLinesVO");
    AttributeDef[] prjLinkAttrs = new AttributeDef[]{oaapplicationmodule.findViewObject("EgoItemSearchResultsVO").findAttributeDef("INVENTORY_ITEM_ID_B")};
    System.out.println("definition for attr = "+ prjLinkAttrs[0]);
    AttributeDef[] taskLinkAttrs = new AttributeDef[]{voEmp.findAttributeDef("InvId") };
    ViewLink vl = am.createViewLinkBetweenViewObjects("MyLink3",
    "DetailInv", // accessor name--more on this below
    am.findViewObject("EgoItemSearchResultsVO"), // master
    prjLinkAttrs, // department attributes
    voEmp, // detail
    taskLinkAttrs, // employee attributes
    null); // assoc clause
    System.out.println("view link =" + vl.getName());
    OATableBean tb = (OATableBean)createWebBean(oapagecontext,TABLE_BEAN,null,"table");
    tb.setViewUsageName("MyEmp");
    OAMessageStyledTextBean beans = (OAMessageStyledTextBean)createWebBean(oapagecontext,MESSAGE_STYLED_TEXT_BEAN,OAWebBeanConstants.VARCHAR2_DATATYPE,"number");
    beans.setPrompt("column1");
    beans.setViewUsageName("MyEmp");
    beans.setViewAttributeName("InvId");
    tb.addIndexedChild(beans);
    oatablebean.setDetail((OAWebBean)tb);
    oatablebean.setDetailViewAttributeName("SelectFlag"); // I just tried this, SelectFlag is not a boolean attribute though, is there a way to create a boolean attribute programatically for seeded VO EGOITEMSEARCHRESULTVO and set it here, will it help
    oatablebean.setAllDetailsEnabled(true);

Maybe you are looking for

  • Adobe AIR and MS Sharepoint

    I am developing an AIR application which needs to cache files locally from a webserver, to do this I use the filestream object. This is working fine from any server anywhere. I now need to get files from a Sharepoint server which requires Authenticat

  • CPU Load function CVI

    Is there a function for CVI for getting the CPU load and memory usage from a Real Time Controller?

  • What is the diffrece in KNA1 table name (tech. name:NAME1  and MCOD1)

    Hi SAP Guru's,i m confusing of the in customer table KNA1 of maintain the two names,in customer master point of wher to maintain the the two fields NAME1&MCOD1

  • Error creating database users

    Hi, I have written a process in my application to create database uses. It's nothing complicated, all it does is BEGIN EXECUTE IMMEDIATE 'CREATE USER '||:P16_USERNAME||' IDENTIFIED BY '||:P16_PASSWORD; END; However, when I run this process I get an "

  • Email and WIFI problems

    I am very frustrated in that I cannot send or reply to emails only receive. What  am I doing wrong? also WiFi keeps disconnecting.