Converting part of the string to a date and subtract with sysdate.

HINT! In order solve this you must know how the pnr is assembled. Study this:
650323-5510, we only need the first six characters. They inform us about when the person (car owner) was born. In this case it is 23 Mars 1965. You have to use several oracle built-in-functions to solve this. Hint! Begin by converting part of the string to a date and subtract with sysdate.
select to_char(to_date(cast(pnr,'YYMMDDMM'))) from car_owner;
please what am i doing wrong. i need the result to be something like this
Hans, Rosenboll, 59,6 years.

Hi.
The main problem here is you have only last two digits of year. That could be the problem in a couple of years from now, when somebody born after 2k would get in to your database. For now if we ignore this problem the right solution would be :
<code>
SELECT months_between(trunc(SYSDATE),
to_date('19' || substr('650323-5510',
1,
6),
'YYYYMMDD')) / 12 years_old
FROM dual
</code>
Suppose you are expecting the age of the car owner as a result above code will give you that. One again notice the '19' I appended.
Best regards.

Similar Messages

  • Using INSTR to extract part of the string ?

    Morning guys and Happy Friday.
    I have a situation where I have to pull out part of the string using a select statement.
    Here is the string and I have to get the contents between the 2nd and 3rd backslash. So, basically, I have to extract marypoppins. Any ideas ?
    C:\USERS\marypoppins\Docs\SpecificationHere is where I started ... and I have stumbled upon trying to find the 3rd backslash. I can easily start the INSTR at 4 because I know that it will always be 'C:\'
    select select substr(C:\USERS\marypoppins\Docs\Specification',
                                INSTRB('C:\USERS\marypoppins\Docs\Specification', '\', 4), .....) from dual;

    Additionally you can break it all up simply with regular expressions..
    SQL> ed
    Wrote file afiedt.buf
      1  with t as (select 'C:\USERS\marypoppins\Docs\Specification' as txt from dual)
      2  -- END OF TEST DATA
      3  select rownum, regexp_substr(txt, '[^\]+',1,rownum) as element
      4  from t
      5* connect by rownum <= length(regexp_replace(txt,'[^\]'))+1
    SQL> /
        ROWNUM ELEMENT
             1 C:
             2 USERS
             3 marypoppins
             4 Docs
             5 Specification
    SQL>

  • Addressing of part of the string in the container

    Hello,
    in a mail task I would like to print only some characters from a string - e.g. from second to tenth - is it possible to address some part of the string in the container as is usual in abap?
    thx,
    JJ

    Hi,
    Yes , it is possible. If you want to show only some part of the string value in mail description you can use normal abap string operations. For example: In Mail description if you want to show only a part variable VALUE. you can just use &VALUE+a(b)&. It will work !!
    You can try it out !!
    Regards
    Krishna Mohan

  • 2 different iphones have the same Apple ID, how can I change the apple ID on one of them but not delete the other iphone's data and media?

    2 different iphones have the same Apple ID, how can I change the apple ID on one of them but not delete the other iphone's data and media?

    You don't have to do anything with the first iPod that you don't use anymore. If you are planning on keeping it, put in a drawer in your house and forget about it.
    You don't need a second account to use with the new iPod. I use one Appl e ID and iTunes library for two iPods, and two iPad. I have different content on all four devices. You can select exactly what you want to sync to each device and it can be different content on all devices.

  • HT1418 I have iPod4 and cannot see day-to-day appointments, etc on PC Outlook calendar.  Only repeated items (birthdays, anniversaries, etc.) are visible.  Where is the rest of my data and how do I restore it to the only calendar I have in Outlook?

    I have iPod4 and cannot see day-to-day appointments, etc on PC Outlook calendar.  Only repeated items (birthdays, anniversaries, etc.) are visible.  Where is the rest of my data and how do I restore it to the only calendar I have in Outlook?
    Thanks

    Hello Schimi. The Time Capsule is a kind of product that offer you two possibility:
    - To use the TC as a router or as an external HD.
    The difference between WPA and WPA 2 are:
    - They are two kinds of internet connection.
    WPA uses dynamic key encryption , which means that the key is constantly changing and makes the invasion of a wireless network more difficult than WEP . WPA is considered one of the highest levels of wireless security for your network and is recommended if your devices support this kind of encryption . Newer routers offer WPA2 security . WPA2 is compatible with WPA , but offers higher security level . In fact, it meets the high standards of many government agencies . If the router and computer support WPA2 , this should be your choice.
    If you need any help or if you find some difficult setting up it you can contact Apple Support.
    I am sure that they can help you with that.
    I am sory for the delay. I holpe that you solve your issue.

  • Mba sound: just bought my first mba and I have been using it in my house no problem...took it to my empty office today and I can hear a small vibration/sound coming from the upper left part of the keyboard...constant and rhythmical...ideas?

    mba sound: just bought my first mba and I have been using it in my house no problem...took it to my empty office today and I can hear a small vibration/sound coming from the upper left part of the keyboard...constant and rhythmical...ideas?

    Hi
    It's likely your fan,  It always runs on a MBA.  Mine is very quiet, others report some noise - here is one link.  There are lots of others.
    Hope this helps
    Cheers
    https://discussions.apple.com/thread/4381367?start=0&tstart=0

  • For unknown reasons iTunes will no longer open.  I have an HP laptop running windows 7 with Kaspersky protection.  It worked fine before but now won't open.  I tried downloading the most recent up-date and it will still not open.  Any suggestions?

    For unknown reasons iTunes will no longer open.  I have an HP laptop running windows 7 with Kaspersky protection.  It worked fine before but now won't open.  I tried downloading the most recent up-date and it will still not open.  Any suggestions?

    thrillhousecody
    Thanks for the reply with additional information.
    Recent history for Premiere Elements points to the program having problems when more than 1 video card/graphics card is
    being used by the computer on which Premiere Elements is running. This observation may seem contra indicated by the fact
    that you say that the program did work well about 2 years ago in the same setup. But other factors may have set in with regard
    to drivers, drivers versions, and driver conflicts. But this factor, does need to be ruled in or out.
    Can you disable one or the other card to determine the impact of this on your problem?
    But, of prime concern with regard to video card/graphics card is the use of a NVIDIA GeForce card with Premiere Elements 10.
    Even if your NVIDIA GeForce were the only card, Premiere Elements 10 will not work properly unless the NVIDIA GeForce driver
    version is rolled back to about May 2013. This may be one of the major factors here.
    a. Device Manager/Display Adapters and find out Driver Version and Driver Date
    b. Read the background information for the Premiere Elements 10/NVIDIA GeForce issue
    ATR Premiere Elements Troubleshooting: PE10: NVIDIA Video Card Driver Roll Back
    Also see the Announcement at the top of this forum regarding the matter - also with full details of the situation and how to fix with the
    driver version roll back.
    Please review and consider and then we can decide what next.
    Thanks.
    ATR
    Add On...This NVIDIA GeForce situation is specific for Premiere Elements 10. You should not expect to see the problem for
    later versions of Premiere Elements.

  • What is the difference between delivery date and actual goods issue date?

    Hi ,
    Can you please tell me the difference between Delivery date and Actual goods issue date ?
    Delivery data can be be greater than goods issue date?
    Thanks,
    Ajay

    Hi Ajay,
                  Delivery date means its the original date on which the delivery should be done.Actual goods Issue date is the date on which goods to be delivered according to the purchase order.There can be delay in the delivery so we maintain 2 objects.
    Yes delivery date can be greater than Goods Issue date.
    Hope this clears
    Regards
    Karthik

  • The main part of the safari page is grey and won't respond/can't type in any commands.  I can move back through the previous pages, and even open new ones via the URL, but can't get onto the main part of the page and I can't get onto the 9 page option. !?

    The main part of the safari page is grey and won't respond/can't type in any commands.  I can move back through the previous pages, and even open new ones via the URL, but can't get onto the main part of the page and I can't get onto the 9 page option. !?
    Help, please.

    Try clearing Safari's cache : Settings > Safari > Clear Cache (and Clear History)
    If that doesn't work then try closing Safari completely and then re-open it : from the home screen (i.e. not with Safari 'open' on-screen) double-click the home button to bring up the taskbar, then press and hold any of the apps on the taskbar for a couple of seconds or so until they start shaking, then press the '-' in the top left of the Safari app to close it, and touch any part of the screen above the taskbar so as to stop the shaking and close the taskbar.
    A third option is a reset : press and hold both the sleep and home buttons for about 10 to 15 seconds (ignore the red slider), after which the Apple logo should appear - you won't lose any content, it's the iPad equivalent of a reboot.

  • What is the Sequence of Master data and Transaction data R/3 to APO

    Hi guys,
    What is the Sequence of Master data and Transaction data R/3 to APO  through CIF?

    Hi,
    Master data,
    Material Indipendent data can be sent without any dependency.
    Material Dependent data sequence is as follow.
    Plant,
    MRP areas,
    Supply area,
    Material,
    MRP area material,
    planning material,
    ATP check,
    Purchase info recards,
    schedule agg,
    PPM or PDS (But before PPM or PDS  work center should send to apo) If PDS is sending then BOM should send before PDS.
    Transaction data.
    As per the business requirement what is planning in apo.
    Regards,
    Kishore Reddy.

  • Is bridge a part of the photography package (Photoshop CC and Lightroom)?  Or is there an additional cost?

    Is bridge a part of the photography package (Photoshop CC and Lightroom)?  Or is there an additional cost?

    I've always found Adobe's website remarkably unhelpful on this point.
    It repeatedly promotes the fact that you get Photoshop + Lightroom in a single package - but minimal info on other inclusions.
    The most succinct explanation of all inclusions I can find is at the ever reliable:
    Adobe Gives Ongoing Discount for Photoshop CC + Lightroom Plan | ProDesignTools

  • So what's the difference bewteen "packet data" and...

    just wanna know the difference between "packet data"and "highspeed GSM"while creating new access point in destination section.
    totally confused,any help should be appreciated.

    Essentially nothing.
    Depending on what you have your compiler strictness level set to, you can get it to generate a warning when you use an uninitialized variable.
    In Java, variables are assigned a default value dependent on type. All subclasses of Object are assigned a default type of null, and all primitive number data types are assigned a default value of 0.
    This differs from (for example) C, where variables are simply assigned a location in memory when they are declared, and the value of the variable is whatever was currently in that memory location when allocated. Using uninitialized variables in C is generally a big no-no.
    You'll find a lot of old-school C programmers who migrated to Java will initialize their variables :)
    Btw, this question probably belongs in another forum.

  • What is the Difference Between Sys Date and Effective Date ??

    Hi Gurus,
    Can any one pls let me know What is the Difference Between Sys Date and Effective Date ??
    with regards
    User600722

    EFFECTIVE DATE usually refers to a date-tracked record (although not exclusively).
    Date-tracked records in Oracle HR have an EFFECTIVE START DATE and an EFFECTIVE END DATE. The record is 'EFFECTIVE' between these dates. In reports, you often use SYSDATE to compare to these two dates to find the CURRENT effective record, e.g. SYSDATE BETWEEN EFFECTIVE START DATE AND EFFECTIVE END DATE.
    When you make changes to a HR record, you can choose between DATE TRACKING options, such as CORRECT or UPDATE (there are others too). CORRECT will overwrite the record and replace the data with your changes. This is normally used when you need to correct something that is wrong. UPDATE will create a new version of the record from the EFFECTIVE START DATE you choose. It will also set the EFFECTIVE END DATE of the previous record to the day before your new record's EFFECTIVE START DATE. That enables a history of records to be maintained so you can see what your data looked like at ay one point in time.
    Regards
    Tim
    Edited by: TimW on Sep 23, 2008 2:37 PM

  • How to show Date and Time with TimeZone

    Dear All,
    I have to show Date and Time with TimeZone abbreviation,
    for example:
    1) 31 March 2011 2:30 in india standard time - it should show in screen 31 March 2011 2:30 IST.
    2) 31 March 2011 2:30 in Australia/New Zealand - Eastern time zone it should show in screen 31 March 2011 2:30 AEST.
    how can i show *Australia/New Zealand - Eastern time zone to AEST*,
    I tried with format DD MMM YYYY HH:MM zzz, and i looked time zone API too.
    Appreciate your help
    Thanks
    Daya

    Dayananda wrote:
    ok, than i have to use zzzz format, as z won't help in my case, so i have to use zzzz which display descriptive value like, Indian Standard Time i.e. ISTPer the javadocs there is a very specific reason why that is a problem especially if you intend to support many timezones in one application.
    "+For compatibility with JDK 1.1.x, some other three-letter time zone IDs (such as "PST", "CTT", "AST") are also supported. However, their use is deprecated because the same abbreviation is often used for multiple time zones (for example, "CST" could be U.S. "Central Standard Time" and "China Standard Time"), and the Java platform can then only recognize one of them+."
    Thus you have one single case where there can be many and moreover it can change (twice a year I believe.)
    There is a standard source for this information although when I tried it it appears to not work.
    If the app only needs to display one zone then provide a configuration value that allows a user to overload the display value.
    If the app needs to display many values then you MUST inform business users of the problem because there are duplicates and they, not you, need to decide specifically what happens in those cases.

  • Each time master data full load removes previous data and load with new ?

    We load company code (0COMP_CODE) master data (full load).
    1st day, we check company code master data, the record count is 150, 2nd day, the record count is 90.  It sounds like the master data full load each time would clean the previous data and load with new data, am I right?  If what I guess is right, then what setup is controlling this?
    Thanks

    I dont think it does cleanup.
    MD records in the new load simply overwrite the records already present in the master data.
    I mean if same record comes again its overwritten.If new record it gets added.
    I wouldnt expect number of records to reduce drastically from 150 to 90.
    Maybe before MD activation records could be more(as there will be both M(modified) and A(active) records).
    cheers,
    Vishvesh

