Extract time and compare dates

I would like to know if hh:mm:ss have following value : "00:00:00" but I can't extract those values from the date. I'm not interested in dd/mm/yy but they are included in the string I receive.
set serveroutput on;
declare
str varchar2(30);
dat date;
begin
str := '19/01/2008 00:00:00';
dat := to_date(pepe,'HH24:MI:SS'); -- can't do this because mask do not fit with input string
if dat = '00:00:00' then ....

Sorry there was a copypaste error. This is the problem:
set serveroutput on;
declare
str varchar2(30);
dat date;
begin
str := '19/01/2008 00:00:00';
dat := to_date(str,'HH24:MI:SS'); -- can't do this because mask do not fit with input string
if dat = '00:00:00' then ...
I only want to know how can I detect that hh:mm:ss, coming from a varchar, is equal to "00:00:00".

Similar Messages

  • Time and/or Date incorrect after moving/copying/importing

    This has been going on for years and has messed up hundreds, maybe more, of the time/date on my photos in Aperture.
    If I select my entire photo library (typically preset to 'Date - Ascending') in Aperture, I can find hundreds of photos out of order. When I look at them in 'Info', the time and sometimes date has changed by several hours. I'm not sure if this is an Aperture thing or Mac thing? Over the years I have moved and/or copied photos from smaller HDDs to larger HDDs to eventually a NAS unit and/or from iPhoto to Aperture.
    I have made calls to Tech Support, but they have always made me feel as if I made some mistake on my end or I didn't set the time correctly to begin with (now this could be correct with the P&S I share with my girlfriend, but very rarely with my DSLR). But I also explained that it was random (3 to 5 photos in a set).
    So today as I was trying to update some of my photos, I came across some photos (and videos) I took last year with my iPhone (my iPhone always has the correct time and date or 99.9%). I originally uploaded these to an old iPhoto library I still have (all the dates and times are correct). These same photos and videos (55 over a 3 day period) were moved to my Aperture library some time ago and 3 of the 55 have the incorrect time by -7 hours (ie. 3:30 pm is now 8:30 am).
    Why does this happen?? I have not set any time changes to these photos. If I did, they would all have the wrong time and not just 3 of them would be off.
    Is anyone having this issue and if so, was there a way to get the corrcet time/date from the photo hidden deep down in the EXIF? This is driving me crazy.
    Here are some screen shots of the same photo in iPhoto and Aperture.
    iPhoto 5:28:09 PM - Correct
    Aperture 10:28:09 AM - Incorrect -7 hrs
    TIA if anyone can help. I just don't have the time to go back and try and change all these photos.
    Narvon

    DF
    Thanks for the reply, I will try to post the screenshots again (they still show for me, odd?).
    Anyway, this is not a zoning problem. This is a moving or copying problem.
    The photos I tried to show from the screen shot I took last year at a concert in Coachella (same time zone as my residence in Redondo Beach). The shots were taken using my iPhone which has GPS and constant updating of Time. All the photos and videos show up correctly in Places (GPS) and all the correct times show in iPhoto.
    The issue occurs when the photos are moved to Aperture. Randomly the time has changed to -7 hours on a few photos. This same randomness has occured to hundreds of my photos that I have imported into Aperture over the years. As I said before, Tech Support and everyone else has placed the blame on me within my camera settings or improper importing.
    Now that I use my iPhone more often, I have proof that the settings are correct and that Aperture or Finder or ?? within Apple has changed the Time randomly. Also, if I had 'Accidently' opened the 'Time Zone' brick when importing (as suggested by Tech Support), all the photos would have the incorrect time and not just a few random ones.
    iPhoto original from iPhone - Time 5:28:09 correct
    Aperture photo from iPhoto - Time 10:28:09 incorrect -7 Hrs
    Thanks again,
    Narvon

  • Select Records between Begin Date/Time and End Date/Time

    Hi, I need to select records from table GLPCA where the CPUDT and CPUTM are between a START DATE/TIME and END DATE/TIME. 
    I have the below logic from an SAP Solution, but it doesn't seem to be working right in my opinion.  It is picking up records earlier than the date ranges.  Can anyone tell me how I might be able to accomplish this?  I'm hoping this is an easy one for the ABAPPERs... 
    Thanks,
    START DATE 20091022
    START TIME 125736
    END DATE 20091022
    END TIME 135044
    CPUDT 20091022
    CPUTM 100257
          SELECT * FROM GLPCA
             WHERE ( CPUDT >= STARTDATE AND ( CPUTM >= STARTTIME OR ( CPUDT <= ENDDATE AND CPUTM <= ENDTIME ) ) ).

    Thank you all!  I ended up using the following:
    SELECT * FROM GLPCA
              WHERE RYEAR IN L_R_RYEAR
                AND ( ( CPUDT = STARTDATE AND CPUTM >= STARTTIME ) OR CPUDT > STARTDATE )
                AND ( ( CPUDT = ENDDATE   AND CPUTM <= ENDTIME )   OR CPUDT < ENDDATE ).
    This child was born from the following thread that was found:
    update date and time of client record

  • Time and GPS data windows

    Hello all
    I was presented this sample 1080 frame and was asked if I can do this if time and GPS metadata were part of the video recording. In other words, how do you burn in this data in the video itself. I have P Pro CS 6 @ home and am a complete novice to video editing. Final product may or may not need this, more curious as to how its done - special camera system or in post processing?
    Thanks!

    If whoever shot the video recorded time of day timecode synced from a GPS receiver that was close to the camera (in your case that looks like it would mean mounted in the helicopter), you can use the time code data to match your GPS metadata to the video. I use an automated process to incorporate the the metadata into the video, but the process is all done with custom software that the CEO of our company wrote. The other people I've seen incorporating GPS metadata into video are also using customized, proprietary processes. If you're adding the data in post, you will have to translate the data into Premiere titles or After Effects text keyframes or something else that you can overlay on the video.
    You can also use hardware during your shoot to overlay the GPS data onto the video. I don't use any products that do this, and I don't know how easy they are to find for purchase, but there definitely are people in the geospatial sector who feed video through a GPS-aware piece of video processing hardware that overlays time and position data in real time. In this case you would feed video (most likely through HD-SDI) from your camera to the GPS overlay hardware and then to a recorder.
    There certainly aren't any GPS features built into Premiere Pro. If you want to add titles manually, you'll have to match the time code with your GPS data and make a new title each time the GPS info is supposed to update. GPS data is usually some form of table or spreadsheet with time, coordinates, and other positional data, so you can find the correct time in the video and make a title that includes the corresponding coordinates for that time. If you're doing this for more than a few seconds of video, it will be an unreasonably long and tedious process, but it is possible.

  • UTC Date Time and Normal Date Time

    Hi All,
    1. How UTC date time and Normal date time differs in siebel.
    2. If legacy data needed to be loaded into siebel, in siebel few fields are date time and UTC date time fields. what would happen if we load both normal date time and UTC date time without considering them techinically?
    3. UTC date time holds any specific format in physical database? If we want to load legacy data to UTC date time format what is the query to manipulate it?
    Thankyou
    Sean

    Sean,
    Please check document below, I believe it has most of the answers to the questions you have:
    http://download.oracle.com/docs/cd/E14004_01/books/GlobDep/GlobDepUTC.html
    Hope it helps,
    Wilson

  • Difference between a starting date and time and ending date and time

    Hi All,
    I need to bring out the difference between a starting data and time and ending date and time. Difference should be in time I mean it should be in hours or minus or seconds.
    I am sure there must be a Function module for this, Has anyone of you been in search of this kind of FM, Kindly suggest me. It is urgent.
    Thanks
    Mahen

    Hi,
    Check this out.
    data : date1 type dats ,   " System data type for Date (sy-datum)
           date2 type dats,
           time1 type tims,      " System data type for time (sy-timlo)
           time2 type tims,
           days  type i,
           scd   type i,
           t_mt  type i.
    days = date1 - date2. " Diference in days.
    Scd  = time1 - time2. " diference in seconds.
    t_mt =  ( days * 24 * 60 ) + ( scd / 60 ).
    total diference in minute
    <b>Reward Points & Mark Helpful Answers</b>

  • Extract time and data with a regular expression

    Hi,
    I have a string with time and date in a HTML statement.
    String s =">19:59, 18 August 2006</a> ";
    // I hope get
    String s1="19:59, 18 August 2006";or
    String s =">18:37, 4 September 1998</a>"Because of different length of months, so how use regular expression to extract it.
    The second question is how to write the string into a file.
    filename =  "A.txt";
                    File file = new File(filename);
              out=new BufferedOutputStream(
                        new FileOutputStream(file));
                   byte[] buffer = new byte[1024];
    // then what?Thank you in advance!

    If "WARNING" can never occur in the input then wedon't have to worry about making the regex not match
    it.
    Hmm, how about fool-proof? :)Bad idea, and impractical or impossible to implement. Excessively defensive coding leads to bloated, hard to maintain code, and a greater likelihood of bugs.
    Code so that you code works correctly provided the preconditions are met. It's the caller's responsibility to meet them. Don't waste time and gunk up your code trying to handle inputs that aren't allowed to occur.

  • Daylight Savings time, and how dates are stored internally and displayed

    This is probably a question that appears here annually, but I couldn't really find clear answers, so I'll try asking this in my own words:
    I'm in the Eastern timezone, and this Sunday, we'll be turning our clocks back an hour at 2:00 AM. That means that accordign to us humans, the time 1:30 AM will occur twice on Sunday.
    I've got an Oracle application that runs every 5 minutes around the clock, and it selects records from a certain table whose updated timestamp (TIMESTAMP(6)) is greater than SYSDATE - 5/1440, meaning any record that was updated in the last 5 minutes. Will we have a problem with some records being processed twice on Sunday morning? I'm theorizing that everything will be OK, that internally, Oracle stores DATE fields using something like an epoch which then gets interpreted when we display them. An epoch value will continue to grow each second no matter what “time” it is according to the U.S. Congress.
    A simpler way to look at the question might be as follows:
    If you store SYSDATE in a DATE column in row “X” at 1:30 AM before the time change, and you store sysdate in row “Y” exactly one hour later, will Oracle say that X’s timestamp is 60 minutes less than Y’s timestamp? All fields that are related to my particular situation are either DATE or TIMESTAMP(6).
    We use 11g.

    >
    That settles that! Thank you! My theory was wrong! I appreciate the help.
    >
    You may think it settles that but, sorry to burst your bubble, that doesn't really settle much of anything.
    One thing that was settled is the answer to this question
    >
    But are they talking about what you can EXTRACT and DISPLAY from the field or what is actually STORED internally?
    >
    which is, as Mark stated, they are talking about what is stored internally.
    The other thing that was settled is that you will pull the same, or mostly the same, data twice during that one hour. I say 'mostly the same' because of the major flaw your extraction method has to begin with.
    >
    If you store SYSDATE in a DATE column in row “X” at 1:30 AM before the time change, and you store sysdate in row “Y” exactly one hour later, will Oracle say that X’s timestamp is 60 minutes less than Y’s timestamp?
    >
    No - they will have the same time since 'one hour later' would have been 2:30 AM but the clock was turned back an hour so is again 1:30 AM. So the second time your job runs for 5 minutes at 1:30 AM it will pull both the original 1:30 AM data AND the data inserted an hour later.
    And Oracle will say that data stored in row "Z" exactly 45 minutes later than "X" at 1:30 AM will have a date of 1:15 AM and will appear to have been stored earlier.
    Your method of extracting data is seriously flawed to begin with so the daylight savings time issue is the least of your problems. The reason is related to the answer to this question you asked
    >
    do people avoid using DATE and TIMESTAMP datatypes because they are too simple?
    >
    That method isn't reliable - that is why people avoid using a date/timestamp value for pulling data. And the more often you pull data the worse the problems will be.
    >
    I've got an Oracle application that runs every 5 minutes around the clock, and it selects records from a certain table whose updated timestamp (TIMESTAMP(6)) is greater than SYSDATE - 5/1440, meaning any record that was updated in the last 5 minutes
    >
    No - it doesn't do that at all, at least not reliably. And THAT is the why your method is seriously flawed.
    The reason is that the value that you use for that DATE or TIMESTAMP column (e.g. SYSDATE) is assigned BEFORE the transaction is committed. But your code that extracts the data is only pulling data for values that HAVE BEEN committed.
    1. A transaction begins at 11:59 AM and performs an INSERT of one (or any number) of records. The value of SYSDATE used is 11:59 AM.
    2. The transaction is COMMITTED at 12:03 AM.
    3. Your job, which runs every five minutes pulls data for the period 11:55:00 AM to 11:59:59 AM. This job will NOT see the records inserted in step #1 because they had not been committed when your job query began execution - read consistency
    4. Your job next pulls data for the period 12:00:00 AM to 12:04:59 AM. This job will also NOT see the records inserted in step #1 because the SYSDATE value used was 11:59 AM which is BEFORE this jobs time range.
    You have one or ANY NUMBER of records that ARE NEVER PULLED!
    That is why people don't (or shouldn't) use DATE/TIMESTAMP values for pulling data. If you only pull data once per day (e.g. after midnight to get 'yesterdays' data) then the only data you will miss is for data where the transaction began before midnight but the commit happened after midnight. Some environments have no, or very little, activity at that time of night and so may never have a 'missing data' problem.
    Creating your tables with ROW DEPENDENCIES will store an SCN at the row level (at a cost of about 6 bytes per row) and you can use the commit SCN to pull data.
    Just another caveat though - either of those approaches will still NEVER detect rows that have been deleted. So if you need those you need yet a different approach such as using a materialized view log that captures ALL changes.

  • Create files and compare data

    I have an aplication that can recive data (an integer and string), it stores it in a datafile and adds the date and time.  However, I need that everytime a new set of data cames, it ctompares it with the rest of the data stored in the same file.  If it the integer (key)  is repeated, it should be stored in a different file if not, it should be stored there.  
    I been able to read and write data files in different vi, but I can't makean  application that does everything at the same time.  I will appreaciate any suggestions.   I'm new with LabView and there is a lot I dont know yet. 
    Thank you!!!!

    Thanks for your suggestion.  However, the main problem is not how to read and write together but how to compare the data.  I started by writing and reading vi becuase I wanted to insolate every part of my program, be sure it works and then build on top of it.   The complete application should do something like:
    --Open two files, one for new data, one for repeted data
    -- User enters data -> a key as integer and some string
    -- compare the new key with ALL the keys already stored in the file.
          -- if the file is empty or no key is found in the file, write the data in the file for new data
         -- If the key is repeted, write the data in the file for repeted data
    -- Keep doing this until the user stops the application.
    What I really need is to be able to compare the recent entered data to what was entered before.  I chose to save data in a datalog because it seemed the best solution and because I also needed to store the date and time.  However, if there is any other way to store the data and compare it, please let me know.  I tried arrays and clusters by themselves but it wasnt easy.  Datalogs worked fine storing data but now comparing is too hard because I dont know how to read the file, record by record while comparing it to the new data I just got.
    I hope this is a little bit clearer!

  • Getting the current time and comparing it to a time in the future

    Hello,
    I am seeing in my research some debate on the best way to get the time. I am reading that just using the Date class and calling getTime() is not the most reliable way to do things. Overall, I am trying to get the current time down to the millisecond. I then want to add 5 seconds to that time and then store that value. FInally, when the current time is greater or equal to this stored value, I want to continue on in my program. Can anyone point me in the right direction on how to calculate the time variable? Any help would be much appreciated. I am new to the JAVA world.
    Thanks,
    Tim

    To store the current time, simply use new java.util.Date(). Yes, there might be slight inconsistencies and it might not be the most accurate time possible, but without significant additional effort (perhaps a native O/S call or the use of another time library), you will not do much better. Calendar won't help in this instance either. The easiest way to get five seconds in the future is to do the following:
    Date now = new Date();
    Date future = new Date(now.getTime() + 5000);To store and retrieve the value, it depends on what you are doing. You can place it in the database via JDBC (BTW, if you trust the database timestamp more than Java's you can use something like Oracle's SYSDATE instead of Java's date in your SQL query). You can place it in the filesystem. You can store it in the user's session.
    - Saish

  • Selection based on previous run date , time and current date a

    HI all,
    I have the selection as follows.
    Previous run date :  .12/14/2005..                     previous run time-14:30:56
    current run date : 12/17/2009.                      current run time: 07:05:31
    Here all are parameters. and  current run date is system date  and   current run time is system time.
    i want to fetch all the deliveries from the above selection including previous run date and time.
    Any inputs..

    Hi
    Append current run data and previous run data into a data range parameter,Current time and previous time into time range parameter and fetch the data based on the range parameters.
    Regards
    Srilaxmi

  • EXTRACT function and Chinese data

    Hi !
    I'm working with PL/SQL web applications, and I'm having trouble viewing it on a webpage when I use EXTRACT function for Chinese data.
    <abccompany> <department> &#20975;&#20262;·&#23041;&#24265;&#26031;&#26159;&#19968;&#23478;&#23567;&#22411;&#31038;&#21306;&#21046;&#33647;&#21378;&#30340;&#25152;&#26377;&#32773;&#65292;&#22905;&#27491;&#32771;&#34385;&#24320;&#22987;&#25552;&#20379;&#33647;&#26041;&#36882;&#36865;&#30340;&#26381;&#21153;&#65292;&#21516;&#26102;&#20063;&#24050;&#32463;&#23601;&#27492;&#20107;&#24449;&#27714;&#20102;&#20445;&#38505;&#19987;&#23478;&#40077;&#21187;·&#24067;&#26391;&#30340;&#24847;&#35265;&#12290;&#20975;&#20262;&#35810;&#38382;&#40077;&#21187;&#65292;&#38656;&#35201;&#36141;&#20080;&#21738;&#20123;&#20445;&#38505;&#12289;</department></abccompany>
    The Chinese xml data is stored as 'xmltype' in the Oracle database.
    1)
    When I run the below query, the output shown on a web page is upside down question marks like this
    select v.xtext.EXTRACT('/abccompany/department/text()').GetClobVal()
    into text
    from case_text v
    where case_identifier=inIdx;
    htp.print('<html><body>')
    htp.print(text);
    htp.print('</body></html>');
    2)
    However, the EXTRACT function works perfectly for English data.
    3)
    I also observed that, when I replace
    select v.xtext.EXTRACT('/abccompany/department/text()').GetClobVal()
    with
    to_clob(xtext)
    the web page displays the Chinese contents of the whole file and not just within the nodes <abccompany><department>.
    How can I make Extract function work with Chinese data ?
    Any help appreciated !
    -Sara

    Sara
    This normally happens when the client character set is not capable of showing chinese data. For instance on my laptop I cannot show the results of an extract() which returns chinese or japanese data in sqlplus (which cannot show chinese data on my machine) but I can in ISQL*PLUS which is web based and can show chinese data.
    THis might be a result of your NLS_LANG settings. The database translates from the database character set (I'm assuming AL32UTF8 in this case, into the client character set (as defined by NLS_LANG). Again if the characters cannot be converted this can cause this issue.

  • HCM Time and Attendance - data requirements

    Can anyone help with what data is required from an external time and attendance collection application.
    E.G. First Name, Last Name, Emploee Code, Location, Clock in, Clock out and the big one is an 'hours calculated' data required?
    Regards
    Ray

    you would some javascript to refresh
    but this works in standard without doing any extra coding
    or yoiu can check this
    The flag event.target.dirty should be set to true at an appropriate
    position (probably form:ready event) for adobe reader versions < 9.
    Given below is a sample (javascript):
    if ( xfa.host.version < 9) { //handles 8.x.x and previous
        event.target.dirty = true;
    ie
    During the initialization of a PDF form, Since 'dirtyState' is a
    property of Reader, and when we open a PDF form, reader would set that
    property as "false" automatically. That's why the dirty state could not
    be changed to true in some event (like, initialize or Form:readey).
    Inorder to set the dirty state to ture, we need to set it after the
    initialization of the PDF form. Otherwise, the dirty state would be set
    as false during the initialization by default.
    The solution would be that they could try this script :
    ContainerFoundation_JS.setGlobalValue(event.target, "saveDirtyState",
    true);
    SaveDirtyState is a property used by ZCI code to judge if a PDF form is
    dirty or not.

  • How to get the current date and compare dates

    hi
    does anyone know how you would get the current date?
    furthermore, how to compare the current date with a past date to see how many days or months have past since then?
    thanks

    have a look at the Date class. new Date() creates an object containing the exact date and time at creation time. (Date).getTime() might be useful for comparing two dates. GregorianCalendar might be useful, too.

  • Extract parent and child data from an XML sequence?

    I'm very new to XML, so please excuse me if I use incorrect terminology here. I've been given a schema definition (.xsd), and several sample xml files from which I need to extract data and insert it into relational tables. I've made some progress in that I've been able to hack enough to modify and register the schema and get the XML into the database both through the registered schema and into a separate table with an XMLType column. I've also been able to use the isSchemaValid function to validate the XML against the schema definition, and I've been able to extract some of the simple data elements via the extractValue function. My problem is with extracting some of the nested data - that is, extracting parent node elements and child node elements together where there is more than one value in the child node. BTW. I'm on Oracle 10gR2.
    Following are the .xsd and and sample XML. Specifically, I need to select the NPI value from the PROVIDER node, and associate it with each of the CODE values from the SPECIALTIES node (which is part of the PROVIDER node).
    Here's the .xsd (sorry, it's very long). The only modifications I've made to the schema definition are to add the xdb namespace and the "xdb:defaultTable="HMOSCHEMA" snippet:
    <?xml version="1.0" encoding="UTF-8"?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:xdb="http://xmlns.oracle.com/xdb" version="1.0">
    <xsd:element name="HMO" xdb:defaultTable="HMOSCHEMA">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element ref="HMO_GENERAL_INFORMATION" />
    <xsd:element ref="PROVIDERS" />
    <xsd:element ref="FACILITIES" minOccurs="0"
    maxOccurs="1" />
    </xsd:sequence>
    <xsd:attribute name="DATE" type="xsd:string" />
    </xsd:complexType>
    </xsd:element>
    <xsd:element name="HMO_GENERAL_INFORMATION">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element ref="MCO_ID_LIST" minOccurs="1" maxOccurs="1" />
    <xsd:element ref="HMO_WEBSITE_ADDRESS" minOccurs="1"
    maxOccurs="1" />
    <xsd:element ref="HMO_SPECIAL_SERVICES" minOccurs="0"
    maxOccurs="1" />
    <xsd:element ref="HMO_DAILY_CONTACT_EMAIL_ADDRESS"
    minOccurs="1" maxOccurs="1" />
    <xsd:element ref="HMO_MONTHLY_CONTACT_EMAIL_ADDRESS"
    minOccurs="1" maxOccurs="1" />
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    <xsd:element name="PROVIDERS">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element maxOccurs="unbounded" ref="PROVIDER" />
    </xsd:sequence>
    <xsd:attribute name="RECORDS" type="xsd:string" />
    </xsd:complexType>
    </xsd:element>
    <xsd:element name="PROVIDER">
    <xsd:complexType>
    <xsd:sequence minOccurs="1" maxOccurs="unbounded">
    <xsd:element ref="NPI" minOccurs="1" maxOccurs="1" />
    <xsd:element ref="FIRST_NAME" minOccurs="1"
    maxOccurs="1" />
    <xsd:element ref="LAST_NAME" minOccurs="1"
    maxOccurs="1" />
    <xsd:element ref="MIDDLE_INITIAL" minOccurs="0"
    maxOccurs="1" />
    <xsd:element ref="GENDER" minOccurs="1" maxOccurs="1" />
    <xsd:element ref="LINE_1_ADDRESS" minOccurs="1"
    maxOccurs="1" />
    <xsd:element ref="LINE_2_ADDRESS" minOccurs="0"
    maxOccurs="1" />
    <xsd:element ref="CITY" minOccurs="1" maxOccurs="1" />
    <xsd:element ref="STATE" minOccurs="1" maxOccurs="1" />
    <xsd:element ref="ZIP" minOccurs="1" maxOccurs="1" />
    <xsd:element ref="COUNTY" minOccurs="0" maxOccurs="1" />
    <xsd:element ref="PHONE_NUMBER" minOccurs="1"
    maxOccurs="1" />
    <xsd:element ref="CLINIC_NAME" minOccurs="0"
    maxOccurs="1" />
    <xsd:element ref="CLINIC_TYPE" minOccurs="0"
    maxOccurs="1" />
    <xsd:element ref="CLINIC_NPI" minOccurs="0"
    maxOccurs="1" />
    <xsd:element ref="PROVIDER_OFFICE_HOURS_TENTHS"
    minOccurs="0" maxOccurs="1" />
    <xsd:element ref="MAXIMUM_PATIENTS" minOccurs="0"
    maxOccurs="1" />
    <xsd:element ref="ACCEPT_NEW_PATIENT" minOccurs="0"
    maxOccurs="1" />
    <xsd:element ref="PRIMARY_CARE_INDICATOR" minOccurs="0"
    maxOccurs="1" />
    <xsd:element ref="FOREIGN_LANGUAGES" minOccurs="0"
    maxOccurs="1" />
    <xsd:element ref="SPECIALTIES" minOccurs="1"
    maxOccurs="1" />
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    <xsd:element name="SPECIALTIES">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element maxOccurs="unbounded" name="CODE"
    minOccurs="1">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:pattern value="[0-9]{3}" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    <xsd:element name="FACILITIES">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element maxOccurs="unbounded" ref="FACILITY_NUM"
    minOccurs="0" />
    </xsd:sequence>
    <xsd:attribute name="RECORDS" type="xsd:string" />
    </xsd:complexType>
    </xsd:element>
    <xsd:element name="FOREIGN_LANGUAGES">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element maxOccurs="unbounded" name="CODE"
    minOccurs="0">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:pattern value="[A-Z]{3}" />
    <xsd:pattern value="[a-z]{3}" />
    <xsd:pattern value="" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    <xsd:element name="HMO_SPECIAL_SERVICES">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element maxOccurs="unbounded" name="CODE"
    minOccurs="0">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:pattern value="[0-9]{2}" />
    <xsd:pattern value="" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    <xsd:element name="MCO_ID_LIST">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element name="MCO_ID" minOccurs="1" maxOccurs="unbounded">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:pattern value="[0-9]{1}" />
    <xsd:pattern value="[0-9]{2}" />
    <xsd:pattern value="[0-9]{3}" />
    <xsd:pattern value="[0-9]{4}" />
    <xsd:pattern value="[0-9]{5}" />
    <xsd:pattern value="[0-9]{6}" />
    <xsd:pattern value="[0-9]{7}" />
    <xsd:pattern value="[0-9]{8}" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    <xsd:element name="HMO_WEBSITE_ADDRESS">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:minLength value="1" />
    <xsd:maxLength value="100" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="HMO_DAILY_CONTACT_EMAIL_ADDRESS">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:minLength value="1" />
    <xsd:maxLength value="50" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="HMO_MONTHLY_CONTACT_EMAIL_ADDRESS">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:minLength value="1" />
    <xsd:maxLength value="50" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="NPI">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:pattern value="[0-9]{1}" />
    <xsd:pattern value="[0-9]{2}" />
    <xsd:pattern value="[0-9]{3}" />
    <xsd:pattern value="[0-9]{4}" />
    <xsd:pattern value="[0-9]{5}" />
    <xsd:pattern value="[0-9]{6}" />
    <xsd:pattern value="[0-9]{7}" />
    <xsd:pattern value="[0-9]{8}" />
    <xsd:pattern value="[0-9]{9}" />
    <xsd:pattern value="[0-9]{10}" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="FIRST_NAME">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:minLength value="1" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="LAST_NAME">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:minLength value="1" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="MIDDLE_INITIAL">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:minLength value="0" />
    <xsd:maxLength value="1" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="GENDER">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:minLength value="0" />
    <xsd:maxLength value="1" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="LINE_1_ADDRESS">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:minLength value="1" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="LINE_2_ADDRESS">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:minLength value="0" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="CITY">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:minLength value="1" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="STATE">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:pattern value="[a-zA-Z][a-zA-Z]" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="ZIP">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:pattern value="[0-9]{5}" />
    <xsd:pattern value="[0-9]{9}" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="COUNTY">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:pattern value="[0-9]{1}" />
    <xsd:pattern value="[0-9]{2}" />
    <xsd:pattern value="[0-9]{3}" />
    <xsd:pattern value="" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="PHONE_NUMBER">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:pattern value="[0-9]{10}" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="CLINIC_NAME">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:minLength value="0" />
    <xsd:pattern value="" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="CLINIC_TYPE">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:minLength value="0" />
    <xsd:pattern value="" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="CLINIC_NPI">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:pattern value="[0-9]{1}" />
    <xsd:pattern value="[0-9]{2}" />
    <xsd:pattern value="[0-9]{3}" />
    <xsd:pattern value="[0-9]{4}" />
    <xsd:pattern value="[0-9]{5}" />
    <xsd:pattern value="[0-9]{6}" />
    <xsd:pattern value="[0-9]{7}" />
    <xsd:pattern value="[0-9]{8}" />
    <xsd:pattern value="[0-9]{9}" />
    <xsd:pattern value="[0-9]{10}" />
    <xsd:pattern value="" />
    <xsd:whiteSpace value="collapse"/>
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="PROVIDER_OFFICE_HOURS_TENTHS">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:pattern value="[0-9]{1}" />
    <xsd:pattern value="[0-9]{2}" />
    <xsd:pattern value="" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="MAXIMUM_PATIENTS">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:pattern value="[0-9]{1}" />
    <xsd:pattern value="[0-9]{2}" />
    <xsd:pattern value="[0-9]{3}" />
    <xsd:pattern value="[0-9]{4}" />
    <xsd:pattern value="" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="ACCEPT_NEW_PATIENT">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:pattern value="[A-Z]{1}" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="PRIMARY_CARE_INDICATOR">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:pattern value="[A-Z]{1}" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="FACILITY_NUM">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:pattern value="[0-9]{1}" />
    <xsd:pattern value="[0-9]{2}" />
    <xsd:pattern value="[0-9]{3}" />
    <xsd:pattern value="[0-9]{4}" />
    <xsd:pattern value="[0-9]{5}" />
    <xsd:pattern value="[0-9]{6}" />
    <xsd:pattern value="[0-9]{7}" />
    <xsd:pattern value="[0-9]{8}" />
    <xsd:pattern value="[0-9]{9}" />
    <xsd:pattern value="[0-9]{10}" />
    <xsd:pattern value="" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    </xsd:schema>
    Here's a sample of the XML (significantly shortened, and names and IDs changed to protect the innocent). BTW, the XML validates cleanly against the schema definition:
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <HMO DATE="03/26/2010">
    <HMO_GENERAL_INFORMATION>
    <MCO_ID_LIST>
    <MCO_ID>11111111</MCO_ID>
    </MCO_ID_LIST>
    <HMO_WEBSITE_ADDRESS>HTTP://WWW.SOMEHMONAME.COM</HMO_WEBSITE_ADDRESS>
    <HMO_SPECIAL_SERVICES>
    <CODE>00</CODE>
    </HMO_SPECIAL_SERVICES>
    <HMO_DAILY_CONTACT_EMAIL_ADDRESS>somename@someurl</HMO_DAILY_CONTACT_EMAIL_ADDRESS>
    <HMO_MONTHLY_CONTACT_EMAIL_ADDRESS>somename@someurl</HMO_MONTHLY_CONTACT_EMAIL_ADDRESS>
    </HMO_GENERAL_INFORMATION>
    <PROVIDERS RECORDS="1011">
    <PROVIDER>
    <NPI>1111111111</NPI>
    <FIRST_NAME>JOHN</FIRST_NAME>
    <LAST_NAME>DOE</LAST_NAME>
    <MIDDLE_INITIAL>A</MIDDLE_INITIAL>
    <GENDER>M</GENDER>
    <LINE_1_ADDRESS>1111 Some Rd</LINE_1_ADDRESS>
    <LINE_2_ADDRESS> </LINE_2_ADDRESS>
    <CITY>NOWHERE</CITY>
    <STATE>YN</STATE>
    <ZIP>12345</ZIP>
    <COUNTY>13</COUNTY>
    <PHONE_NUMBER>1111111111</PHONE_NUMBER>
    <CLINIC_NAME>SOME CLINIC - CORPORATE OFFICE</CLINIC_NAME>
    <CLINIC_NPI/>
    <ACCEPT_NEW_PATIENT>Y</ACCEPT_NEW_PATIENT>
    <PRIMARY_CARE_INDICATOR>N</PRIMARY_CARE_INDICATOR>
    <FOREIGN_LANGUAGES>
    <CODE> </CODE>
    </FOREIGN_LANGUAGES>
    <SPECIALTIES>
    <CODE>170</CODE>
    </SPECIALTIES>
    </PROVIDER>
    <PROVIDER>
    <NPI>2222222222</NPI>
    <FIRST_NAME>JANE</FIRST_NAME>
    <LAST_NAME>DOE</LAST_NAME>
    <MIDDLE_INITIAL>J</MIDDLE_INITIAL>
    <GENDER>F</GENDER>
    <LINE_1_ADDRESS>2222 SOMEOTHER ST</LINE_1_ADDRESS>
    <LINE_2_ADDRESS> </LINE_2_ADDRESS>
    <CITY>MYTOWN</CITY>
    <STATE>YN</STATE>
    <ZIP>12345</ZIP>
    <COUNTY>13</COUNTY>
    <PHONE_NUMBER>2222222222</PHONE_NUMBER>
    <CLINIC_NAME>SOME CLINIC - MYTOWN</CLINIC_NAME>
    <CLINIC_NPI/>
    <ACCEPT_NEW_PATIENT>Y</ACCEPT_NEW_PATIENT>
    <PRIMARY_CARE_INDICATOR>N</PRIMARY_CARE_INDICATOR>
    <FOREIGN_LANGUAGES>
    <CODE> </CODE>
    </FOREIGN_LANGUAGES>
    <SPECIALTIES>
    <CODE>322</CODE>
    <CODE>329</CODE>
    </SPECIALTIES>
    </PROVIDER>
    </PROVIDERS>
    <FACILITIES RECORDS="2">
    <FACILITY_NUM>1000000001</FACILITY_NUM>
    <FACILITY_NUM>2000000002</FACILITY_NUM>
    </FACILITIES>
    </HMO>
    As you can see, the SPECIALTIES node can contain more than one CODE value, si I can't use extractValue to retrieve them. Again, I need to extract the NPI value from the PROVIIDER node, and associate it with each of the CODE values from the SPECIALTIES node. So, what I would need to extract from this sample XML would be:
    NPI CODE
    1111111111 170
    2222222222 322
    2222222222 329
    This seems like it should be a pretty routine requirement, but I've tried everything I can think of (that is, everything I've learned to this point), and have not yet found a way............
    Ideally, the solution to extracting this data would utilize SQL (not PL/SQL, or Java, or XSL, etc) with XML extraction functions (e.g. extract, extractValue, XMLSequence, XMLTable, etc).
    Can anyone provide me with an example of how that iterative specialy code data could be extracted? Do I need to modify the .xsd to facilitate this extraction (so that registration of the schema results in other objects in the database)?
    Any suggestions or examples would be greatly appreciated.
    Thanks in advance, Dan
    P.S. - I hope the XML displays OK when I post this question!

    Hi,
    Thanks for your detailed sample, it's very helpful.
    This seems like it should be a pretty routine requirementIndeed, that's a classic (once you've got the method).
    So, here's how you can do it :
    SELECT x1.npi, x2.code
    FROM t,
         XMLTable(
          '/HMO/PROVIDERS/PROVIDER'
          passing t.doc
          columns
            npi number path 'NPI',
            specialties xmltype path 'SPECIALTIES'
         ) x1,
         XMLTable(
          'SPECIALTIES/CODE'
          passing x1.specialties
          columns
            code number path '.'
         ) x2
    ;Assuming the XML is stored in column T.DOC.
    As you see, for each NPI, the trick is to pass the entire SPECIALTIES node (kind of a join) to another nested XMLTable so that each CODE could be extracted as well.
    There's another method using only one XMLTable and a little more complex XQuery. I'll try to post it soon.
    HTH.
    Edit : 2nd method
    SELECT x.*
    FROM t,
         XMLTable(
          'for $i in /HMO/PROVIDERS/PROVIDER/SPECIALTIES/CODE
           return element e
            attribute npi { $i/../../NPI },
            $i/text()
          passing t.doc
          columns
            npi  number path '@npi',
            code number path '.'
         ) x
    ;Edited by: odie_63 on 27 mai 2010 18:43

Maybe you are looking for

  • I can´t download OS X Mavericks or Photoshop

    Hi, I got my Mac back from service. They changed the hard drive and now for some reason I can´t download back some programs. Iphoto and photoshop that I use daily. They don´t download properly and I have tried to update with the OS X maverick to see

  • Iphoto won't display events or photos

    I am not able to access my photos or events in iPhoto - I had connected my iphone 5 and it successfully downloaded some photos from the iphone. THen, I closed Iphoto and a bit later relaunched it to look for some other photos. It  doesn't not show an

  • Chart label font color

    Is it possible to change the color of fonts in chart labels (not axis labels)? The default black does not stand out well against some colors.

  • How to install mac os x snow leopard over the mac os x lion

    How to install mac os x snow leopard over the mac os x lion ?

  • Inprocess Inspection - Missing characteristics

    Hi All, We are using in process inspection ( Inspection type 03 ) .However While  result recording for the inspection lot created I can not see any characteristics in result recording screen. (System message - No characteristics were found ). 1) Insp