XMLType and model Clause
Hello-
We face a problem which I hope I can explain clearly and concisely.
We have a relational Oracle table with an XMLType column. the relational table has some fields in addition to the profiling XMLType column.
CREATE TABLE 'CLAIM_OUTPUT_XML '.
(NUMBER OF 'SEQ_NUM',
NUMBER OF "BATCH_ID."
VARCHAR2 (BYTE 9) "MEMBER_ID"
NUMBER OF "MBR_COB_SFX."
NUMBER OF "CLAIM_NBR."
VARCHAR2 (3 BYTE) "CLAIM_SFX."
DATE OF THE "PRINT_DATE."
VARCHAR2 (30 BYTE) "DOC_TYPE."
"CLAIM_OUTPUT" 'SYS '. "" XMLTYPE.
DATE OF THE "CRTD_DT."
VARCHAR2 (30 BYTE) "CRTD_BY".
);
INSERT INTO CLAIM_OUTPUT_XML (SEQ_NUM
BATCH_ID
MEMBER_ID
MBR_COB_SFX
CLAIM_NBR
CLAIM_SFX
PRINT_DATE
DOC_TYPE
CLAIM_OUTPUT)
VALUES (1
2015072015
, "ABCDEF123".
0
61773667
null
TRUNC (SYSDATE)
, "EOB".
XMLTYPE ("< claim >
< ClaimInfo >
< claim >
< CLAIM_NBR > 61773667 < / CLAIM_NBR >
< CLAIM_SFX / >
< MEMBER_ID > ABCDEF123 < / SSN >
< MBR_COB_SFX > 0 < / SSN_COB_SFX >
< > 00 DEP < / DEP >
MEMBER of < UD_PATIENT_TYPE > < / UD_PATIENT_TYPE >
the PATIENT NAME < UD_PATIENT_NAME > < / UD_PATIENT_NAME >
< DOCTOR_PFX > T < / DOCTOR_PFX >
< DOCTOR_NBR > 123123123 < / DOCTOR_NBR >
< DOCTOR_SFX > 0 < / DOCTOR_SFX >
< GRP_NBR > GRP_NBR < / GRP_NBR >
P < INSURER > < / INSURER >
< ClaimDetails >
< ClaimDetail >
< CLAIM_NBR > 61773667 < / CLAIM_NBR >
< CLAIM_SFX / >
< CLAIM_LINE > 1 < / CLAIM_LINE >
< MEMBER_ID > ABCDEF123 < / SSN >
< MBR_COB_SFX > 0 < / SSN_COB_SFX >
< > 00 DEP < / DEP >
< GRP_NBR > GRP_NBR < / GRP_NBR >
P < INSURER > < / INSURER >
C < PLAN_TYPE > < / PLAN_TYPE >
< DOCTOR_PFX > T < / DOCTOR_PFX >
< DOCTOR_NBR > 123123123 < / DOCTOR_NBR >
< DOCTOR_SFX > 0 < / DOCTOR_SFX >
< DOC_FEES > 116 < / DOC_FEES >
< SCH_FEE > 0 < / SCH_FEE >
< COB_AMT > 0.00 < / COB_AMT >
< COB_COMPANY / >
< PTX_COPAY > 0 < / PTX_COPAY >
< DEDUCT_AMT > 0.00 < / DEDUCT_AMT >
< OVER_AMT > 0 < / OVER_AMT >
< ALLOW_AMT > 0 < / ALLOW_AMT >
< ENTERED_BY > N < / ENTERED_BY >
< PAY_IND > N < / PAY_IND >
< EXPLAIN_CODE1 > AF < / EXPLAIN_CODE1 >
< EXPL1_DESC > ORTHODONTICS COVERAGE AVAILABLE ONLY IF there IS a SERIOUS MEDICAL CONDITION < / EXPL1_DESC >
< EXPL1_DEN_DESC / >
P8 < EXPLAIN_CODE2 > < / EXPLAIN_CODE2 >
< EXPL2_DESC > SERVICE a TREATY BASED ON THE CLAIM FORM DESCRIPTION < / EXPL2_DESC >
< EXPL2_DEN_DESC / >
< EXPLAIN_CODE3 / >
< EXPL3_DESC / >
< EXPL3_DEN_DESC / >
< SERVICE_DATE / >
< ADA_CODE > 8670 < / ADA_CODE >
a TREATMENT ORTHODONTIQUE PERIODICAL < ADA_DESC > < / ADA_DESC >
BRACES < ADA_SHORT_DESC > < / ADA_SHORT_DESC >
< HPLX_CODE > 8420 < / HPLX_CODE >
< HPLX_DESC / >
< UD_AGE_LIMITATION / >
< TEETH / >
< SURFACE / >
< COB_RES_CRD > 0 < / COB_RES_CRD >
< PTX_RESP > 116.00 < / PTX_RESP >
< PAY_CODE_PRT > N < / PAY_CODE_PRT >
< UD_SHOW_PTX_RESP_MSG > Y < / UD_SHOW_PTX_RESP_MSG >
< / ClaimDetail >
< / ClaimDetails >
< / claim >
< EOB_Specific >
< SendToInfo >
COPY of PROVIDER < UD_COPY_TO > < / UD_COPY_TO >
< UD_COPY_TO_FULL > COPY PROVIDER - assigned doctor benefits < / UD_COPY_TO_FULL >
< / SendToInfo >
< / EOB_Specific >
< / ClaimInfo >
(< / request > ')
);
INSERT INTO CLAIM_OUTPUT_XML (SEQ_NUM
BATCH_ID
MEMBER_ID
MBR_COB_SFX
CLAIM_NBR
CLAIM_SFX
PRINT_DATE
DOC_TYPE
CLAIM_OUTPUT)
VALUES (2
2015072015
, "ABCDEF123".
0
61773667
null
TRUNC (SYSDATE)
, "EOB".
XMLTYPE ("< claim >
< ClaimInfo >
< claim >
< CLAIM_NBR > 61773667 < / CLAIM_NBR >
< CLAIM_SFX / >
< MEMBER_ID > ABCDEF123 < / SSN >
< MBR_COB_SFX > 0 < / SSN_COB_SFX >
< > 00 DEP < / DEP >
MEMBER of < UD_PATIENT_TYPE > < / UD_PATIENT_TYPE >
the PATIENT NAME < UD_PATIENT_NAME > < / UD_PATIENT_NAME >
< DOCTOR_PFX > T < / DOCTOR_PFX >
< DOCTOR_NBR > 123123123 < / DOCTOR_NBR >
< DOCTOR_SFX > 0 < / DOCTOR_SFX >
< GRP_NBR > GRP_NBR < / GRP_NBR >
P < INSURER > < / INSURER >
< ClaimDetails >
< ClaimDetail >
< CLAIM_NBR > 61773667 < / CLAIM_NBR >
< CLAIM_SFX / >
< CLAIM_LINE > 1 < / CLAIM_LINE >
< MEMBER_ID > ABCDEF123 < / SSN >
< MBR_COB_SFX > 0 < / SSN_COB_SFX >
< > 00 DEP < / DEP >
< GRP_NBR > GRP_NBR < / GRP_NBR >
P < INSURER > < / INSURER >
C < PLAN_TYPE > < / PLAN_TYPE >
< DOCTOR_PFX > T < / DOCTOR_PFX >
< DOCTOR_NBR > 123123123 < / DOCTOR_NBR >
< DOCTOR_SFX > 0 < / DOCTOR_SFX >
< DOC_FEES > 116 < / DOC_FEES >
< SCH_FEE > 0 < / SCH_FEE >
< COB_AMT > 0.00 < / COB_AMT >
< COB_COMPANY / >
< PTX_COPAY > 0 < / PTX_COPAY >
< DEDUCT_AMT > 0.00 < / DEDUCT_AMT >
< OVER_AMT > 0 < / OVER_AMT >
< ALLOW_AMT > 0 < / ALLOW_AMT >
< ENTERED_BY > N < / ENTERED_BY >
< PAY_IND > N < / PAY_IND >
< EXPLAIN_CODE1 > AF < / EXPLAIN_CODE1 >
< EXPL1_DESC > ORTHODONTICS COVERAGE AVAILABLE ONLY IF there IS a SERIOUS MEDICAL CONDITION < / EXPL1_DESC >
< EXPL1_DEN_DESC / >
P8 < EXPLAIN_CODE2 > < / EXPLAIN_CODE2 >
< EXPL2_DESC > SERVICE a TREATY BASED ON THE CLAIM FORM DESCRIPTION < / EXPL2_DESC >
< EXPL2_DEN_DESC / >
< EXPLAIN_CODE3 / >
< EXPL3_DESC / >
< EXPL3_DEN_DESC / >
< SERVICE_DATE / >
< ADA_CODE > 8670 < / ADA_CODE >
a TREATMENT ORTHODONTIQUE PERIODICAL < ADA_DESC > < / ADA_DESC >
BRACES < ADA_SHORT_DESC > < / ADA_SHORT_DESC >
< HPLX_CODE > 8420 < / HPLX_CODE >
< HPLX_DESC / >
< UD_AGE_LIMITATION / >
< TEETH / >
< SURFACE / >
< COB_RES_CRD > 0 < / COB_RES_CRD >
< PTX_RESP > 116.00 < / PTX_RESP >
< PAY_CODE_PRT > N < / PAY_CODE_PRT >
< UD_SHOW_PTX_RESP_MSG > Y < / UD_SHOW_PTX_RESP_MSG >
< / ClaimDetail >
< / ClaimDetails >
< / claim >
< EOB_Specific >
< SendToInfo >
MEMBER COPY < UD_COPY_TO > < / UD_COPY_TO >
< UD_COPY_TO_FULL > COPY MEMBER - benefits assigned to doctor < / UD_COPY_TO_FULL >
< / SendToInfo >
< / EOB_Specific >
< / ClaimInfo >
(< / request > ')
);
The generated XML is used to provide raw data to third-party documents generation software. Before send us the data to the third party software, we need to predetermine the number of documents that are part of a shipment (as part of the requirements for other third party software, we use). This is determined by the number of forms to be printed and how many services it has. The caution in our requirements is that, for example, if 3 members of the same family turn on the same doctor on the same day, we want to combine broadcast of each Member of the family. Each envelope can have up to 10 sheets of paper, then regroup according to this as well. I was able to design it by using the SQL type clause, but the problem that I am up against accessing values retrieved via XQuery.
Here's a simple example of data extracted from XML is not not available. I can share the data file - I did not know how to attach to this issue.
If I run this query:
Select *.
of claim_output_xml x 1
, XMLTable (' for $z in/Claim/ClaimInfo)
return $z '
PASSAGE claim_output
COLUMNS
grp_id varchar2 (30) PATH "claim/GRP_NBR.
, path of varchar2 (30) copy_To ' EOB_Specific/SendToInfo/UD_COPY_TO.
) y ;
I see all the columns of x 1 as well as the columns that I extracted using xquery.
SEQ_NUM | BATCH_ID | MEMBER_ID | MBR_COB_SFX | CLAIM_NBR | CLAIM_SFX | DOCTOR_NBR | DOCTOR_PFX | DOCTOR_SFX | PRINT_DATE | DOC_TYPE | CLAIM_OUTPUT | CRTD_DT | CRTD_BY | COPY_TO | GRP_ID | COPY_TO_1 |
1801 | 2015072015 | ABCDEF123 | 0 | 61773667 | 20 JULY 15 | EOB | (XMLTYPE) | GRP_NBR | COPY OF PROVIDER | |||||||
1802 | 2015072015 | ABCDEF123 | 0 | 61773667 | 20 JULY 15 | EOB | (XMLTYPE) | GRP_NBR | MEMBER COPY |
If I now add the clause type (no rules applied) for the same query:
Select *.
of claim_output_xml x 1
, XMLTable (' for $z in/Claim/ClaimInfo)
return $z '
PASSAGE claim_output
COLUMNS
grp_id varchar2 (30) PATH "claim/GRP_NBR.
, path of varchar2 (30) copy_To ' EOB_Specific/SendToInfo/UD_COPY_TO.
) y
model
dimension (x1.seq_num)
measures (cast (x 1. MEMBER_ID as varchar2 (30)) mbr_id
y.copy_to)
Rules();
y.copy_to is null:
SEQ_NUM | MBR_ID | COPY_TO |
1801 | ABCDEF123 | |
1802 | ABCDEF123 |
I also share the actual query, that we are working on. The query has a few clauses, which allows access to the XML xquery data. In one case, the extracted value of the XML is coming through, but I can't get the others to work.
Version information:
Oracle Database 11 g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production
PL/SQL Release 11.2.0.3.0 - Production
"CORE 11.2.0.3.0 Production."
AMT for Solaris: 11.2.0.3.0 - Production Version
NLSRTL Version 11.2.0.3.0 - Production
Hello
Your test scenario has not been 'tested '.
Two examples of XML documents are not correct.
On the real problem, it works:
SQL> select * 2 from ( 3 select /*+ no_merge */ 4 x1.seq_num 5 , x1.member_id 6 , y.copy_to 7 from claim_output_xml x1 8 , XMLTable( 9 'for $z in /Claim/ClaimInfo return $z' 10 PASSING claim_output 11 COLUMNS 12 grp_id varchar2(30) PATH 'Claim/GRP_NBR' 13 , copy_To varchar2(30) path 'EOB_Specific/SendToInfo/UD_COPY_TO' 14 ) y 15 ) 16 model 17 dimension by (seq_num) 18 measures( 19 cast(MEMBER_ID as varchar2(30)) as mbr_id 20 , copy_to 21 ) 22 rules(); SEQ_NUM MBR_ID COPY_TO ---------- ------------------------------ ------------------------------ 1 ABCDEF123 PROVIDER COPY 2 ABCDEF123 MEMBER COPY
In some cases, the CBO messes things.
This is a recurring problem when the XMLTABLE projections are used in predicates or as the source for subsequent transformations.
The workaround is to set mode of line no-that can be merged.
That being said, maybe you can share your needs more explaining the logic (sample input/output required).
There might be a way to avoid the MODEL - is not that I do not use it, but I usually prefer to pull out of my hat as a last resort.
Tags: Database
Similar Questions
-
I want to learn about the model clause, if everyone learned pls share your knowledge, it will be useful to everyone, the examples provided in the oracle documentation are really pathetic. pls share your knowledge with which any person can understand, as good examples
What is a measure, and what it does?
What is a size clause?
What is the rules how to use and what it does.
If oracle documentation is reading my post, hope that they will understand how it is difficult to understand the examples provided in the oracle documentationIf you are familiar with the OOPS concepts, I think it will be very easy to understand the concept of MODEL... I would try to explain with a simple example.
Think of a table, for example POPULATION_ARRAY, that allows to store the population for countries for different years. Means of the table are defined as
POPULATION_ARRAY (number of people) indexed by [COUNTRY_ID, YEAR]
Normally, we define the values as below for the tables...
population_array[INDIA,2012].population := 130,000,000;
The ID of the country and the YEAR here are the dimensions. The POPULATION is a MEASURE.
Another element in the array will be
population_array[CHINA,2012].population := 150,000,000;
Now suppose I want to do a calculation to know the population on 2022 on an explanation that the population will double (!) for these countries in 2022.
Will let you know how you can do this in EXCEL. Same thing can be done using the MODEL. (And much more...!)For simplicity we will fill all these data in a single table.
SQL> create table country(country_id varchar2(30), 2 year number,population number); Table created. SQL> insert into country values('INDIA',2012,130000000); 1 row created. SQL> insert into country values('CHINA',2012,150000000); 1 row created. SQL> commit; Commit complete. SQL> select * from country; COUNTRY_ID YEAR POPULATION ------------------------------ ---------- ---------- INDIA 2012 130000000 CHINA 2012 150000000
Here we do not have values for 2022.Now how to calculate and display the results using MODEL?
As mentioned, the dimensions are COUNTRY_ID, YEAR. The fatc that interests us is the POPULATION.
Thus, the application of the MODEL will be as follows, for INDIA
SQL> select * 2 from country 3 model 4 dimension by (country_id,year) 5 measures(population) 6 rules upsert all 7 ( 8 population['INDIA',2022] = population['INDIA',2012]*2 9 ); COUNTRY_ID YEAR POPULATION ------------------------------ ---------- ---------- CHINA 2012 150000000 INDIA 2012 130000000 INDIA 2022 260000000
So here we use MODEL as an EXCEL spreadsheet.
You will notice that us hard coded name of the country here, which can be avoided using ANY keyword and cv (present value) function.
SQL> select * 2 from country 3 model 4 dimension by (country_id,year) 5 measures(population) 6 rules upsert all 7 ( 8 population[ANY,2022] = population[cv(),2012]*2 9 ); COUNTRY_ID YEAR POPULATION ------------------------------ ---------- ---------- INDIA 2012 130000000 CHINA 2012 150000000 CHINA 2022 300000000 INDIA 2022 260000000
Suppose now, I do not have the details of the USA for 2012. But I guess that the US population is half that of INDIA. That can be added as follows
SQL> select * 2 from country 3 model 4 dimension by (country_id,year) 5 measures(population) 6 rules upsert all 7 ( 8 population['USA',ANY] = population['INDIA',cv()]/2, 9 population[ANY,2022] = population[cv(),2012]*2 10 ); COUNTRY_ID YEAR POPULATION ------------------------------ ---------- ---------- INDIA 2012 130000000 CHINA 2012 150000000 USA 2012 65000000 CHINA 2022 300000000 INDIA 2022 260000000 USA 2022 130000000 6 rows selected.
With this basis, go gold http://docs.oracle.com/cd/B28359_01/server.111/b28313/sqlmodel.htm and ask any doubts...
Published by: JAC on January 30, 2013 13:40
Please note: this is a very simple example, which may not require the MODEL clause as such... -
Throughout the year the iMac Intel and models boot from an external USB disk?
?
Trying to help a post here it is in a jam and I'm trying him on a path of least resistance to cure its ills.
Do every year Intel iMac and models able to boot a USB external hard drive?
Here is the message for those who are curious.
It is in a real bind.
HELP... lost my businesses together work of the reader
Thanks for any idea.
Yes. Click here for more information.
(142246)
-
difference between microsoft lifecam studio model # Q2F-00013 and model #Q2F-00001
What is the difference between microsoft life cam model studio # Q2F-00013 and model # Q2F-00001
Hello, Paul.
See details on the two
Q2F-00001
http://www.Microsoft.com/hardware/en-us/p/LifeCam-Studio/Q2F-00001#details
Q2F-00013
-
I am looking for the exact make and model of motherboard of my laptop. Is there someone who has some info on it? My laptop is the HP dv7-7255dx C6N73UA Envy.
Thanks in advance.
I'm sorry. I missed that.
The easiest way to do this is by using the HP Partsurfer. Entry of your laptop and parts available information will be displayed.
-
Hello, I am trying to get my internal speakers to work. They worked fine up until I had to repalce my hard drive. I finailly got all my drivers installed and updated on the site variouus. Now, when I check my internal speakers (no system sounds) I can not find the make and model of them. All I can identify is that I have. That the drivers are missing. No part number for the company name, etc. is connected with the internal speakers.
Dell PC Tower, Denmension bought 3000 mid-' 04.
Interanal speakers for system sounds.
Windows XP Edition version family. IE8
Windows Defender antispyware software.
Thank you
I don't know what you mean by getting the drivers from "various sites." The only place to get the drivers for the hardware that is installed with your Dimension is the Dell Web site.
There is only one pilot audio for your Dimension 3000 and it's here:
Of course if you added your own sound card you need get the drivers of the mftr site. but provided with your Dell printer's on the motherboard, and those are the drivers for it. MS - MVP - Elephant Boy computers - don't panic!
-
card mother Dell can change my existing parent outside with one of the same brand and model?
I have a dell inspiron 530, the motherboard is bad. I was going to get the same model. but I was told that windows will not work on the new. even if they are the same type of motherboard
Make the point by replacing with the same card mother and model is interpreted as reinstallation on the same computer.
Change the motherboard starts the process of building a new computer and an OEM of Windows version is only intended to be installed on a computer not two or more. You can purchase licenses for installing Windows on multiple computers, but they aren't meant to business computers home computers.
-
is it possible information on adapters network physical host via PowerCLI brand / model? I find a lot of things, talk to find such as speed and duplex settings, but not the brand and model.
You could give my script to appoint this material to try.
-
Query on the physical Architecture, the logical Architecture and model
Hi Experts,
I have a confusion regarding the physical, logical and model Architecture Architecture. Please tell me what type of information or data, these three above hold.
Thank youPhysical architecture contains information about the physical configuration of your environment e.g. nameservers, jdbc, usernames, passwords etc connection strings
The logical architecture provides an abstraction layer that allows to group by similar contexts of physical architecture components that reside in different locations/environments.
Patterns are reversed representations of objects in your physical architecture that is tables, flat files, etc. The models are used as sources and targets in your UI design
-
Questions using the 'Make' variables and 'Models' file rename templete
I currently have two import of models of change of name of the file. I chose according to the CF card camera came. I tried LR4 and now the LR5 use a built-in variable to 'Do' and 'model '. This way I just having a name change model and do not have to worry about forgetting to change the model. Am I missing something here? All the info is in the EXIF data. Why can't LR out?
Sample of my two models:
"Nikon_D700_ {Date (MM)"} {Date (DD) '} {Date (YYY) '} _ {filename number suffix}.
"Nikon_D300_ {Date (MM)"} {Date (DD) '} {Date (YYY) '} _ {filename number suffix}.
Sample of what I want:
"_ _ {Model}' {brand} {Date (MM)"} {Date (DD) '} {Date (YYY) '} _ {filename number suffix}.
That I lose my mind or is the variable renaming works as expected and I use it wrong?
Thanks in advance!
Conrad
Have you actually tried import using this model? It works when I try. Yes, the example seems strange... but it should still work. So what happens when you try?
BTW, you may find that the 'model' may also include the 'make' (it does on my Canon cameras).
-
Use of the place where and having clause
Hi all
I have always a doubt as to the use of HAVING and WHERE clause.
Suppose I have table T1 with a single column C1
CREATE TABLE T1
(C1 VARCHAR2 (1));
who data following INSERT scripts
INSERT INTO T1 VALUES ('A');
INSERT INTO T1 VALUES ('B');
INSERT INTO T1 VALUES('C');
INSERT INTO T1 VALUES ('A');
INSERT INTO T1 VALUES ('B');
INSERT INTO T1 VALUES ('A');
Now I want the result as follows
C1 = COUNT (C1)
==============
B = 2
A = 3
Then out of query 1 and 2, approach who is right?
(1) SELECT C1, COUNT (C1) FROM T1
WHERE C1 <>'C '.
GROUP BY C1
ORDER BY C1 DESC;
(2) SELECT C1, COUNT (C1) FROM T1
GROUP BY C1
SEEN C1 <>'C '.
ORDER BY C1 DESC;
Published by: user13306874 on June 21, 2010 02:36In SQL, it is always better to filter data as soon as possible of the moment.
In your example, the WHERE clause would be right now:SQL> explain plan for 2 select c1,count(c1) 3 from t1 4 where c1 != 'C' 5 group by c1 6* order by c1 desc; Explained. SQL> select * from table(dbms_xplan.display); PLAN_TABLE_OUTPUT ---------------------------------------------------- Plan hash value: 3946799371 ---------------------------------------------------- | Id | Operation | Name | Rows | Bytes | ---------------------------------------------------- | 0 | SELECT STATEMENT | | 5 | 10 | | 1 | SORT GROUP BY | | 5 | 10 | |* 2 | TABLE ACCESS FULL| T1 | 5 | 10 | ---------------------------------------------------- Predicate Information (identified by operation id): 2 - filter("C1"!='C') 18 rows selected. SQL>
As you can see that the filter is applied during the analysis of T1.
Whereas in the case of HAVING:
SQL> explain plan for 2 select c1,count(c1) 3 from t1 4 group by c1 5 having c1 != 'C' 6* order by c1 desc; Explained. SQL> select * from table(dbms_xplan.display); PLAN_TABLE_OUTPUT ---------------------------------------------------- Plan hash value: 3146800528 ---------------------------------------------------- | Id | Operation | Name | Rows | Bytes | ---------------------------------------------------- | 0 | SELECT STATEMENT | | 6 | 12 | |* 1 | FILTER | | | | | 2 | SORT GROUP BY | | 6 | 12 | | 3 | TABLE ACCESS FULL| T1 | 6 | 12 | ---------------------------------------------------- Predicate Information (identified by operation id): 1 - filter("C1"!='C') 18 rows selected. SQL>
The analysis is performed after all groups have been calculated: which was calculated in vain, because it will be further filtered because of the HAVING clause.
In general, I would like to use as a guide: If you do not use aggregate functions in your predicate in the HAVING clause, set this predicate to the WHERE of your query part.
Published by: Toon Koppelaars June 21, 2010 11:54
-
Hello
I am new to oracle db.want to know one simple thing.
How to manipulate the XMLtype and datatype anytype data type?
any link might be useful.
concerninghttp://www.morganslibrary.org/reference/ANYDATA.html
http://www.morganslibrary.org/reference/collections.htmlScroll to the bottom of the two demos
also
https://codesamples.SampleCode.Oracle.com/servlets/tracking/ID/s483 -
Iteration in a model clause...
Hello
I try a few tests using iterations in a clause of simple model...
Here's one of them...select
I just can't justify the cell value to the value of dimension 2 (aka the value 9). Can you help me... ???
key ,
m_1,
itn
from
dual
model
ignore nav
dimension by ( 0 as key )
measures ( 0 as m_1 ,
0 as itn)
rules
upsert
sequential order
iterate (10)
(
m_1[2]=ITERATION_NUMBER
,itn[iteration_number] =iteration_number
)
order by
key
;
The results are ...
KEY M_1 ITN
0 0 0
1 1
2 9 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
Note: I use db 10g v.2
Thank you
SIMHello
sgalaxy wrote:
As a matter of fact I rushed back upward to post this question... (sorry)...
I realized the answer when I put:......m_1[3]=ITERATION_NUMBER ....the result set is the same....!!!!
Really? When I do the same change, in other words, if I change the line that says initially
m_1[2]=ITERATION_NUMBER
TO
m_1[3]=ITERATION_NUMBER
then the following 2 rows are different:
` KEY M_1 ITN ---------- ---------- ---------- ... 2 2 3 9 3
Look at your results and see if the 9 column m_1 is really on the same line.
-
Helps the model clause. Date field in the Dimension
Hello, all.
I'm having a problem with the clause type in my query. In my view, it may be a misunderstanding on my part, but I can't find any documentation that is opposed to the use of the date fields in the dimensions of my model.
Given these data;
I write my SQL like this:LOGDATE SHIFTNAME BUILDING UNIT DOORNUMBER INOUT EVENTCOUNT 2012-02-01 06:00:00 A 1800 R Door 4 Out 14 2012-02-01 06:00:00 A 1800 R Door 4 In 15 2012-02-01 18:00:00 D 1800 R Door 4 Out 17 2012-02-01 18:00:00 D 1800 R Door 4 In 19 2012-02-02 06:00:00 A 1800 R Door 4 Out 14 2012-02-02 06:00:00 A 1800 R Door 4 In 14 ...
And I get the expected result. (The same table as above) But when I try to add rows using rules, I get no new line until the LOGDATE field is a date. For example, by using this code, I expect to get a new line, with a 100 EVENTCOUNT (and other fields as written) but I stiill get the same set of data (no line is added)SELECT logdate, shiftname, building, unit, doornumber, inout, eventcount FROM door_events WHERE building='1800' AND unit='R' AND doornumber=4 MODEL DIMENSION BY (logdate, shiftname, building, unit, doornumber, inout) MEASURES (eventcount) RULES ()
However, when I turn the LOGDATE field in a CHAR data type (and make the SYSDATE a TANK in the same way) with the code below, all of a sudden I get the line I was expecting!SELECT logdate, shiftname, building, unit, doornumber, inout, eventcount FROM door_events WHERE building='1800' AND unit='R' AND doornumber=4 MODEL DIMENSION BY (logdate, shiftname, building, unit, doornumber, inout) MEASURES (eventcount) RULES (eventcount[SYSDATE,'X','1800','R',4,'In'=100)
Can someone explain this behavior? I intend to do some calculations on the LOGDATE dimension and I would like to keep it as a date. Thanks in advance for any help!SELECT TO_CHAR(logdate,'YYYY-MM-DD HH24:MI:SS') logdate, shiftname, building, unit, doornumber, inout, eventcount FROM door_events WHERE building='1800' AND unit='R' AND doornumber=4 MODEL DIMENSION BY (logdate, shiftname, building, unit, doornumber, inout) MEASURES (eventcount) RULES (eventcount[TO_CHAR(SYSDATE,'YYYY-MM-DD HH24:MI:SS'),'X','1800','R',4,'In'=100) LOGDATE SHIFTNAME BUILDING UNIT DOORNUMBER INOUT EVENTCOUNT 2012-02-01 06:00:00 A 1800 R Door 4 Out 14 2012-02-01 06:00:00 A 1800 R Door 4 In 15 2012-02-01 18:00:00 D 1800 R Door 4 Out 17 2012-02-01 18:00:00 D 1800 R Door 4 In 19 2012-02-02 06:00:00 A 1800 R Door 4 Out 14 2012-02-02 06:00:00 A 1800 R Door 4 In 14 ... 2012-02-07 15:18:33 X 1800 R Door 4 In 100
I do not get the same result. When I use SYSDATE, I don't get the extra line. When I use TO_CHAR (SYDATE...) as you say, I still don't get the extra line.
However, when I use a constant date, such as TO_DATE (' 2012/02/07 02:00 ',' YYYY-MM-DD HH24:MI:SS'), then I get the extra line.
This behavior is described in http://docs.oracle.com/cd/E11882_01/server.112/e25554/sqlmodel.htm#BEIGGGFJ
«Using UPSERT creates a new cell corresponding to that referenced on the left-hand side of the rule when the cell is absent, and the cell reference contains only positional references * qualified constants *.»
Best regards, stew Ashton
P.S. "Oracle Database 11g Enterprise Edition Release 11.2.0.2.0.
Published by: stew Ashton on 7 February 2012 23:03
-
table problem model clause / dual?
Hi all, just experiment with the model using clause:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - Production
this:
works very wellwith t as (select 1 num, 1 lvl from dual) select num, f1 from t MODEL dimension by (lvl) measures (num f1, num f2) rules iterate(3) (f1[any] = f1[cv()] + f2[cv()]);
this:
results inwith t as (select 1 num, 1 lvl from dual connect by level <= 1) select num, f1 from t MODEL dimension by (lvl) measures (num f1, num f2) rules iterate(3) (f1[any] = f1[cv()] + f2[cv()]);
What is going on?ORA-32614: illegal MODEL SELECT expression 32614. 00000 - "illegal MODEL SELECT expression" *Cause: An expression other than MODEL aliases, constants, or expressions of the two is specified in the MODEL SELECT clause. *Action: Reformulate the query, perhaps nesting inside another SELECT. Error at Line: 2 Column: 7
Hello
In fact, the first query should have failed with the same error because the Digital projection is not defined anywhere in the TYPE clause (it defines only LVL, F1 and F2).
But what happens here is that the subquery of the DOUBLE is merged into the main and constant query are used instead.
This is confirmed by a 10053 trace:Final query after transformations:******* UNPARSED QUERY IS ******* SELECT 1 "NUM","F1" "F1" FROM "SYS"."DUAL" "DUAL" MODEL DIMENSION BY (1 "LVL") MEASURES (1 "F1",1 "F2") UNIQUE DIMENSION RULES UPSERT ITERATE (3)( UPDATE "F1"["LVL"IS ANY]=("F1"[( CURRENTV("LVL"))])+("F2"[( CURRENTV("LVL"))]))
(formatted)
Maybe you are looking for
-
Messages are / were stored apparently buried somewhere in the folder program files - I want to that they stored in my documents where they can regularly and easily be saved. I thought it was the base of messages probably wasn't, but where is it? And
-
I use a Time Capsule as storage for Time Machine backups. After a frost, my 2008 iMac is started directly with OS X Utilities and asking me to choose amongst, among other options, backup restore Time Machine. When I chose it, I get as far as being ab
-
Hi all I'll have a go at making my own filter without having to use the Express filter screw I ran into trouble when using IIR filter VI and specifying the features of filtering. The entry node 'IIR filtering Specification' requires a set of data, an
-
Selection of headphones and Audio Hi-Res
Depending on the setting of the sound, we can specify what model of Sony headphones that we use, but options are limited as below; General MDR-N31E / NC31EM MH1C MH410 MH750 MHEX300AP STH-30 There are no options for the frame high-end/balanced headph
-
help unable to download flashplayer
Download Flash Player cannot all tried can someone help please