Maybe you are looking for

  • How to Check Creation/Change data for PO Service Line item

    Hi, I was wondering what field(s) from what table(s) I would have to check if I wanted a report to look for the creation or chnaged date of a specific service item in a PO? Currently it is using the EKPO-AEDAT field to check if a PO line item has bee

  • Append select options details in one intennal table

    Hi Here by i  am selecting Specification data    ESTRH-subid   in selection screen using SELECT-OPTIONS  i.e                SELECT-OPTIONS: s_specif FOR estrh-subid I need to populate that SUBID details in one internal table, Please let me know proce

  • 10.8.5 supplemental 1 update computer started up in 10.8.2

    I'm on a Mac mini Server late 2012. Processor  2.3 GHz Intel Core i7 Memory  16 GB 1600 MHz DDR3 I just installed the 10.8.5 Supplemental update 1. The computer had 10.8.2 when it rebooted. ***? Now what shows in the App Update area is a OS X Update

  • How to rotate PDF with the automator?

    Hello everybody! I'd like to create a WorkFlow to rotate all the selected PDFs (one page PDF) of 90º. In the PDFs section of the Automator there isn't anything like that. Somebody can help me how to do it? Thks a lot! Enrico

  • PSE 5.0 Freezes up

    Whenever I try to create a shape layer on Photoshop Elements 5.0, it freezes up and only shows me double-sided arrow cursors and won't let me click on any layers or tools. Please help me figure this out! The phone support line at Adobe doesn't suppor