Help needed in query for Materialized View
Hi,
I want to create a materialized view which has some precalcultaed values.
I have four dimension tables out of which one is a Time Dimension table with levels as Year->Quarter->Month.
The precalculations are the moving averages and cummulative values of Sales Amt on the dimension values over a period of 4 Months.
The dimension tables are Clients, Products, Channel, Time.
Fact Table is Sales_Fact which will have the sales amount for different members of the dimension.
Since my fact table is very huge, i want to create a materialized view where i could store the required calculated measures, here Moving Average of Sales Amt for each Client, Product, Channel dimensions over a period of 4 Months.
Can anybody help with writing the query for this..Any help in this regard will be appreciated..
Please give me suggestions for this..
Check this link.
http://download.oracle.com/docs/cd/B19306_01/server.102/b14223/aggreg.htm#sthref1612
Regards
Raj
Similar Messages
-
Help with sql query on materialized view logs
I am in need of a query to find out what tablespace and snap shot site a long list of materialized view logs are associated with.
something like below except tablespace and snap_shot_site are not an option for this table.
select log_owner, master, log_table, tablespace, snap_shot_site from dba_mview_logs;What is the refresh method set as?
Could you paste the full MV log creation script and the corresponding MV creation script. -
Please help with the query creating Materialized View
Hi,
We are using the below query to create a Materialized View but it has been running since 3 hours. It is an Oracle 9i database running in HP-UX.The quey is as follows,
(SELECT
/*+ use_nl(A) parallel (A,4)*/
A.ICD_CODE AS ICD_CODE,
A.ICD_DESC AS ICD_DESC,
A.PROC_GROUP as PROC_GROUP,
B.COMPL_ICD_CODE AS COMPL_ICD_CODE,
B.COMPL_GRP_TXT AS COMPL_GRP_TXT,
C.PROC_TYPE AS PROC_TYPE ,
C.I_O_IND AS I_O_IND,
C.DISC_MON AS QUARTER ,
B.PAT_KEY AS PAT_KEY ,
D.COMPL_TYPE_TXT AS COMPL_TYPE_TXT ,
C.PROV_ID AS PROV_ID ,
A.SPECIALTY AS SPECIALTY
FROM
EES_ICD_9_CODE A ,
EES_CLINICAL_COMPL_DATA B,
EES_CLINICAL_DATA C,
EES_CLINCL_COMPL_ICD D
WHERE A.ICD_CODE= B.ICD_CODE
AND B.ICD_CODE= C.ICD_CODE
AND B.COMPL_ICD_CODE=D.ICD_9_CD
AND B.PAT_KEY=C.PAT_KEY
AND B.COMPL_ICD_CODEB.ICD_CODE
AND C.PROC_TYPE 'L'
AND B.COMPL_GRP_TXT'Reoperations'
AND D.COMPL_TYPE_TXT'Intra-operative Misadventure'
AND C.DISC_MON>='2003101'
AND A.SPECIALTY='Colo-Rectal')
union
(SELECT
/*+ use_nl(A) parallel (A,4)*/
A.ICD_CODE AS ICD_CODE,
A.ICD_DESC AS ICD_DESC,
A.PROC_GROUP as PROC_GROUP,
B.COMPL_ICD_CODE AS COMPL_ICD_CODE,
B.COMPL_GRP_TXT AS COMPL_GRP_TXT,
C.PROC_TYPE AS PROC_TYPE ,
C.I_O_IND AS I_O_IND,
C.DISC_MON AS QUARTER ,
B.PAT_KEY AS PAT_KEY ,
D.COMPL_TYPE_TXT AS COMPL_TYPE_TXT ,
C.PROV_ID AS PROV_ID ,
A.SPECIALTY AS SPECIALTY
FROM
EES_ICD_9_CODE A ,
EES_CLINICAL_COMPL_DATA B,
EES_CLINICAL_DATA C,
EES_CLINCL_COMPL_ICD D
WHERE A.ICD_CODE= B.ICD_CODE
AND B.ICD_CODE= C.ICD_CODE
AND B.COMPL_ICD_CODE=D.ICD_9_CD
AND B.PAT_KEY=C.PAT_KEY
AND B.COMPL_ICD_CODEB.ICD_CODE
AND C.PROC_TYPE 'L'
--AND B.COMPL_GRP_TXT'Reoperations'
AND D.COMPL_TYPE_TXT='Intra-operative Misadventure'
AND B.PROC_DAY=C.PROC_DAY
AND C.DISC_MON>='2003101'
AND A.SPECIALTY='Colo-Rectal')
union
(SELECT
/*+ use_nl(A) parallel (A,4)*/
A.ICD_CODE AS ICD_CODE,
A.ICD_DESC AS ICD_DESC,
A.PROC_GROUP as PROC_GROUP,
B.COMPL_ICD_CODE AS COMPL_ICD_CODE,
B.COMPL_GRP_TXT AS COMPL_GRP_TXT,
C.PROC_TYPE AS PROC_TYPE ,
C.I_O_IND AS I_O_IND,
C.DISC_MON AS QUARTER ,
B.PAT_KEY AS PAT_KEY ,
D.COMPL_TYPE_TXT AS COMPL_TYPE_TXT ,
C.PROV_ID AS PROV_ID ,
A.SPECIALTY AS SPECIALTY
FROM
EES_ICD_9_CODE A ,
EES_CLINICAL_COMPL_DATA B,
EES_CLINICAL_DATA C,
EES_CLINCL_COMPL_ICD D
WHERE A.ICD_CODE= B.ICD_CODE
AND B.ICD_CODE= C.ICD_CODE
AND B.COMPL_ICD_CODE=D.ICD_9_CD
AND B.PAT_KEY=C.PAT_KEY
AND B.COMPL_ICD_CODEB.ICD_CODE
AND C.PROC_TYPE 'L'
AND B.COMPL_GRP_TXT='Reoperations'
--AND D.COMPL_TYPE_TXT='Intra-operative Misadventure'
AND B.PROC_DAY>C.PROC_DAY
AND C.DISC_MON>='2003101'
AND A.SPECIALTY='Colo-Rectal')
The explain plan is as follows,
PLAN_TABLE_OUTPUT
| Id | Operation | Name | Rows | Bytes |TempSpc| Cost | TQ |IN-OUT| PQ Distrib |
| 0 | SELECT STATEMENT | | 46935 | 6716K| | 10648 | | | |
| 1 | SORT UNIQUE | | 46935 | 6716K| 14M| 10648 | 45,14 | P->S | QC (RAND) |
| 2 | UNION-ALL | | | | | | 45,13 | P->P | HASH |
|* 3 | HASH JOIN | | 42801 | 6102K| | 4640 | 45,13 | PCWP | |
|* 4 | TABLE ACCESS FULL | EES_CLINCL_COMPL_ICD | 875 | 18375 | | 2 | 45,02
|* 5 | HASH JOIN | | 41552 | 5072K| 14M| 4638 | 45,13 | PCWP | |
|* 6 | TABLE ACCESS FULL | EES_CLINICAL_DATA | 1430K| 40M| | 2855 | 45,03
|* 7 | HASH JOIN | | 628K| 56M| | 494 | 45,10 | P->P | HASH |
|* 8 | TABLE ACCESS FULL | EES_ICD_9_CODE | 37 | 2183 | | 1 | 45,08
|* 9 | TABLE ACCESS BY INDEX ROWID | EES_CLINICAL_COMPL_DATA | 2090K| 71M| | 49
| 10 | BITMAP CONVERSION TO ROWIDS | | | | | | |
|* 11 | BITMAP INDEX FULL SCAN | INX_COMPL_GRP | | | | | |
|* 12 | TABLE ACCESS BY INDEX ROWID | EES_CLINICAL_DATA | 1 | 33 | | 1
| 13 | NESTED LOOPS | | 1327 | 196K| | 947 | 45,13 | PCWP | |
|* 14 | HASH JOIN | | 60205 | 6996K| | 495 | 45,13 | PCWP | |
| 15 | TABLE ACCESS BY INDEX ROWID | EES_CLINCL_COMPL_ICD | 36 | 756 | |
|* 16 | INDEX RANGE SCAN | COMPL_TYPE_TXT_3 | 1 | | | 1 |
|* 17 | HASH JOIN | | 1420K| 132M| | 494 | 45,13 | PCWP | |
|* 18 | TABLE ACCESS FULL | EES_ICD_9_CODE | 37 | 2183 | | 1 | 45,11
|* 19 | TABLE ACCESS BY INDEX ROWID | EES_CLINICAL_COMPL_DATA | 4722K| 175M| | 49
| 20 | BITMAP CONVERSION TO ROWIDS| | | | | | | |
| 21 | BITMAP INDEX FULL SCAN | INX_COMPL_GRP | | | | | |
|* 22 | INDEX RANGE SCAN | EES_CLINICAL_DATA_IND1 | 1 | | | 2 | 45,13
|* 23 | HASH JOIN | | 2807 | 416K| | 4695 | 45,13 | PCWP | |
| 24 | TABLE ACCESS FULL | EES_CLINCL_COMPL_ICD | 911 | 19131 | | 2 | 45,06
|* 25 | HASH JOIN | | 2617 | 334K| 15M| 4693 | 45,13 | PCWP | |
|* 26 | TABLE ACCESS FULL | EES_CLINICAL_DATA | 1430K| 45M| | 2855 | 45,07
|* 27 | HASH JOIN | | 791K| 74M| | 305 | 45,12 | P->P | HASH |
|* 28 | TABLE ACCESS FULL | EES_ICD_9_CODE | 37 | 2183 | | 1 | 45,09
|* 29 | TABLE ACCESS BY INDEX ROWID | EES_CLINICAL_COMPL_DATA | 2632K| 97M| | 30
| 30 | BITMAP CONVERSION TO ROWIDS | | | | | | |
|* 31 | BITMAP INDEX SINGLE VALUE | INX_COMPL_GRP | | | | | |
Predicate Information (identified by operation id):
3 - access("B"."COMPL_ICD_CODE"="D"."ICD_9_CD")
4 - filter("D"."COMPL_TYPE_TXT"'Intra-operative Misadventure')
5 - access("B"."ICD_CODE"="C"."ICD_CODE" AND "B"."PAT_KEY"="C"."PAT_KEY")
6 - filter("C"."PROC_TYPE"'L' AND "C"."DISC_MON">=2003101)
7 - access("A"."ICD_CODE"="B"."ICD_CODE")
8 - filter("A"."SPECIALTY"='Colo-Rectal')
9 - filter("B"."COMPL_ICD_CODE""B"."ICD_CODE")
11 - filter("B"."COMPL_GRP_TXT"'Reoperations')
12 - filter("B"."ICD_CODE"="C"."ICD_CODE" AND "C"."PROC_TYPE"'L' AND "B"."PROC_DAY"="C"."PROC_DA
14 - access("B"."COMPL_ICD_CODE"="D"."ICD_9_CD")
16 - access("D"."COMPL_TYPE_TXT"='Intra-operative Misadventure')
17 - access("A"."ICD_CODE"="B"."ICD_CODE")
18 - filter("A"."SPECIALTY"='Colo-Rectal')
19 - filter("B"."COMPL_ICD_CODE""B"."ICD_CODE")
22 - access("B"."PAT_KEY"="C"."PAT_KEY")
23 - access("B"."COMPL_ICD_CODE"="D"."ICD_9_CD")
25 - access("B"."ICD_CODE"="C"."ICD_CODE" AND "B"."PAT_KEY"="C"."PAT_KEY")
filter("B"."PROC_DAY">"C"."PROC_DAY")
26 - filter("C"."PROC_TYPE"'L' AND "C"."DISC_MON">=2003101)
27 - access("A"."ICD_CODE"="B"."ICD_CODE")
28 - filter("A"."SPECIALTY"='Colo-Rectal')
29 - filter("B"."COMPL_ICD_CODE""B"."ICD_CODE")
31 - access("B"."COMPL_GRP_TXT"='Reoperations')
Note: cpu costing is offPlease help.Try removing the hints.
Is 47,000 a reasonable estimate of how many rows you expect in the results?
See these posts for other information that you should supply.
HOW TO: Post a SQL statement tuning request
HOW TO: Post a SQL statement tuning request - template posting
When your query takes too long
When your query takes too long ... -
SQL HELP NEEDED IN QUERY FOR COUNT
I Have this Query
SUM (CASE WHEN b.VET_OTHR_ELIG_CDE IN ('02', '03', '04') THEN 1 END) AS VET_YES,
SUM (CASE WHEN b.VET_OTHR_ELIG_CDE = '01' THEN 1 END) VET_NO, COUNT (E.ACTV_CDE) AS CNT_ACTV_CDE
Now i need to Add two more columns from the same Query Showing the count of VET_YES and VET_NO i.e count of TOTAL Veterans And TOTAL Non Veterans
those two columns i will be using as summary columns in my report.The bolded columns are those which i need to show the total column .anyone please help in this issue ..
ACTV_DESC ACTV_CDE VET_YES VET_NO CNT_ACTV_CDE
INACT DUE 13993 2 1 3
NOW I NEED TO MAKE IT LIKE THIS
ACTV_DESC ACTV_CDE VET_YES VET_NO CNT_VET CNT_NONVET CNT_ACTV_CDE (This is the total count)
INACT DUE 13993 2 1 2 1 3
Thanks in Advance,
Dev Kishore.T
Message was edited by:
Dev Kishore
Message was edited by:
Dev KishoreCheck this link.
http://download.oracle.com/docs/cd/B19306_01/server.102/b14223/aggreg.htm#sthref1612
Regards
Raj -
Need help with SQL Query with Inline View + Group by
Hello Gurus,
I would really appreciate your time and effort regarding this query. I have the following data set.
Reference_No---Check_Number---Check_Date--------Description-------------------------------Invoice_Number----------Invoice_Type---Paid_Amount-----Vendor_Number
1234567----------11223-------------- 7/5/2008----------paid for cleaning----------------------44345563------------------I-----------------*20.00*-------------19
1234567----------11223--------------7/5/2008-----------Adjustment for bad quality---------44345563------------------A-----------------10.00------------19
7654321----------11223--------------7/5/2008-----------Adjustment from last billing cycle-----23543556-------------------A--------------------50.00--------------19
4653456----------11223--------------7/5/2008-----------paid for cleaning------------------------35654765--------------------I---------------------30.00-------------19
Please Ignore '----', added it for clarity
I am trying to write a query to aggregate paid_amount based on Reference_No, Check_Number, Payment_Date, Invoice_Number, Invoice_Type, Vendor_Number and display description with Invoice_type 'I' when there are multiple records with the same Reference_No, Check_Number, Payment_Date, Invoice_Number, Invoice_Type, Vendor_Number. When there are no multiple records I want to display the respective Description.
The query should return the following data set
Reference_No---Check_Number---Check_Date--------Description-------------------------------Invoice_Number----------Invoice_Type---Paid_Amount-----Vendor_Number
1234567----------11223-------------- 7/5/2008----------paid for cleaning----------------------44345563------------------I-----------------*10.00*------------19
7654321----------11223--------------7/5/2008-----------Adjustment from last billing cycle-----23543556-------------------A--------------------50.00--------------19
4653456----------11223--------------7/5/2008-----------paid for cleaning------------------------35654765-------------------I---------------------30.00--------------19
The following is my query. I am kind of lost.
select B.Description, A.sequence_id,A.check_date, A.check_number, A.invoice_number, A.amount, A.vendor_number
from (
select sequence_id,check_date, check_number, invoice_number, sum(paid_amount) amount, vendor_number
from INVOICE
group by sequence_id,check_date, check_number, invoice_number, vendor_number
) A, INVOICE B
where A.sequence_id = B.sequence_id
Thanks,
NickIt looks like it is a duplicate thread - correct me if i'm wrong in this case ->
Need help with SQL Query with Inline View + Group by
Regards.
Satyaki De. -
Need helping in writing query for finding percentage of duration
Can any one please help in writing query for this.
The table is like this :-
ID Region Month Duration
I1 R1 Jan 80
I2 R2 Jan 70
I3 R1 Jan 70
I4 R3 Jan 40
I5 R1 Feb 80
I6 R2 Feb 30
I7 R3 Mar 100
I want to write a query to find
% of duration for each and every region against each and every month.
Please help in solving this query. I am in urgent need of this.
Thanks in advance.I also have to do in MS Access 2003You also have to ask into an other forum since here it's an Oracle forum, to try to find Oracle solution.
Nicolas. -
Need help writing a query for following scenario
Hi all, I need some help writing a query for the following case:
One Table : My_Table
Row Count: App 5000
Columns of Interest: AA and BB
Scenario: AA contains some names of which BB contains the corresponding ID. Some
names are appearing more than once with different IDs. For example,
AA BB
Dummy 10
Me 20
Me 30
Me 40
You 70
Me 50
Output needed: I need to write a query that will display only all the repeating names with their corresponding IDs excluding all other records.
I would appreciate any input. ThanksIs it possible to have a records with the same values for AA and BB? Are you interested in these rows or do you only care about rows with the same value of AA and different BB?
With a slight modification of a previous posting you can only select those rows that have distinct values of BB for the same value of AA
WITH t AS (
SELECT 'me' aa, 10 bb FROM dual
UNION ALL
SELECT 'me' aa, 20 bb FROM dual
UNION ALL
SELECT 'you' aa, 30 bb FROM dual
UNION ALL
SELECT 'you' aa, 30 bb FROM dual
SELECT DISTINCT aa, bb
FROM (SELECT aa, bb, COUNT(DISTINCT bb) OVER(PARTITION BY aa) cnt FROM t)
WHERE cnt > 1; -
What rights do I need for materialized views scheduling
Hello,
Can anyone tell me what rights do I need to schedule a materialized views at 1:00 am every night?
To create material views I've use the folowing script:
CREATE MATERIALIZED VIEW MV_view
REFRESH COMPLETE
START WITH sysdate NEXT round(SYSDATE + 1) + 1/24
AS SELECT ... join tabeles... ;.
The problem is that on my test server the MV_view run every night, but on production server my materialized views run only once (when I've run the script above).
I have take a look into the user_refresh and in field NEXT_DATE it's the time of my MV_view creation.
It is possible tha my DBA put some restrictions on my schema? Or do I need some rights to use START WITH and NEXT in my script on production server?
Thanks,
XaMOriginally Posted by wyld
Hi
I find the correct method: I do not only assign reporting rights to htm , I need modify "Inventory report rights"of "Administrator task" in the left of ZCC Console.
If I assign and modify the correct rights, he will create new & run these reports.
wyldkao
Which version you are using? I can't find Inventory Report Rights anywhere? I could only get this working by giving superadmin Please can some explain Thanks -
Setting DBMS_METADATA.GET_DDL Output for Materialized Views
Hi all.
My Oracle version is 10g.
I'm extracting the DDL of all the objects from database using the DBMS_METADATA package. I'm using SET_TRANSFORM_PARAM to configure the output because I need a simple sql code, without information about tablespaces, storage and segment attributes. Everything works fine except when I'm working with mviews object types. I can't remove the information about tablespace, storage or segment attributes for materialized views.
I would like to know if there's a related issue about it. Or there's something missing in my code?
I tried to specify the object type as another parameter on DBMS_METADATA.SET_TRANSFORM_PARAM but don't work too.
The only transform parameter that works fine with Materialized Views is the SQLTERMINATOR.
See how I have done:
declare
vDDL clob;
begin
dbms_metadata.set_transform_param (DBMS_METADATA.SESSION_TRANSFORM, 'STORAGE', FALSE);
dbms_metadata.set_transform_param (DBMS_METADATA.SESSION_TRANSFORM, 'TABLESPACE', FALSE);
dbms_metadata.set_transform_param (DBMS_METADATA.SESSION_TRANSFORM, 'SEGMENT_ATTRIBUTES', FALSE);
dbms_metadata.set_transform_param (DBMS_METADATA.SESSION_TRANSFORM, 'SQLTERMINATOR',TRUE);
select dbms_metadata.get_ddl ('MATERIALIZED_VIEW', 'MV_STO020', 'HIS117_CHECK') into vDDL FROM DUAL;
dbms_output.put_line (vDDL);
end;
and how the output is:
CREATE MATERIALIZED VIEW "HIS117_CHECK"."MV_STO020"
ORGANIZATION HEAP PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "TS_HIS117"
BUILD IMMEDIATE
USING INDEX
REFRESH FORCE ON DEMAND
WITH PRIMARY KEY USING DEFAULT LOCAL ROLLBACK SEGMENT
DISABLE QUERY REWRITE
AS SELECT
STO020_MOVEMENT_LOG_ID STO020_MOVEMENT_LOG_ID
, STO020_QUANTITY STO020_QUANTITY
, STO020_DATE STO020_DATE
, STO020_BEFORE_BALANCE STO020_BEFORE_BALANCE
, STO011_PRODUCT_MOVEMENT_ID STO011_PRODUCT_MOVEMENT_ID
, ADM082_PRODUCT_ID ADM082_PRODUCT_ID
, ADM089_PRODUCT_PRESENTATION_ID ADM089_PRODUCT_PRESENTATION_ID
, STO010_MOVEMENT_TYPE_ID STO010_MOVEMENT_TYPE_ID
, STO001_STOCK_ID STO001_STOCK_ID
, STO001_TARGET_STOCK_ID STO001_TARGET_STOCK_ID
, STO003_PRODUCT_LOT_ID STO003_PRODUCT_LOT_ID
, SYS010_USER_ID SYS010_USER_ID
, EIR001_MPI EIR001_MPI
, ADM056_MEDICAL_ATTENTION_ID ADM056_MEDICAL_ATTENTION_ID
, ADM094_USE_UNIT_ID ADM094_USE_UNIT_ID
FROM
STO020_MOVEMENT_LOG;
Thank you in advanced!
Edited by: lucporto on 28/08/2012 07:26Right. I found this way but I consider this just a quick fix, because I think there should be a better way to do this.
create table t_clob (c_long);
declare
p clob;
begin
delete from t_clob;
execute immediate 'insert into t_clob (select to_lob(query) from dba_mviews where owner = :1 and mview_name = :2)'
USING 'HIS117', 'MV_STO020';
select 'CREATE MATERIALIZED VIEW MV_STO020' || chr(10) ||
'REFRESH ON DEMAND' || chr(10) || 'AS' || CHR(10) || mv.c_long
into p
from t_clob mv;
dbms_output.put_line(p);
end;
Thanks all. -
Select query in materialized view with two dblinks
Hi All,
We have oracle 10g On windows.
We are trying to create materialized view. Scenario is we have base table on other database and we are creating mview on different database.
Basa database have two schema's and i am selecting records from that two schema's using two private db links.
But when i am tryin gto create mview its not getting created. After 15 hrs. its still showing creation command and not finished.
Query is :-
Is it good practice to have two db links in select query of materialized view.Billy Verreynne wrote:
Chanchal Wankhade wrote:
Is it good practice to have two db links in select query of materialized view.Same db link being used twice, or two different db links?
If the former, you ideally want the local Oracle db to send the join to the remote database, and for the remote database to drive the join between those 2 tables. There is a hint (<i>driving_site</i>) that can be used - or the join query can be defined on the remote database as a view, and the local materialised view can then use that remote view.
If you have 2 different db links and joining across these - usually a bad idea to perform distributed database joins. There are lots of limitations as to how the tables can be joined. Worse case, full table scans of both remote tables, pulling all the rows from the 2 remote database tables to the local database, and joining these on the local database.
I have seen some severe performance issues in the past as a result of distributed joins. I'll rather use 2 materialised views for pulling both distributed tables's data locally, and then do the join on local data (using indexes, partition pruning, etc)Hi Billy,
My scenario is i have two database database A and database B. Database A is having two schema's SCOTT AND HR. SCOTT schema have select privileges on HR schema.
DB LINK is between Database B to Database A. name is db.link.B.A.oracle.com.
What if i priovide while creating materialized view, the schema name before the table name in database B for this particuler table so it will pick up the table from that schema using same DB LINK(db.link.B.A.oracle.com.) that i am using to fetch records from SCOTT schema.
Above schnario is like two base schema's and one db link using two schema. -
Refresh time for Materialized View
Hi,
I have created a materialized view and set it to refresh everyday at 4 am . When I check the status of the job , it shows the refresh timing between 20 mins to 4 hours . That means , some times it takes 20 mins to refresh , some times 40 , some time 2 hours and some times up to 4 hours. Any reason for the wide range ? Here is the query for the view.
CREATE MATERIALIZED VIEW BDS_COST_CATEGORY_MV
ORGANIZATION HEAP PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "USERS"
BUILD IMMEDIATE
USING INDEX
REFRESH COMPLETE ON DEMAND START WITH sysdate+0 NEXT ROUND(SYSDATE + 1) + 4/24
USING DEFAULT LOCAL ROLLBACK SEGMENT
DISABLE QUERY REWRITE
AS SELECT AC.ACCOUNT_MANAGER, AC.ACCOUNT_NUMBER,
AC.ACCOUNT_NAME, DIV.DIVISION_NUMBER, ITEM.CODE_ID,
ITEM.CODE_NAME COST_CATEGORY_ITEM,
TO_NUMBER(TO_CHAR(AP.FIRST_DAY,'YYYY')) PERIOD_YEAR,
AP.FIRST_DAY PERIOD,
SUM(NVL(AD.CURRENT_EXPENSE,0)) EXPENSE
FROM ACCOUNTS AC, PERSONNEL AC_MGR, DIVISIONS DIV, ASR_HEADERS AH , ASR_DETAILS AD, CODES ITEM, CODES COSTCAT, ALL_PERIODS AP,
CODES COST_ELEMENT, ACCOUNTING_BASE_GROUP ABG
WHERE AC.ACCOUNT_MANAGER = AC_MGR.PERSONNEL_ID
AND AC_MGR.DIVISION_ID = DIV.DIVISION_ID (+)
AND AC.ACCOUNT_ID = AH.ACCOUNT_ID
AND AH.ASR_HEADER_ID = AD.ASR_HEADER_ID
AND AH.PERIOD_ASR = AP.FISCAL_SYSTEM_PERIOD_CAL_YR_EQ||', '|| AP.FISCAL_YEAR
AND ABG.COST_ELEMENT_CAT_ITEM_ID = ITEM.CODE_ID
AND COST_ELEMENT.CODE_ID = ABG.COST_ELEMENT_ID
AND AD.OBJECT_CODE = COST_ELEMENT.CODE_VALUE
AND ITEM.CODE_PARENT_ID = COSTCAT.CODE_ID
AND ( COSTCAT.CODE_NAME = 'BDS' OR ( COSTCAT.CODE_NAME = 'Base' AND ITEM.CODE_NAME = 'MTDC'))
GROUP BY AC.ACCOUNT_MANAGER,AC.ACCOUNT_NUMBER, AC.ACCOUNT_NAME,
DIV.DIVISION_NUMBER, ITEM.CODE_ID, ITEM.CODE_NAME,
TO_NUMBER(TO_CHAR(AP.FIRST_DAY,'YYYY')), AP.FIRST_DAYThis appears to be a duplicate of Refreshing Materilized view. I replied on the other thread.
Justin -
SAP query for Material pricing group changes in material.
Dear all,
I'm trying to generate a query for Material Pricing group changes in material. For that I've to retrieve data from follwing three tables MVKE, CDHDR & CDPOS.
Firstly while generating infoset -
I tried it by joining tables MVKE & CDHDR, but system is not allowing it, also table CDPOS can't bejoined.
Then I tried by reading dirctly from table MVKE and then adding additional fields in it. query created using this infoset is giving the output, however it's giving only 1 entry per material entered in input.
for multiple entries in output for MPG changes in same material I tried creating addtional structure for table CDHDR & CDPOS but again I'm getting only 1 entry per material.
please suggest how I can get MPG changes done in specified time period for a material.
Thanks.Hi
Check the report RSSCD100 and run it for object MAT_FULL for table MVKE. Use this report as a template for your own development.
I hope this helps you
Regards
Eduardo
PD: sorry, the table is DMVKE
Edited by: E_Hinojosa on Sep 2, 2011 9:37 AM -
Need a query for export table data .....
Hi,
I need a query for exporting the data in a table to a file.
Can anyone help me ?
Thanking You
JeneeshSQL> spool dept.txt
SQL> select * from dept;
DEPTNO DNAME LOC
10 ACCOUNTING NEW YORK
20 RESEARCH DALLAS
30 SALES CHICAGO
40 OPERATIONS BOSTON
SQL> spool off
SQL> ed dept.txt -
Query on Materialized view and materialized view log
I am creating a materialized view something like this.but getting following error:
ERROR at line 1:
ORA-12032: cannot use rowid column from materialized view log on "SCOTT"."EMP"
SQL> create snapshot log on scott.emp;
Materialized view log created.
SQL> create materialized view scott_emp refresh fast on demand as select deptno,sum(sal) sum_sal from scott.emp group by deptno;
ERROR at line 1:
ORA-12032: cannot use rowid column from materialized view log on "SCOTT"."EMP"
Note when i have my query in materialized view as "select * from emp;" in place of
"select deptno,sum(sal) sum_sal from scott.emp group by deptno;" This code works fine.
How do i have a materialized with with a group by clause.
Thanks in AdvanceGot the answer myself.
I wasnt adding all the required columns.
CREATE MATERIALIZED VIEW LOG ON scott.emp
WITH SEQUENCE, ROWID (<all the required columns>)
INCLUDING NEW VALUES;
Anyways,
Thanks guys... -
I need a bapi for material management advance shipping notifications
i need a bapi for material management advance shipping notifications for developing powls which includes below fields and some more fields.
Inbound delivery number
Due date (GR date)
Vendor delivery number
Material
Name of material
Quantity
Vendor
Name of vendor
thanks and regards,
jameer.pHi Jameer,
This is a hard one, my friend. I understand what you are trying to do.. Try BAPI_DELIVERYPROCESSING_EXEC. It is tricky though.
Moreover you might want to use a FM to fill the IDOC data. something like IDOC_INPUT_**. this might be a better option.
cheers,
Hema.
Maybe you are looking for
-
[solved] [VIM] question to vim power users about mapping
Hi, I have just starting using map leaders in vim and I'm love it. Here are my shortcuts but this method allow to open /etc/rc.conf only in readonly mode. So how can I open this file to edit like su (when I open vim without sudo)? I have configured s
-
10.2.0.2 aix 5.3 64bit archivelog mode. I'm going to attempt to describe the system first and then outline the issue: The database is about 1Gb in size of which only about 400Mb is application data. There is only one table in the schema that is very
-
All of a sudden my cellular connection stopped. iPhones and other tables on the same Verizon plan work fine. Rebooting didn't work. Turning cellular data off and back on didn't work either, Verizon hold time is so long! Any ideas appreciated.
-
How to return Varchar2(1) from function ?? Simple but annoying :(
Hi, I have a function something like... CREATE OR REPLACE FUNCTION Test ( id number) RETURN VARCHAR2 ... Now I am using this function in a View as ... select test(123) as Test In the View description, this column appears as Varchar 4000. whereas I wa
-
Excel 2013 PowerMaps: Can't initiate directx.
I'm trying to insert a powermap into a powerview. I'm using my desktop. Upon clicking insert, I get the error indicating that directx can't initiate. I have confirmed that my DDI version is 10.1. Please advise. Thank you. Natediggity