Date_format and order by date problem

Hi,
I have a problem with taking the resultset as sorted by date.
example1:
SELECT
T.foreign_network_id as "Network ID",
                         date_format(T.ARRIVAL_DATE,'%d-%m-%Y') as "Date",
                    sum(case when((networks_rejected = 0)
                                   and (T.sor_reapply = 'N')
                                   and (T.sor_reason in ('NP', 'NU', 'NT', 'HT')))
                                   then T.CNT else 0 end) as "Before Steering",
               sum(case when(sor_reason in ('NP', 'HT', 'T2', 'TM', 'NM', 'MM', 'IPMM', 'NPMM'))
                              then T.CNT else 0 end) as "After Steering"
          FROM     ST_INC T,
                    NETWORKS N,
                    ZONE_NW_MAP ZN,
                    ZONES Z,
                    PAYMENT_TYPE PT
          WHERE      T.FOREIGN_NETWORK_ID = N.NETWORK_ID
          AND      ZN.NETWORK_ID = N.NETWORK_ID
          AND      Z.ZONE_ID = ZN.ZONE_ID
          AND      PT.id = T.ptype
          AND opcode = 2
          AND      sor_action is not null
                         and Z.ZONE_ID = 269
               group by
                         date_format(T.ARRIVAL_DATE,'%d-%m-%Y'),
T.foreign_network_id
order by      date_format(T.ARRIVAL_DATE,'%d-%m-%Y')
There is no problem with example 1 however it sorts the result set as if the date field is a string. I know this should be because I use date_format with order by. When I delete and only use T.ARRIVAL_DATE, I get "not a group by expression" error. And the reason why I use date_format is that sometimes I want to retrieve different format such as '%m-%Y' or only '%Y'. So I am required to use date_format, but then I lose the chance to sort by the actual date. I tried to select "T.ARRIVAL_DATE" as another extra colum and sort with respect to that. But this time I lost tha chance to select it again in the date_format function. Can anybody help me, I am messed up here?
Edited by: user13378594 on Aug 26, 2010 3:00 PM

user11268895 wrote:
... you are in an PL/SQL forum not in a mysql forum.
if you want we can translate your query in a Oracle DB query...Well... MySql is an Oracle Database...
to the op:
If you want to order then you need an ORDER BY clause at the end of your statement.
Instead of date_format you can use TO_DATE if dealing if strings. If it is a datatype date, then there is no need of a conversion.
group by T.ARRIVAL_DATE, T.foreign_network_id
order by t.arrival_date descyou could also group on the day or the month if that is what you want.
day groups
select trunc(T.ARRIVAL_DATE), ...
group by trunc(T.ARRIVAL_DATE), T.foreign_network_id
order by trunc(T.ARRIVAL_DATE) desc;
month groups
select trunc(T.ARRIVAL_DATE,'mm'), ...
group by trunc(T.ARRIVAL_DATE,'mm'), T.foreign_network_id
order by trunc(T.ARRIVAL_DATE,'mm') desc;
boy groups
select trunc(T.ARRIVAL_DATE,'boy'), ...
group by trunc(T.ARRIVAL_DATE,'boy'), T.foreign_network_id
order by trunc(T.ARRIVAL_DATE,'boy') desc;
/* Ok, ignore the last one, I was just testing if you read until the end. */ Edited by: Sven W. on Aug 26, 2010 2:25 PM

