Question of model clause

Hello

I was looking oracle documentation but can't find a clear answer. Question under works properly - existing lines are updated, no new documents created.
With T as (
     Select 1 As Person_Id, 'Andrew' As Person_Name, 'HR' As Department From Dual union all
        Select 2 As Person_Id, 'John' As Person_Name, 'SALES' As Department From Dual     
)
Select Person_Id, Department, Person_Name, Salary
From T
Model          
     Dimension By (Person_id)
     Measures (Department, Person_Name, Cast(null As number) Salary)
     Rules upsert(         
          Salary [1] = 5000,
          Salary [2] = 7000       
     )
Order By Person_id;
The same query when person_id is changed to digital text form rather than update the existing lines, creates new ones.

With T as (
     Select '1' As Person_Id, 'Andrew' As Person_Name, 'HR' As Department From Dual union all
        Select '2' As Person_Id, 'John' As Person_Name, 'SALES' As Department From Dual     
)
Select Person_Id, Department, Person_Name, Salary
From T
Model          
     Dimension By (Person_id)
     Measures (Department, Person_Name, Cast(null As number) Salary)
     Rules upsert(         
          Salary ['1'] = 5000,
          Salary ['2'] = 7000       
     )
Order By Person_id;
The only remedy is to throw the person_id as varchar2. Below query works correctly again (without new records created).

With T as (
     Select cast('1' as varchar2(1)) As Person_Id, 'Andrew' As Person_Name, 'HR' As Department From Dual union all
        Select cast('2' as varchar2(1)) As Person_Id, 'John' As Person_Name, 'SALES' As Department From Dual     
)
Select Person_Id, Department, Person_Name, Salary
From T
Model          
     Dimension By (Person_id)
     Measures (Department, Person_Name, Cast(null As number) Salary)
     Rules upsert(         
          Salary ['2'] = 5000,
          Salary ['1'] = 7000       
     )
Order By Person_id;
If anyone knows the reason for this behavior, please let me know.

Thanks in advance

MJ

Given that this has worked properly for me in the same version, can guess us maybe it could be something like a settiing parameter.
For example, something like OPTIMIZER cursor_sharing, query_rewrite_enabled or query_rewrite_expression?

Tags: Database