Similar Messages

  • Invoice and Order Entry Data!!!

    Hi All,
    Can anyone please let me know the data sources for Invoice and Order Entry Data (SD).
    Please provide any link related to the same.
    Your help will be appreciated.
    Thanks in Advance,
    Regards,
    Amit.

    hi,
    For Invoice veriifcation you can use 2LIS_06_INV and for Sales order related data source you can use 2LIS_13_VDHDR,2LIS_13_VDITM and 2LIS_13_VDKON.
    Also you can get more details on below link
    http://help.sap.com/saphelp_nw70/helpdata/en/17/cd5e407aa4c44ce10000000a1550b0/frameset.htm
    Regards,
    Amol

  • A Full DTP is converted into delta DTP and facing some data problem

    Recently Full DTP(DSO to DSO) is converted into delta DTP , we are facing some data problem in first request.Some data in D2 are not updated properly after just converted in full to delta. Please let me know if you have any idea.
    Example :
    DSO : D1
    DSO : D2
    Previously FULL DTP D1->D2
    Now Delta DTP D1->D2

    Hi,
    First time run of delta DTP will extract all the records from the source...
    As u have already run the Full load and followed by delta,i guess u can use direct change log option...
    rgds,

  • Lucene search and order by Date attribute

    Hello,
    We have a requirement where we have to search assets and sort assets via some date attribute (Article Publication Date) using Lucene Search. There is no issue in searching and displaying results in any order we want.
    Problem occurs when some assets don't have "Article Publication Date" value as it is optional and hence, we don't know how the sorting is decided of assets is decided when the output comes after lucene search? Can anyone suggest?
    Regards,
    Guddu

    user11268895 wrote:
    ... you are in an PL/SQL forum not in a mysql forum.
    if you want we can translate your query in a Oracle DB query...Well... MySql is an Oracle Database...
    to the op:
    If you want to order then you need an ORDER BY clause at the end of your statement.
    Instead of date_format you can use TO_DATE if dealing if strings. If it is a datatype date, then there is no need of a conversion.
    group by T.ARRIVAL_DATE, T.foreign_network_id
    order by t.arrival_date descyou could also group on the day or the month if that is what you want.
    day groups
    select trunc(T.ARRIVAL_DATE), ...
    group by trunc(T.ARRIVAL_DATE), T.foreign_network_id
    order by trunc(T.ARRIVAL_DATE) desc;
    month groups
    select trunc(T.ARRIVAL_DATE,'mm'), ...
    group by trunc(T.ARRIVAL_DATE,'mm'), T.foreign_network_id
    order by trunc(T.ARRIVAL_DATE,'mm') desc;
    boy groups
    select trunc(T.ARRIVAL_DATE,'boy'), ...
    group by trunc(T.ARRIVAL_DATE,'boy'), T.foreign_network_id
    order by trunc(T.ARRIVAL_DATE,'boy') desc;
    /* Ok, ignore the last one, I was just testing if you read until the end. */ Edited by: Sven W. on Aug 26, 2010 2:25 PM

  • Order Start date

    Hi
    I am facing issue with order start date.
    I have created a process order and finish date as 30/06/2011. Scheduling is Forward in Time.
    When i do partial confirmation of order on 22/06/2011 in production system, Order start date gets changed to 22/06/2011 and order finish date remains same.
    Whereas in Quality system, When i do partial confirmation of order on 22/06/2011, Order start date and order finish date remains same as 30/06/2011.
    Please confirm how the standard process should work.
    Why order start date is getting changed on partial confirmation in production system
    Regards
    Sachin

    Sachin,
    This is normal  standard behaviour
    Normally when production order confirmation is posted in advance to order start date, actual order start date does not change until Manula / Automatic Scheduling is switched on.
    You can go to the client where it is working correctly and manually reschedule the order in CO02 and check, order dates will get changed.
    So somehow in your case Automatic Scheduling is happning and hence order dates are getting changed automatically.
    Automatic Scheduling Flag in OPU3 does not directly trigger CO02 change in order dates. Please check if mnaul scheduling is getting triggered in your case or some background job of COHV is running for order scheduling.
    Check and revert,
    Santosh Sarda

  • Time series and Order series questions

    Hi Guys - Need some help in understanding/Visualizing some basic APO concepts. I do not want to move further without understanding these concepts completely. I did read sap help and couple of apo books but none gave me a complete understanding of this very basic concept.
    1. Data is stored in livecache in 3 different ways. time series, order series and atp time series. for now I am concentrating on just time series and order series. Can some one help me understand with an example how data is stored in time series and how it is stored in order series? I read that data which is not order related is called time series data and which is order related is called order series data.
    My query is even in DP time series data, data is stored with respect to product and location that is transferred to snp. In SNP too data is processed with respect to product and location. so what is the difference in time series data and order series data?
    2. what are time series key figures and what are order series key figures? I read safety stock for example is a time series keyfigure. why is it not a order series key figure? what makes a keyfigure time series or order series? can some one xplain this in detail with an example or numbers?
    3. there is a stock category group in snp tab of location master LOC3. Stock category should be product related right? how is this related to location and what does this field mean in location master
    Thanks a lot for your help in advance. Please let me know if I am not clear in any of the questions.

    Hi,
    Time series:  Data is stored in buckets with no reference to orders.( If you place the mouse on time series data and right click for
                         display details , you will not find any information.
                          Suitable for tactical planing and aggregated planning. Usually in demand planning.
    Pre requisite: 1. You need to create time series objects for the planning area.
                           2. When creating planning area you should not make any entries for the Key figure in the field Info Cube, category
                               and  category group.
                           3. When creating planning area any entry you made in the field Key figure semantics with prefixed with TS.
                               (Optional entry)
    Order series: Data is stored in buckets with reference to orders.( If you place the cursor on the order series data and right click
                          the mouse for display details , you will find information of order details.)
                         Useful for operative planning.
                         *You will have real time integration with R3.
    Pre requisite: 1. You need to create time series objects for the planning area.( though you are creating Order series)
                          2.When creating a planning area specify a category or category group or enter a key figure semantics with prefix
                            LC.
                         3. When creating planning area you should not make an entry for the key figure in the field Info cube.
    Thanks,
    nandha

  • Planned Order delivery date

    When you run MS04/MS05 and system throws out the Planned order with the order start and order finish date. Can you tell me from how system calculates this order start and order finish dates??

    hi,
    I agreee with you...the source list is just checked for the validation of the periods...
    As per my knowledge the periods are calculated based on the RLT(replenishment lead time)...ie. the total time from Planned del. time + GR processing time + Purchasing processing time...
    Also sometimes if req. you can also take safety stock days ie. the days for which the extra stock is used in case of late deliveries...
    Hope it answers your query...
    Regards
    Priyanka.P

  • Refresh package with 'From-Date' Problem

    Hi All,
    I just ran into configuring the Analyze and Specify 'From-Date' problem fro refreshing package.   I've completed the normal package with the starting date 8/30/2008.  Now I am trying to go back and copy and select from 7/30/2008 for the new run during that posting period.  I am not if this is possible but it doesn't allow me to choose any of the option.  If I choose Analyse and deine new 'From-Date' when the screen popup, then choose 7/30, the date is not transfer to the Chosen From Date field at all, and execute.  The system will display he error with  "Evaluation failed. Required customising data no available".  Basically, it doesn't allow me to choose any date.
    Do any of you experiencing the same problem.  Or did I miss any step from the first run?
    Thanks,
    Tai

    Hi Tai,
    Implement the note 1180500 - Activity TD01P_FROM_RFH runs into error in a refresh package.
    Regards,
    Santosh

  • Date_format, group by and order by together

    Hi,
    SELECT
                             T.foreign_network_id as "Network ID",
                             date_format(T.ARRIVAL_DATE,'%v-%x') as "Date",
                        sum(case when((networks_rejected = 0)
                                       and (T.sor_reapply = 'N')
                                       and (T.sor_reason in ('NP', 'NU', 'NT', 'HT')))
                                       then T.CNT else 0 end) as "Before Steering",
                   sum(case when(sor_reason in ('NP', 'HT', 'T2', 'TM', 'NM', 'MM', 'IPMM', 'NPMM'))
                                  then T.CNT else 0 end) as "After Steering"
              FROM     ST_INC T,
                        NETWORKS N,
                        ZONE_NW_MAP ZN,
                        ZONES Z,
                        PAYMENT_TYPE PT
              WHERE      T.FOREIGN_NETWORK_ID = N.NETWORK_ID
              AND      ZN.NETWORK_ID = N.NETWORK_ID
              AND      Z.ZONE_ID = ZN.ZONE_ID
              AND      PT.id = T.ptype
              AND opcode = 2
              AND      sor_action is not null
                             and Z.ZONE_ID = 269
                   group by
                             date_format(T.ARRIVAL_DATE,'%v-%x'),
    T.foreign_network_id
    order by date_format(T.ARRIVAL_DATE,'%v-%x')
    Above code works but it orders malfunctionally. It orders as if the week-day combination is a string not a date.
    I want:
    09.2009
    10.2009
    02.2010
    03.2010
    06.2011
    It outputs:
    02.2010
    03.2010
    06.2011
    09.2009
    10.2009
    I know that the problem arises from the "order by" part. When I call the function date_format I guess a different data type is returnd thus the result is not achieved as intended. So I thought of changing that part only making last line order by T.ARRIVAL_DATE. It worked fine in mysql however it gave error in oracle. This is the error:
    ORA-00979: not a GROUP BY expression
    00979. 00000 - "not a GROUP BY expression"
    When I replace all "date_format(T.ARRIVAL_DATE,'%v-%x')" s with "T.ARRIVAL_DATE" it works fine again. However this is not what i wanted. I want to see the results in the format I gave and group with respect to that fomat, additionally ordering them chronologically. How is that possible?

    Frank Kulash wrote:
    Hi,
    baydinfb wrote:
    Hi,
    SELECT
                             T.foreign_network_id as "Network ID",
                             date_format(T.ARRIVAL_DATE,'%v-%x') as "Date",
                        sum(case when((networks_rejected = 0)
                                       and (T.sor_reapply = 'N')
                                       and (T.sor_reason in ('NP', 'NU', 'NT', 'HT')))
                                       then T.CNT else 0 end) as "Before Steering",
                   sum(case when(sor_reason in ('NP', 'HT', 'T2', 'TM', 'NM', 'MM', 'IPMM', 'NPMM'))
                                  then T.CNT else 0 end) as "After Steering"
              FROM     ST_INC T,
                        NETWORKS N,
                        ZONE_NW_MAP ZN,
                        ZONES Z,
                        PAYMENT_TYPE PT
              WHERE      T.FOREIGN_NETWORK_ID = N.NETWORK_ID
              AND      ZN.NETWORK_ID = N.NETWORK_ID
              AND      Z.ZONE_ID = ZN.ZONE_ID
              AND      PT.id = T.ptype
              AND opcode = 2
              AND      sor_action is not null
                             and Z.ZONE_ID = 269
                   group by
                             date_format(T.ARRIVAL_DATE,'%v-%x'),
    T.foreign_network_id
    order by date_format(T.ARRIVAL_DATE,'%v-%x')
    Above code works but it orders malfunctionally. It orders as if the week-day combination is a string not a date. Apparantly, date_format returns a string, similar to how TO_CHAR in Oracle returns a string. To verify this, create a view where one on the columns is the results of date_format, and then describe that view.
    I want:
    09.2009
    10.2009
    02.2010
    03.2010
    06.2011
    It outputs:
    02.2010
    03.2010
    06.2011
    09.2009
    10.2009
    I know that the problem arises from the "order by" part. When I call the function date_format I guess a different data type is returnd thus the result is not achieved as intended. So I thought of changing that part only making last line order by T.ARRIVAL_DATE. It worked fine in mysql however it gave error in oracle. This is the error:
    ORA-00979: not a GROUP BY expression
    00979. 00000 - "not a GROUP BY expression"
    When I replace all "date_format(T.ARRIVAL_DATE,'%v-%x')" s with "T.ARRIVAL_DATE" it works fine again. However this is not what i wanted. I want to see the results in the format I gave and group with respect to that fomat, additionally ordering them chronologically. How is that possible?I don't know about yur database, but in Oracle you can "GROUP BY t.arrival_date", and still use expressions like "TO_CHAR (t.arrival_date, ...)" in the SELECT clause. Then, if you say "ORDER BY t.arrival_date" it will sort by the arrival_date column in the table, even if the alias "arrival_date" is used for something else.
    Using scott.emp to illustrate:
    SELECT       TO_CHAR (e.hiredate, 'fmMonth YYYY')     AS hiredate
    ,       e.hiredate                    AS raw_date
    FROM       scott.emp     e
    GROUP BY  e.hiredate
    ORDER BY  hiredate          -- This means the result set column called "HIREDATE"
    ,       e.hiredate          -- This means the table column called "HIREDATE"
    ;Output:
    HIREDATE                                  RAW_DATE
    April 1981                                02-Apr-1981 00:00:00
    April 1987                                19-Apr-1987 00:00:00
    December 1980                             17-Dec-1980 00:00:00
    December 1981                             03-Dec-1981 00:00:00
    February 1981                             20-Feb-1981 00:00:00
    February 1981                             22-Feb-1981 00:00:00
    January 1982                              23-Jan-1982 00:00:00
    June 1981                                 09-Jun-1981 00:00:00
    May 1981                                  01-May-1981 00:00:00
    May 1987                                  23-May-1987 00:00:00
    November 1981                             17-Nov-1981 00:00:00
    September 1981                            08-Sep-1981 00:00:00
    September 1981                            28-Sep-1981 00:00:00Notice how, within a month (e.g. February 1981) the rows are sorted by DATE.Thanks for the answers, I tried, no errors but there is a problem with the requirements. Correct me if I am wrong.
    I can use the expression with "date_format" or "to_char" in select clause and then group by the actual date field. But this does not include all I want. When I formatted a date column as "week-year" such as 09.2010 I also meant to group by according to that format. In your solution totally same dates are grouped together but I want to be able to have that same weeks(no need to have same days) are grouped or even same months are grouped by and then order by actual date.
    Edited by: baydinfb on Aug 27, 2010 2:13 PM

  • Planned order creation with PDS valid on only order start date and not finish date

    Hi All,
    We have requirement to allow creation of planned order manually if production version is valid on order start date and not finish date.  This is because lead time of order is longer. I refered OSS notes 385602. I could find out solution for this is implementation of OSS note 694140 to change validity mode at activity level to consider start date of first produce activity  in validity interval. Problem is even If I create order in APO by implementiong this note planned order is not transfered to ECC and it gets stuck with error production version not valid.
    Is there any way in ECC to control this? Any config or customization?
    Regards,
    Santosh

    Nilesh,
    I think there is a simple procedural skip happening in your business process. You are right when a planned order is created after MRP it would default assign it to the first available production version. 2options available for us,
    1. First use transaction MF50 and do the line loading and assign the quantites to the production versions/Production lines, so that the actual capacity planning is getting completed. This way you can have planned orders with both the production versions and matching to your actual line capacity.
    2. Use Quota arrangement concept, to automatically split the Planned orders during MRP for a percentage based on individual production versions.
    Now when backflush is performed S225 table is updated and Planned order qty also gets reduced.
    Hope this helps....
    Regards,
    Prasobh

  • Camera Roll - ordered by "Name" and not by "Date".

    My Camera Roll had a problem yesterday and forced itself to be rebuilt. When it came back up I thought a bunch of new images and videos were deleted. I connected my iPhone 4 to Image Capture and found that all the images and videos are still on my phone. However, Camera Roll is now sorting by "Name" and not by "Date" -- Note: These are the columns that are listed in Image Capture.
    Does anyone know how to get the Camera Roll to display images by "Date" again? Thanks for the help!

    Odd yeah, from what I can see there is no way to specify the sort order on the iPhone. Is is possible that the date data became corrupted? Can you grab a screenshot from your computer showing the name / date columns?
    Slightly off topic, but possibly a similar effect to what has happened in this case:
    I know when you transfer files from one hard drive to another, and then try to sort by the "Date Added" attribute, the Date Added becomes the same for all files- the date they were copied to the second hard drive.

  • Process Order Basic Finish Date and Scheduled Finish Date

    Folks,
    I have a requirement from the business to be able to update the Process Order Basic Finish Date and Scheduled Finish Date independently from each other.
    In other words, update the Basic Finish Date and the Scheduled Finish Date cannot change or update the Scheduled Finish Date and the Basic Finish Date cannot change.
    I believe the reason for this is to be able to use the Basic Date to maintain the ATP accurately and keep the Scheduled Date to mark when the order was originally due from the shop floor to be able to measure if orders are being completed on time or late.
    I have worked in tnx OPUZ and had some success with other issues with these dates but I can't seem to make them work independently from each other.
    Or does anyone have any ideas how to measure proces order performance to the production schedule?
    Thank you for your help,
    Greg

    Rajesha, thank you for your reply but it doesn't solve my problem.
    Let me restate my scenario:
    I start a process order and both the basic and scheduled finish dates are the same, June 1.
    At some point, shop floor tells me they will be late and cannot deliver until June 15.
    I need to update a date in the system so the ATP and the MRP planning runs have correct information for promising customers, I will update the Basic Finish date with June 15.
    I also need to keep the original June 1 date in order to measure the shop floor performance to the production schedule to measure how early or late the  order was delivered. How can I keep the original finish date or how can I measure if a process order is early or late??
    Thank you for your help,
    Greg

  • Problem inserting and querying XML data with a recursive XML schema

    Hello,
    I'm facing a problem with querying XML data that is valid against a recursive XML Schema. I have got a table category that stores data as binary XML using Oracle 11g Rel 2 on Windows XP. The XML Schema is the following:
    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:complexType name="bold_type" mixed="true">
              <xs:choice minOccurs="0" maxOccurs="unbounded">
                   <xs:element name="bold" type="bold_type"/>
                   <xs:element name="keyword" type="keyword_type"/>
                   <xs:element name="emph" type="emph_type"/>
              </xs:choice>
         </xs:complexType>
         <xs:complexType name="keyword_type" mixed="true">
              <xs:choice minOccurs="0" maxOccurs="unbounded">
                   <xs:element name="bold" type="bold_type"/>
                   <xs:element name="keyword" type="keyword_type"/>
                   <xs:element name="emph" type="emph_type"/>
                   <xs:element name="plain_text" type="xs:string"/>
              </xs:choice>
         </xs:complexType>
         <xs:complexType name="emph_type" mixed="true">
              <xs:choice minOccurs="0" maxOccurs="unbounded">
                   <xs:element name="bold" type="bold_type"/>
                   <xs:element name="keyword" type="keyword_type"/>
                   <xs:element name="emph" type="emph_type"/>
              </xs:choice>
         </xs:complexType>
         <xs:complexType name="text_type" mixed="true">
              <xs:choice minOccurs="0" maxOccurs="unbounded">
                   <xs:element name="bold" type="bold_type"/>
                   <xs:element name="keyword" type="keyword_type"/>
                   <xs:element name="emph" type="emph_type"/>
              </xs:choice>
         </xs:complexType>
         <xs:complexType name="parlist_type">
              <xs:sequence>
                   <xs:element name="listitem" minOccurs="0" maxOccurs="unbounded" type="listitem_type"/>
              </xs:sequence>
         </xs:complexType>
         <xs:complexType name="listitem_type">
              <xs:choice minOccurs="0" maxOccurs="unbounded">
                   <xs:element name="parlist" type="parlist_type"/>
                   <xs:element name="text" type="text_type"/>
              </xs:choice>
         </xs:complexType>
         <xs:element name="category">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element name="name"/>
                        <xs:element name="description">
                                  <xs:complexType>
                                            <xs:choice>
                                                           <xs:element name="text" type="text_type"/>
                                                           <xs:element name="parlist" type="parlist_type"/>
                                            </xs:choice>
                                  </xs:complexType>
                        </xs:element>
                                                                </xs:sequence>
                                                                <xs:attribute name="id"/>
                                            </xs:complexType>
                        </xs:element>
    </xs:schema>I registered this schema and created the category table. Then I inserted a new row using the code below:
    insert into category_a values
    (XMlElement("category",
          xmlattributes('categoryAAA' as "id"),
          xmlforest ('ma categ' as "name"),
          (xmlelement("description", (xmlelement("text", 'find doors blest now whiles favours carriage tailor spacious senses defect threat ope willow please exeunt truest assembly <keyword> staring travels <bold> balthasar parts attach </bold> enshelter two <emph> inconsiderate ways preventions </emph> preventions clasps better affections comes perish </keyword> lucretia permit street full meddle yond general nature whipp <emph> lowness </emph> grievous pedro')))    
    The row is successfully inserted as witnessed by the results of row counting. However, I cannot extract data from the table. First, I tried using SqlPlus* which hangs up and quits after a while. I then tried to use SQL Developer, but haven't got any result. Here follow some examples of queries and their results in SQL Developer:
    Query 1
    select * from category
    Result : the whole row is returned
    Query 2
    select xmlquery('$p/category/description' passing object_value as "p" returning content) from category
    Result: "SYS.XMLTYPE"
    now I tried to fully respect the nested structure of description element in order to extract the text portion of <bold> using this query
    Query 3
    select  xmlquery('$p/category/description/text/keyword/bold/text()' passing object_value as "p" returning content) from  category_a
    Result: null
    and also tried to extract the text portion of element <text> using this query
    Query 4
    select  xmlquery('$p/category/description/text/text()' passing object_value as "p" returning content) from  category_a
    Result: "SYS.XMLTYPE".
    On the other hand, I noticed, from the result of query 1, that the opening tags of elements keyword and bold are encoded as the less than operator "&lt;". This explains why query 3 returns NULL. However, query 4 should display the text content of <text>, which is not the case.
    My questions are about
    1. How to properly insert the XML data while preserving the tags (especially the opening tag).
    2. How to display the data (the text portion of the main Element or of the nested elements).
    The problem about question 1 is that it is quite unfeasible to write a unique insert statement because the structure of <description> is recursive. In other words, if the structure of <description> was not recursive, it would be possible to embed the elements using the xmlelement function during the insertion.
    In fact, I need to insert the content of <description> from a source table (called category_a) into a target table (+category_b+) automatically .
    I filled category_a using the Saxloader utility from an flat XML file that I have generated from a benchmark. The content of <description> is different from one row to another but it is always valid with regards to the XML Schema. The data is properly inserted as witnessed by the "select * from category_a" instruction (500 row inserted). Besides, the opening tags of the nested elements under <description> are preserved (no "&lt;"). Then I wrote a PL/SQL procedure in which a cursor extracts the category id and category name into varchar2 variables and description into an XMLtype variable from category_a. When I try to insert the values into a category_b, I get the follwing error:
    LSX-00213: only 0 occurrences of particle "text", minimum is 1which tells that the <text> element is absent (actually it is present in the source table).
    So, my third question is why are not the tags recognized during the insertion?
    Can anyone help please?

    Hello,
    indded, I was using an old version of Sqlplus* (8.0.60.0.0) because I had a previous installation (oracle 10g XE). Instead, I used the Sqlplus* shipped with the 11g2database (version 11.2.0.1.0). All the queries that I wrote work fine and display the data correctly.
    I also used the XMLSERIALIZE function and can now display the description content in SQL Developer.
    Thank you very much.
    To answer your question Marco, I registered the XML Schema using the following code
    declare
      doc varchar2(4000) := '<?xml version="1.0" encoding="UTF-8"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:complexType name="bold_type" mixed="true">
              <xs:choice minOccurs="0" maxOccurs="unbounded">
                   <xs:element name="bold" type="bold_type"/>
                   <xs:element name="keyword" type="keyword_type"/>
                   <xs:element name="emph" type="emph_type"/>
              </xs:choice>
         </xs:complexType>
         <xs:complexType name="keyword_type" mixed="true">
              <xs:choice minOccurs="0" maxOccurs="unbounded">
                   <xs:element name="bold" type="bold_type"/>
                   <xs:element name="keyword" type="keyword_type"/>
                   <xs:element name="emph" type="emph_type"/>
                   <xs:element name="plain_text" type="xs:string"/>
              </xs:choice>
         </xs:complexType>
         <xs:complexType name="emph_type" mixed="true">
              <xs:choice minOccurs="0" maxOccurs="unbounded">
                   <xs:element name="bold" type="bold_type"/>
                   <xs:element name="keyword" type="keyword_type"/>
                   <xs:element name="emph" type="emph_type"/>
              </xs:choice>
         </xs:complexType>
         <xs:complexType name="text_type" mixed="true">
              <xs:choice minOccurs="0" maxOccurs="unbounded">
                   <xs:element name="bold" type="bold_type"/>
                   <xs:element name="keyword" type="keyword_type"/>
                   <xs:element name="emph" type="emph_type"/>
              </xs:choice>
         </xs:complexType>
         <xs:complexType name="parlist_type">
              <xs:sequence>
                   <xs:element name="listitem" minOccurs="0" maxOccurs="unbounded" type="listitem_type"/>
              </xs:sequence>
         </xs:complexType>
         <xs:complexType name="listitem_type">
              <xs:choice minOccurs="0" maxOccurs="unbounded">
                   <xs:element name="parlist" type="parlist_type"/>
                   <xs:element name="text" type="text_type"/>
              </xs:choice>
         </xs:complexType>
         <xs:element name="category">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element name="name"/>
                        <xs:element name="description">
                                  <xs:complexType>
                                            <xs:choice>
                                                           <xs:element name="text" type="text_type"/>
                                                           <xs:element name="parlist" type="parlist_type"/>
                                            </xs:choice>
                                  </xs:complexType>
                        </xs:element>
                                                                </xs:sequence>
                                                                <xs:attribute name="id"/>
                                            </xs:complexType>
                        </xs:element>
    </xs:schema>';
    begin
      dbms_xmlschema.registerSchema('/xmldb/category_auction.xsd', doc,     LOCAL      => FALSE, 
            GENTYPES   => FALSE,  GENBEAN    => FALSE,   GENTABLES  => FALSE,
             FORCE      => FALSE,
             OPTIONS    => DBMS_XMLSCHEMA.REGISTER_BINARYXML,
             OWNER      => USER);
    end;then, I created the Category table as follows:
    CREATE TABLE category_a of XMLType XMLTYPE store AS BINARY XML
        XMLSCHEMA "xmldb/category_auction.xsd" ELEMENT "category";Now, there still remains a problem of how to insert the "description" content which I serialized as a CLOB data into another table as XML. To this purpose, I wrote a view over the Category_a table as follows:
    CREATE OR REPLACE FORCE VIEW "AUCTION_XWH"."CATEGORY_V" ("CATEGORY_ID", "CNAME", "DESCRIPTION") AS
      select category_v."CATEGORY_ID",category_v."CNAME",
      XMLSerialize(content ( xmlquery('$p/category/description/*' passing object_value as "p" returning content)) as clob) as "DESCRIPTION"
      from  auction.category_a p, 
    xmltable ('$a/category' passing p.Object_Value as "a"
    columns  category_id varchar2(15) path '@id',
              cname varchar2(20) path 'name') category_v;Then, I wrote a procedure to insert data into the Category_xwh table (the source and target tables are slightly different: the common elements are just copied wereas new elements are created in the target table). The code of the procedure is the following:
    create or replace PROCEDURE I_CATEGORY AS
    v_cname VARCHAR2(30);
    v_description clob ;
    v_category_id VARCHAR2(15);
    cursor mycursor is select category_id, cname, description from category_v;
    BEGIN
    open mycursor;
      loop
      /*retrieving the columns*/
      fetch mycursor into v_category_id, v_cname, v_description ;
      exit when mycursor%notfound;
      insert into category_xwh values
      (XMlElement("category",
          xmlattributes(v_category_id as "category_id"),
          xmlelement("Hierarchies", xmlelement("ObjHierarchy", xmlelement ("H_Cat"),
                                                               xmlelement ("Rollsup",
                                                                                  (xmlelement("all_categories",
                                                                                   xmlattributes('allcategories' as "all_category_id")))
        xmlforest (
                  v_cname as "cat_name",
                  v_description as "description")    
    end loop;
      commit;
      close mycursor;
    END I_CATEGORY;When I execute the procedure, I get the following error:
    LSX-00201: contents of "description" should be elements onlyso, I just wonder if this is because v_description is considered as plain text and not as XML text, even if its content is XML. Do I need to use a special function to cast the CLOB as XML?
    Thanks for your help.
    Doulkifli

  • We are using EBS 12.1.3.  When we input a sales order from a customer we input the sales order and specify the date the customer wants it.  This isn't always the date that we intend on manufacturing it though.  I need to put a customer due date in, but be

    We are using EBS 12.1.3.  When we input a sales order from a customer we input the sales order and specify the date the customer wants it.  This isn't always the date that we intend on manufacturing it though.  I need to put a customer due date in, but be able to put a date in another field that MRP can read in the event we choose to manufacture based on another date.  For example, early.
    Any help would be appreciated.

    What you are experiencing is 100% related to Malware.
    Sometimes a problem with Firefox may be a result of malware installed on your computer, that you may not be aware of.
    You can try these free programs to scan for malware, which work with your existing antivirus software:
    * [http://www.microsoft.com/security/scanner/default.aspx Microsoft Safety Scanner]
    * [http://www.malwarebytes.org/products/malwarebytes_free/ MalwareBytes' Anti-Malware]
    * [http://support.kaspersky.com/faq/?qid=208283363 TDSSKiller - AntiRootkit Utility]
    * [http://www.surfright.nl/en/hitmanpro/ Hitman Pro]
    * [http://www.eset.com/us/online-scanner/ ESET Online Scanner]
    [http://windows.microsoft.com/MSE Microsoft Security Essentials] is a good permanent antivirus for Windows 7/Vista/XP if you don't already have one.
    Further information can be found in the [[Troubleshoot Firefox issues caused by malware]] article.
    Did this fix your problems? Please report back to us!

  • HT201272 My Invoice #**** and Order # **** date: 13/05/2012

    As I'm a new user of Apple Products and its Apps, I made a lots of purchase but i update my Iphone and some of my Purchased Apps is missing after that update. I search for that Apps in Apps store but couldn't find it. Suggest what to do. My Invoice #**** and Order # **** date: 13/05/2012 and most important thing that i paid in Dollars.
    <Edited By Host>

    You are not talking to Apple support but to fellow users.
    It's possible some of the apps are not compatible or no longer available.
    If you can find the invoice click the Report a Problem link or go to:
    https://expresslane.apple.com/
    and raise an issue via itunes store support links.
    AC

Maybe you are looking for