Similar Questions

  • example of model clause

    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 documentation

    If 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...

  • 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
      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
    I just can't justify the cell value to the value of dimension 2 (aka the value 9). Can you help me... ???

    Note: I use db 10g v.2
    Thank you
    SIM

    Hello

    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.

  • Using advanced MODEL clause

    I have a fairly complex series of calculations that my client wants done. I decided to use the TYPE clause as this data between the rows.

    Essentially, I need data as

    NAME of CC by year_ DT Meas value
    6K 29 300010 11 2008 1 1 12
    6K 29 300007 5 2008 1 1 1
    6K 29 300049 6 2008 1 1 300.58
    6K 29 300119 9 2008 1 1 - 120.67
    6K 29 300022 2 2008 1-1 - 53098.25
    6K 29 300008 2 2008 1 1 390.59
    6K 29 110310 3 2009 1 1 0
    6K 29 115020 5 2009 1 1 199.04
    6K 29 300022 2 2009 1-1 - 77706.88
    6K 29 300003 6 2009 1 1 23.90
    6K 29 300010 11 2009 1 1 10
    6K 29 300035 10 2009 1 1 0

    And turn them into
    NAME of CC by year_ DT Meas value
    6K 29 300010 11 2008 1 1 12
    6K 29 300007 5 2008 1 1 1
    6K 29 300049 6 2008 1 1 300.58
    6K 29 300119 9 2008 1 1 - 120.97
    6K 29 300022 2 2008 1-1 - 53098.25
    6K 29 300008 2 2008 1 1 390.59
    6K 29 110310 3 2009 1 1 0
    6K 29 115020 5 2009 1 1 199.04
    6K 29 300007 5 2009 1 1-1
    6K 29 300022 2 2009 1-1 - 77706.88
    6K 29 300003 6 2009 1 1 23.90
    6K 29 300049 6 2009 1 1 - 300.58
    6K 29 300010 11 2009 1 1 10
    6K 29 300035 10 2009 1 1 0
    6K 29 300119 9 2009 1 1 120.67
    6K 29 300008 2 2009 1 1 390.59

    As you can see there are now additional lines in 2009. I would then perform a calculation
    2008 2009. who is Annul_val = 2009_value - (2008_value(PER=13)/13). -which is why
    I want to use the TYPE clause.

    My problem is the new lines in 2009 (or for that matter, 2010, 2011 and so forth). This is just a small sample of the lines of 2 M table. So far I was only able to use a full as outer join...


    Select nvl (cc, T2, T1, cc) CC... nvl (T1.value, t2.value) of
    Join data complete external T1 T2 data on
    T1. CC = T2. CC and... T1.year_ = T2. Year-1 and T1.meas = T2.meas

    and then she sucks in the clause type... like this

    Select CC, name, per, year_, dt, soul, nval value of
    (select nvl (cc, T2, T1, cc) CC... nvl (T1.value, t2.value) of)
    Join data complete external T1 T2 data on
    T1. CC = T2. CC and... T1.year_ = T2. Year - 1 and T1.meas = T2.meas)
    model
    partition (CC, NAME, SOUL)
    dimension of (year_, by, dt)
    measures (val, nval 0 value) ignore nav
    rules)
    nVal [everything, everything, 1] = val [cv (year_), cv (period_id), 1]-(val [cv (year_)-1, 13, 1] / 13)
    );

    My question is how can I get the lines of a year in order to operate in the following years. While in this space of lines "fill" example 2008 2009, 2010 so on until 2015. And as for 2009 and other years. Is this possible with TEMPLATE rules? It does not seem possible from what I've read, but then I'm not a guru.

    Can it be done with analytical queries. My only other possibility I can think of is function in pipeline.

    Thanks, for any questions do not hesitate to ask...

    SAL

    chameeya S S wrote:
    Quite a nice solution.

    Indeed, but with two table scans... :-)

    Kind regards
    Rob.

  • 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_NUMBATCH_IDMEMBER_IDMBR_COB_SFXCLAIM_NBRCLAIM_SFXDOCTOR_NBRDOCTOR_PFXDOCTOR_SFXPRINT_DATEDOC_TYPECLAIM_OUTPUTCRTD_DTCRTD_BYCOPY_TOGRP_IDCOPY_TO_1
    18012015072015ABCDEF12306177366720 JULY 15EOB(XMLTYPE)GRP_NBRCOPY OF PROVIDER
    18022015072015ABCDEF12306177366720 JULY 15EOB(XMLTYPE)GRP_NBRMEMBER 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_NUMMBR_IDCOPY_TO
    1801ABCDEF123
    1802ABCDEF123

    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.

  • Question of WHERE Clause.

    All, I was just doing some checking at random and came across the following query

    SELECT * FROM emp WHERE +empno > 0;
    

    My question is that oracle runs the query above without any error. What is the use of such expressions in where clause and why the compiler does not throw error for these?

    I've never met such scenario. Just tried your query and it works. The reason is below.

    Look at what makes this request.

    SELECT - empno FROM emp;

    OUTPUT:

    -EMPNO
    ----------
    -7369
    -7499
    -7521
    -7566
    -7654
    -7698
    -7782
    -7788
    -7839
    -7844
    -7876

    -EMPNO
    ----------
    -7900
    -7902
    -7934

    14 selected lines.

    So you might see if you add a minus sign before the name of the column, it converts only for negative values.

    So, even if you add a sign "+", since these are positive values (> 0), your condition succeeds and gives the result. See what would happen if you used - empno in which your condition.

    SQL > SELECT * FROM emp WHERE empno - > 0;

    OUTPUT:

    no selected line

    Hope you clear how it works.

  • 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;
    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
    ...
    I write my SQL like this:
    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 ()
    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 (eventcount[SYSDATE,'X','1800','R',4,'In'=100)
    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 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
    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!

    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:
    with 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()]);
    works very well

    this:
    with 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()]);
                  
    results in
    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
    What is going on?

    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)

  • Difficult question: keep model of FTP files

    First of all, I want to say hello to anyone reading this thread, I'm new to the forum and I hope to help as much as I can in getting the help I need!

    With that issue aside, here is my problem.

    I took during the development of a corporate Web site and have just learned that the previous developer had very little to transfer through.  I could catch pretty well everything what I needed once I had FTP access.  However, I can't locate or get their hands on the model files used to create the site.

    The site was created in goLive, which I don't think there is more.  I see the template file used on all htm pages, but I can't find the file anywhere on the server.

    I was under the assumption that you need the templates on the server, perhaps that this was not the case in the days of goLive?

    The only thing I noticed COULD be the reason why they are not required is all pages (htm file) use the full coding of the template at the top of the page (in the footer). It's grayed out and not editable, but it seems to compile.

    My questions are,

    (1) someone can enlighten me on this question (should I look elsewhere for model files)?

    (2) would be bad practice if I took one of the pages, it detaches the model, deleted content then produced a model from this file?

    Sorry if my problem is confused, I tried to explain it the best I can!

    Thanks for reading and look forward to your response,.

    Robbeh

    Hi Robbeh,

    1. Template files (DWT) are only required in the production environment, no need to be online
    2. It's not bad practice in this case, in fact, this is the recommended method.

    GRAMPS

  • I have question for models

    Bit of a rookie. I do not know if I go about it the correct way.  Any advice is all just great.

    I created a html Web page.  I used a lot of div and css to manipulate the content, images, and videos and position them correctly in my Web page.

    I need now about 4 other pages to clone the original.  I want the images and video to be modified on an individual basis, but I need the posts of css, menus and such update (sorry I don't know the right word) like a domino effect.  If I put on the page of the model, they are all up to date.

    I saved the original .html as model page and selected from all regions should I make can be changed on individual basis.

    However, I have a base level div that has a background image associated with it.  I want it to be a change 'domino '.  I want that it appears in each version based on a model of the original and remain the same as the original.  However, when I apply the model to an empty HTML page, the image not placed in the new Web page.  Everything else is OK.  The div and CSS seem good but not images.

    I chose not as an editable region.

    What I forget?

    I hope that all the senses.


    Thanks for any help in advance.

    -Drew

    If I create a Web page locally on my machine, DW keeps local address until I publish.

    No - is not correct.  If you make a Web page locally, DW written the correct path to the file target at the moment you save the new file in the site - at this stage DW can know what this track must be.  All files in your site MUST have one of the three types of links they contain-

    1. the parent document (that is, the path starts with the current location of the file)

    2. relative root (that is, the path starts at the root of the site)

    3. absolute (i.e. the path is a full URI)

    If you see a file:/// path in any link, then you have a problem.

    To make a model, you can use any workflow you want, but it should be generally A) create a new page, B) to build the base layout on the page and C) save the page as a template.  Having done this, you can then lay in the editable regions and resave before you start generating pages of your child.

    Then I have to create a model of a Web page that is already published?

    If you follow my previous reviews, you will know that the answer here is NOT (there are no value to a model published in any case).

    Is there a setting inside DW to DW to change all directories to be parent instead of local once published?

    N ° although you could build a search and replace that would do this for you (only if you changed links of root, however).

    I have about 10 pages child html which are all based on the parent template.  I was hoping that all THE items on the parent page would affect the child pages, if I so wish. I was hoping that if I add or remove images, css, html, video, flash of the parent and all the child pages would be updated as well (as far as these articles are editable

    Here, you are completely wrong.  The concept that escapes you is the following:

    EVERYTHING on a template page is editable.  Only the changes in the regions NON MODIFIABLES models will be spread child pages.  If such was not the case, you might have never contained unique on a page of the child!  Make sure you understand this before your work is further.

    The question that I am running is that the parent page works fine.  However, when I publish the child pages remain local directories...

    It is a problem with your site definition.  DW is the thought that your children pages are NOT in the folder root of your site.

  • Sony NEX raster question noise model

    I me in treatment of some files today and noticed the bottom half tone / model of armour in an area of my image.  I treated the same file in Sony Image Data Converter and the question isn't here then this is definitely an issue unique to Adobe raw converter.  Seems if poster only this transitional tonal area very smooth, nowhere else in the file.  It was pretty noticeable at the sight of 50% to get my attention in the first place.  The example linked below is enlarged 200% with the cab on the left and Sony IDC on the right. Seems to be rare because it first I encountered this.  This explanation was given to me by a member not adobe in another forum:

    "There is a setting in camera DNG ACR/LR green channels profiles called"BayerGreenSplit", which tells the engine to tween to wait a small gap between the two and does not build"grid-patterns"like the ones you see here.  For some reason any, that I can't understand, they declined / to zero this parameter for several Sony cameras in the latest version 6.2/3.2. You can set the parameter between 0-5000. This is an arbitrary value, I don't know what it means in fact of a top scientific - except that no difference is '0' and '5000' a very big difference. »

    Is this the cause and this bug will appear in the next version of ACR and Lightroom? The file is not underexposed or extremely manipulated.

    Larger version here, is to cut and paste into the browser to see the whole picture as it appears at 200%: http://www.gibranstudio.com/adobenex.jpg

    Below the embedded version is what image culture looks like 100% on screen when clicked:

    adobenex.jpeg

    Known problem with the NEX and ACR/Lightroom.

    Unfortunately, STC profiles have BayerGreenSplit in them, so you can't set this way.

    However, until Adobe fix it, there is a solution for the model of labyrinth, if you don't mind some extra steps to your workflow: http://sites.google.com/site/cornerfix/using-cornerfix/maze-patterns-1

    The PCF file '500' seems to work on the images of NEX, I tried.

    Sandy

  • Yet another question of model

    Recently, my model started inserting his own repertoire of all the URLs in the site when I update the pages, so:

    href = "site/index.htm"

    became:

    href="site/templates/index.htm".

    The links in the site are enterred like this:

    href = "Stories.htm"

    For a page that is located in the directory of the site. The model transformed into:

    href = ' templates/Stories.htm'

    This just started happening. Before that, there was no problem. No idea why this happens and what to do about it?
    Of course, none of the work of the image or the links of the CBC.

    Help

    -Kenoli

    Thanks for your quick response. I'm helping a friend here and what threw me was that it works and then suddenly wasn't. Of course, I don't know what she could do to cause that, even if she is not conscious of having anything other than make a small change and update related files to the model. I discovered that inserting a "... / ' from each link solved the problem. Here are answers to your questions:

    > Are these pages * in * the Templates folder?

    NO.

    > Are you put these links of coding, or by searching for the target files?

    I don't know, but try the method browse inserts the "... / 'syntax in front of the link." (should have tried it immediately)

    > Can we see your template page?

    I think this is resolved, so...

    > DW did only what you tell it to do...

    Gotcha, although, as in life, sometimes we don't know exactly what we said.

    Thank you

    -Kenoli

  • question of model creation / insertion

    Hi, I set up an online store (this is the test page - http://www.drcelly.com/6100manual ) and I use a program to create it. It is quite nice, its good for people who don't know much about php / asp, in fact you have even know HTML. It is not as good as the most advanced programs, but it does not work for me (its called cart system 4.0). The program requests a product title, then you press a button and it displays the description box that allows you to enter text in (it has formatting of options to change the font size, bold, different fonts, ect) and also has a box of "html mode" so you can see how the text is formatted. By default, when you type text in the program inserts two tags, < P align = left > your_text < /P > (two tags).

    The items in the store have the same description, just under different categories (I sell mobile phone parts - what I mean by they the same description is the LG vx6100 phone and the Samsung a610 will have the same description - "this antenna has a screw on base...) ' ect... so the only difference is going to be the image and the title (which are separate fields of the description of the category).

    So I was wondering is if I can create a model called "antennas", e.g. in Dreamweaver and the value of all the pages of my antenna to display this text. A possible solution is to make the text in the description of the image - and in the description of each page of the antenna, I can say to insert this image (antenna.gif for example). In this way, if I ever want to change the description of all antennas, I don't have to do it manually all the I can just change an image. Does anyone know if there is a way I can do this - but instead of doing it with a picture, do it with text? If so, I can create a template for each item, and given that 90% of the parts have the same description, it will save me a lot of time. Any advice would be appreciated... PS, here's a screenshot of the editor
    http://img.Photobucket.com/albums/v229/mds33200/Image2-1.jpg

    Can I try to simplify your question?

    Ask yourself if there is a way to create a piece of content that gets
    automatically inserted into all the pages of the site? If so, have you
    investigation includes the use of the side Server?

    --
    Murray - ICQ 71997575
    Adobe Community Expert
    (If you * MUST * write me, don't don't LAUGH when you do!)
    ==================
    http://www.projectseven.com/go - DW FAQs, tutorials & resources
    http://www.dwfaq.com - DW FAQs, tutorials & resources
    ==================

    "mds33200" wrote in message
    News:fghir6$Q48$1@forums. Macromedia.com...
    > Hi, I set up an online store (here is the test page -
    (> http://www.drcelly.com/6100manual ) and I use a program to create it.
    > It
    > is pretty nice, its good for people who don't know much about php / asp,.
    > in
    > you don? t even not to know HTML. It is not as good as the most
    > advanced
    > programs, but it works for me (its called cart system 4.0).
    > The
    > program requests a product title, then you press a button and it evokes
    > the
    > description area that allows you to enter text in (it has formatting
    > options
    (> change the size of police, bold, different fonts, ect) and also has a mode 'html '.
    > box as well
    > you can see how the text is formatted. By default, when you enter the text the
    > program inserts two tags,.

    your_text

    (two tags).
    >
    > The items in the store have the same description, just under different
    > categories (I sell mobile phone parts - what I mean by they the same)
    > description is the LG vx6100 phone and the Samsung a610 will have
    > the
    > same description - "this antenna has a screw in the base..." ' ect... so
    > the
    > only difference is going to be the image and the title (which are
    > separate
    (> fields from the description of the category).
    >
    > So I was wondering if I can create a template called "antennas" for ex.
    > in
    > Dreamweaver and together all my antenna pages to display this text. One
    > possible
    > solution is to make the text in the description of the image - and in the
    > description of each page of the antenna, I can say to insert this image
    > (antenna.gif for example). That way if I ever want to change the
    > description
    > all antennas, I don? t do it manually all the I can just
    > change
    > an image. Does anyone know if there is a way I can do that
    > more
    > to do with an image, do it with text? If so, I can create a model
    > for
    > each element, and given that 90% of the parts will have the same description, it
    > will be
    > save me a lot of time. Any advice would be appreciated... PS here's a
    > screen
    > the editor call
    > http://img.photobucket.com/albums/v229/mds33200/Image2-1.jpg
    >

  • model clause [10gr 2]

    I'm trying to rotate the EMP organization:

    Select (level 1, 2, level3, level4
    SELECT "nom_org" Organization, LEVEL AS org_level, ename
    WCP
    CONNECT BY PRIOR empno = mgr
    START WITH ename = 'KING')
    model
    to return the rows updated
    partition (Organization)
    dimension (org_level)
    measures (lpad (' ', 10) level1, lpad (' ', 10) level2, lpad (' ', 10) level3, lpad (' ', 10) level4)
    update rules
    (level 1 [0] = ename [1],)
    level 2 [0] = ename [2],
    Level3 [0] = ename [3],
    Level4 [0] = ename [4].
    )

    But something is wrong with the type clause... It is not the ename column.

    Any suggestions?

    Ename be a measure to be treated as a cell in the column. Note also that level uniquely identifies each measure.
    Not sure I understand your needs correctly, but:

    SQL> select organisation, level1,level2,level3,level4 from (
      2  SELECT 'org_name' AS organisation, LEVEL AS org_level, ename
      3  FROM emp
      4  CONNECT BY PRIOR empno = mgr
      5  START WITH ename = 'KING')
      6  model
      7  return updated rows
      8  partition by (organisation)
      9  dimension by (rownum rn)
     10  measures (lpad(' ',10) level1, lpad(' ',10) level2, lpad(' ',10) level3,lpad(' ',10) level4, org_level, ename)
     11  rules update
     12  ( level1[any] = case when org_level[cv()] = 1 then ename [cv()] end,
     13    level2[any] = case when org_level[cv()] = 2 then ename [cv()] end,
     14    level3[any] = case when org_level[cv()] = 3 then ename [cv()] end,
     15    level4[any] = case when org_level[cv()] = 4 then ename [cv()] end
     16  )
     17  ;
    
    ORGANISA LEVEL1     LEVEL2     LEVEL3     LEVEL4
    -------- ---------- ---------- ---------- ----------
    org_name KING
    org_name            JONES
    org_name                       SCOTT
    org_name                                  ADAMS
    org_name                       FORD
    org_name                                  SMITH
    org_name            BLAKE
    org_name                       ALLEN
    org_name                       WARD
    org_name                       MARTIN
    org_name                       TURNER
    org_name                       JAMES
    org_name            CLARK
    org_name                       MILLER
    
    14 rows selected.
    

    Kind regards
    Dima

  • ASA question routing models!

    Hello!

    I have a question about the routing function in ASA 5500. Scenario: the asa (inside int 192.168.1.1) is in default gateway for all inside nodes. We also have another network (192.168.2.0) inside, the asa route traffic to the net via only inside interface (192.168.1.1) can I know the pix dose NOT load this routing scenario, the asa will do?

    Cordially /Jonny

    Hi Jonny,

    It clarifies your question? If so, close the post, which may be useful to others.

    Concerning

    REDA

Maybe you are looking for