Is there a way to format the way dates are displayed?

ive got a query that returns dates. Currently, the code is:
SELECT uptd.delivery_month delivery_time
FROM USER_pwr_term_data uptd
WHERE uptd.eff_date='07/JUN/02'
the data in the database is listed in the format of 07/01/2002 and cannot be changed.
the output from the query is coming out as 2002-07-01 0:00:00
i am looking for the output date to be simply Jul-02 or something to this effect.
Thanks,
Jared

In the group by and order by clauses, you need to use whatever to_char format that you want to group by and order by. For example, if you want to order by the year, then the numerical month, then use to_char and 'YYYY-MM'.
If you want to display the column in the select clause in a different format than what you group by and order by, then you need to wrap an additional to_date around the format that you used for group by and order by, to convert it back to a date format, and another to_char around that, to convert it to the format you want to display it in. For example, if you want to display it like Jul-02, where 02 represents the year 2002, then use to_char and 'Mon-YY', wrapped around the to_date, wrapped around the format you used in the group by and order by clauses.
Please see the example below. Also, notice that how the date is displayed by default, is dependent upon the nls_date_format. Also, notice that every value of eff_date that I entered is the same, despite the fact that I entered it in various formats, because I used to_date.
SQL> ALTER SESSION SET NLS_DATE_FORMAT = 'YYYY-MM-DD'
  2  /
Session altered.
SQL> SELECT SYSDATE FROM DUAL
  2  /
SYSDATE
2002-06-24
SQL> CREATE TABLE user_pwr_term_data
  2    (delivery_month DATE,
  3     eff_date       DATE)
  4  /
Table created.
SQL> INSERT INTO user_pwr_term_data
  2  VALUES (SYSDATE, TO_DATE ('06/07/2002', 'MM/DD/YYYY'))
  3  /
1 row created.
SQL> INSERT INTO user_pwr_term_data
  2  VALUES (SYSDATE + 30, TO_DATE ('07/JUN/2002', 'DD/MON/YYYY'))
  3  /
1 row created.
SQL> INSERT INTO user_pwr_term_data
  2  VALUES (SYSDATE - 30, TO_DATE ('07/Jun/2002', 'DD/Mon/YYYY'))
  3  /
1 row created.
SQL> INSERT INTO user_pwr_term_data
  2  VALUES (SYSDATE + 31, TO_DATE ('06/07/2002', 'MM/DD/YYYY'))
  3  /
1 row created.
SQL> INSERT INTO user_pwr_term_data
  2  VALUES (SYSDATE - 31, TO_DATE ('06/07/2002', 'MM/DD/YYYY'))
  3  /
1 row created.
SQL> COMMIT
  2  /
Commit complete.
SQL> SELECT * FROM user_pwr_term_data
  2  /
DELIVERY_M EFF_DATE
2002-06-24 2002-06-07
2002-07-24 2002-06-07
2002-05-25 2002-06-07
2002-07-25 2002-06-07
2002-05-24 2002-06-07
SQL> SELECT      TO_CHAR (TO_DATE
  2                  (TO_CHAR (uptd.delivery_month, 'YYYY-MM'),
  3                'YYYY-MM'), 'Mon-YY') AS delivery_time,
  4              COUNT (*) AS total -- or other group function
  5  FROM        user_pwr_term_data uptd
  6  WHERE       uptd.eff_date = TO_DATE ('07/JUN/2002', 'DD/MON/YYYY')
  7  GROUP BY TO_CHAR (uptd.delivery_month, 'YYYY-MM')
  8  ORDER BY TO_CHAR (uptd.delivery_month, 'YYYY-MM')
  9  /
DELIVE      TOTAL
May-02          2
Jun-02          1
Jul-02          2

Similar Messages

  • A way to set the default Data tab display format to "Auto-Fit, Best-Fit"?

    Is there a preference to set the Data tab for tables and views to default to "Auto-Fit" and "Best-Fit"?
    John.

    No. You can request it at the SQL Developer Exchange.
    K.

  • Yesterday i bougt a used iphone 4....when i tried to reset it it asked for the apple ID which of the person from whom i bought the cell...so is there any way of formating the iphone

    yesterday i bougt a used iphone 4....when i tried to reset it it asked for the apple ID which is of the person from whom i bought the cell...so is there any way of formating the iphone.............plzz help me 

    i have the phone unlockd but need to restore it to factory settings nd when i do it ...it asks for the apple id and passord of the guy from whom i bought it.......is there no way to restore it to factory setting

  • Is there a way to retain the original date after editing?

    I am using PSE 11 on a MacBook Pro, OS X (10.3). I have a lot of old pictures to edit, and they are in date order, which is how I want them.
    However, when I edit a picture and save it, it moves it to the bottom, with today's date instead of the original date.  I have them set to save with the original as a version set.
    Is there any way to retain the orignal dates, short of having to go in and reset the date on every picture after I save it?  I really want them to be in date order under their original dates.
    BTW, I used earlier versions that were Windows-based, and this didn't happen.  When I saved them, the version sets stayed where they were.
    This is really frustrating!

    SK Prairie Chicken a écrit:
    I'd like an answer to this too.
    What's your problem exactly?
    The 'date taken' is never changed by editing a picture.

  • I do NOT like when I click "Find" that it opens in a separate window. I liked it being at the bottom left of the page and staying there. It's irksome the way it is.

    I do NOT like when I click "Find" that it opens in a separate pop-up window. I liked it being at the bottom left of the page and staying there. It's irksome the way it is. Would you please put it back on the bottom left so it will stay open. It is so much easier.
    Also, it is a little irksome that Firefox automatically uploaded the new 9.0 version. I was purposefully not uploading it. I thought it was loading updates to 8.0. You need to add more detail and have a way to give us an option not to update when the pop-up appears.

    The Find bar is still at the bottom of the browser window, just above the Add-on Bar if you have it set to appear. No change with it in Firefox 9.0.
    http://support.mozilla.com/en-US/kb/troubleshooting+extensions+and+themes

  • Is there a way to show the end dates of the previous month stand out?

    is there a way to show the end dates of the previous month in bold or make it stand out? so 30,31 and 1st of this month don't all look the same? For example the 30,31st get a regular text since they are a part of the the last month and this month gets bold dates? Its hard to read the dates anyways.

    Pics and more
    I may receive some form of compensation, financial or otherwise, from my recommendation or link.
    5:05 PM Sunday; January 4, 2009

  • My time capsule says it has only 75gb free space but when i go through finder to it there is nothing there. trash is empty by the way.

    my time capsule says it has only 75gb free space but when i go through finder to it there is nothing there. trash is empty by the way. i had to delete some things of it as it didnt have enough room and i was backing up too much irrelevant stuff. now it wants to do a complete back up - about 300gb but there is only 75 free. WT

    Ok first what u have to do is remove the Time Capsule from the time machine software and make sure the computer does not back up to the time machine. Next go into disk Utility and find the time capsule. Once found, reformat the drive. Then start using it. If you cannot find the drive in Disk Utility, then open a finder window and find the drive in the sidebar. Right click it and find a button within the drop down menu that will allow you to reformat the drive. If you are forced to go to finder and you right-click the drive, you may have to explore all the options within the drop down menu to find the reformat option.

  • Is there any way to identify the two classes are compiled by same vm

    Is there any way to identify the two classes are compiled by same vm?
    Thank's a lot.

    I think this is the better forum than java compiler. The answer to the question you asked is no.
    But that question is not the best way to address your problem.
    If this were me, I'd use a tool like ASM (http://asm.objectweb.org/) to read in that file, and replace the getToday() method, with one like this
    long getToday() {
        return 20080101;
    }and replace the class file with this new one. (keep the old one, they might be using a class loader that verifies class signatures or something)
    (They said the code you are looking at could have been changed by you - so take the hint and change it back).
    If they've ripped you off, this will restore justice much more cheaply and effectively than involving the lawyers. If they then sue you for breaching the license agreement, that would probably force them to disclose their underhand tactics.
    OTOH, if you're lying to us about the purchase, and needing to pay for upgrades to fix the performance issue, and instead are trying to crack some trial software, then I hope they are using a custom class loader that checks the integrity of the classes.
    If you are being ripped off, why are you not telling us the name of the company? I am not sure who is being ripped off here.
    Bruce

  • When I try to email and/or copy paste photos to a new email it .g attachment.  My dads iPad does an attachment.    Is ther a setting to change the way it attaches photos"?

    When I try to email and/or copy paste photos to a new email it pastes the full photo(s) vs a jpg attachment.  My dads iPad does an attachment.    Is there a setting to change the way it attaches photos?

    Try restarting the computer
    LN

  • Any way to set the file date?

    Hi-
    I have recently switched to aperture, and imported my iPhoto library.
    When I use the "Pictures" screensaver (the one where the pics fall down, looking like polaroids), all of the dates on them are 1/3/09-- the date that they were imported into the library.
    It seems that the screensaver uses the file date, rather than the metadata for the date.
    Is there any way to get the file date to match the exif date?
    The photos are stored in the aperture library, if that matters.
    Alternatively, are there any better screensavers for pictures out there (that would work with the aperture library)
    thanks,
    -jamie

    So here's the thing. I'm still looking and I still can't find it. 'Tis a feature you have that I don't but by the sounds of things it's not much use with aperture anyway!
    The issue is as I stated above. The screensaver uses the previews generated by aperture and thus references the creation date of the preview files not the original date taken from the EXIF metadata. Hence your problem. If you export jpegs out of aperture they will have today's creation date which (i' haven't been able to test as I can't find the annotations feature but) will be refernced as such by the screen saver.
    So the solutions are twofold (and you have suggested them both):
    1) Find a screensaver that reads the exif metadata
    2) Turn off the feature.
    you may possibly be able to send the contents of your smart folder back to iPhoto see if the screen saver reads it from there?
    Sorry I can't be more help.
    Anyone else able to chime in here?
    M.

  • There was a problem reading the layer data. Read the composite data instead?

    I can't open my psd with properly in Photoshop, it keeps showing :There was a problem reading the layer data. Read the composite data instead? 
    Photoshop cc
    Help please

    I just discovered this issue. Apparently if your PSD document has a tonne of layers, it will save normally. Then suppose you are working on it one day, and create lots of new additional layers...saving that will then corrupt the PSD file, as apparently the number of layers exceeds some hidden limit. You will not be able to load that back in, as Photoshop doesn't appear to allow you to do that.This issue appears for both PSD & PSB files. I lost a few weeks of updates, but recovered thanks to a few backups.
    One clue you can use to ensure you don't inadvertently save over the file (thereby corrupting it), is to try duplicating a layer or a group of layers. You will not have the option to do so. If you encounter that, immediately open a new file, and drag a few groups of layers to the new document (and deleting them in the original document). You should then go back below the 'limit', allowing you to save normally.
    As for the original corrupted file, well I tried repairing it with a whole host of tools. But nothing worked ....
    MacReady: Any way we can we fix it?
    Garry: It's gone, MacReady.

  • I updated iOS 7 and my contacts were ok then they suddenly disappeared a few weeks after updating. I have no idea if it has anything to do with iOS 7 but when I email someone the contacts are there. When I open the app they are gone. What happened?

    I updated iOS 7 and my contacts were ok then they suddenly disappeared a few weeks after updating. I have no idea if it has anything to do with iOS 7 but when I email someone the contacts are there. When I open the app they are gone. What happened?

    Try:
    - Reset the iOS device. Nothing will be lost
    Reset iOS device: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Reset all settings      
    Go to Settings > General > Reset and tap Reset All Settings.
    All your preferences and settings are reset. Information (such as contacts and calendars) and media (such as songs and videos) aren’t affected.
    - Restore from backup. See:                                 
    iOS: How to back up                                                                
    - Restore to factory settings/new iOS device.             
    If still problem, make an appointment at the Genius Bar of an Apple store since it appears you have a hardware problem.
    Apple Retail Store - Genius Bar                                      

  • SCOM - -500 Internal Server Error - There is a problem with the resource you are looking for, and it cannot be displayed

    Hi There,
    Need your assistance on the issue that we are facing in prod environment.
    We are able to open web console from remote machine and able to view monitoring pane as well as my workplace folders from console . Able to view and access alerts and other folder in the monitoring pane. We are able to view and access My Workplace folder
    and able to view the reports in Favorite Reports folder. But when I click on run Report we  are getting the below error  "500 Internal Server Error - There is a problem with the resource you are looking for, and it cannot be displayed."
    In our environment we have 3 servers one is SQL server and two are SCOM servers. Please advise how to fix this issue. Do we have to do any thing from SQL End?
    Errors: Event ID 21029: Performance data from the OpsMgr connector could not be collected since opening the shared data failed with error "5L".
     Event ID 6002 : Performance data from the Health Service could not be collected since opening the shared data failed with error 5L (Access is denied.).
    Regards,
    Sanjeev Kumar

    Duplicate thread:
    http://social.technet.microsoft.com/Forums/en-US/7675113e-49f0-4b3a-932b-4aceb3cfa981/scom-500-internal-server-error-there-is-a-problem-with-the-resource-you-are-looking-for-and-it?forum=operationsmanagerreporting
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • Can't open file - error "There was a problem reading the layer data.."

    I'm on a
    Mac Pro, 10.5.7
    PSCS3
    I have been sent a file (148MB) from a client via FTP that I can not open. The file was created on a PC, using PSCS3.
    I'm usually pretty good at troubling shooting but I have not seen this before.
    Any help, suggestions would welcomed.
    I get the following error messages: (see attached)

    It looks like the atttachement did not work
    Here are the error messages:
    First message:
    "There was a problem reading the layer data. Read the composite date instead?"
    Second Message:
    "Could not complete your request because the file is not compatiable with this version of Photoshop."

  • 502 - Web server received an invalid response while acting as a gateway or proxy server. There is a problem with the page you are looking for, and it cannot be displayed. When the Web server (while acting as a gateway or proxy) contacted the upstream cont

    I am getting error while accessing url of lyncweb.domain.com, dialin.domain.com and meet.domain.com pointing to RP server.
    502 - Web server received an invalid response while acting as a gateway or proxy server.
    There is a problem with the page you are looking for, and it cannot be displayed. When the Web server (while acting as a gateway or proxy) contacted the upstream content server, it received an invalid response from the content server.
    Regards, Ganesh, MCTS, MCP, ITILV2 This posting is provided with no warranties and confers no rights. Please remember to click Mark as Answer and Vote as Helpful on posts that help you. This can be beneficial to other community members reading the thread.

    When i try with https://lyncfrontend.domain.local:4443 and https://lyncfrontend.domain.com:4443 both opens but when i open the external domain name i get certificate .
    ARR version installed is 3.0
    To throw more light on the configuration:
    Lync 2013 implemented, internal domain name is : domain.local and external domain name is : domain.com
    All servers in VMs are with 4 core processor, 24gb ram, 1TB drive.
    Frontend : Windows 2012r2 with Lync 2012 Standard Edition - 1 No (192.168.10.100)
    Edge : Windows 2012 with Lync 2012 Std - 1 No 
    (192.168.11.101 DMZ) in workgroup
    ISS ARR Reverse Proxy 3.0 : Windows 2012 with ARR and IIS configured. (192.168.11.102)
    Certificate : Internal Domain root CA for internal and External (Digicert).
    Internal Network : 192.168.10.x /24
    External Network (DMZ) : 192.168.11.x /24
    Public Firewall NAT to DMZ ip for firewall and RP server. So having two public IP facing external network.
    Edge has : sip.domain.com, webconf.domain.com, av.domain.com
    IIS ARR RP server has : lyncdiscover.domain.com, lyncweb.domain.com, meet.domain.com, dialin.domain.com
    Have created SRV record in public : _sip.tls.domain.com >5061>sip.domain.com, _sipfederationtls._tcp.domain.com>5061>sip.domain.com, _xmpp-server._tcp.domain.com>5269>sip.domain.com
    Installed frontend server using MS Lync server 2013 step by step for anyone by Matt Landis, Lync MVP.
    Internal AD Integrated DNS pointing Front-end
    Type of Record FQDN
    IP Description 
    A sip.domain.com
    192.168.10.100 Address internal Front End  or Director for internal network clients 
    A admin.domain.com
    192.168.10.100 URL Administration pool
    A DialIn.domain.com
    192.168.10.100 URL Access to Dial In 
    A meet.domain.com
    192.168.10.100 URL of Web services meeting
    A lyncdiscoverinternal.domain.com
    192.168.10.100 Register for Lync AutoDiscover service to internal users
    A lyncdiscover.domain.com
    192.168.10.100 Register for Lync AutoDiscover service to external users  
    SRV Service: _sipinternaltls Protocol: _tcp Port: 5061
    sip.domain.com Record pointer services to internal customer connections using TLS 
    External DNS pointing Edge & Proxy
    Type of Record FQDN
    IP Endpoint
    A sip.domain.com
    x.x.x.100 Edge
    A webconf.domain.com
    x.x.x.100 Edge
    A av.domain.com
    x.x.x.100 Edge
    SRV _sip._tls.domain.com
    sip.domain.com: 443 Edge
    SRV _sipfederationtls._tcp.domain.com
    sip.domain.com:5061 Edge
    A Meet.domain.com
    x.x.x.110 Reverse Proxy
    A Dialin.domain.com
    x.x.x.110 Reverse Proxy
    A lyncdiscover.domain.com
    x.x.x.110 Reverse Proxy
    A lyncweb.domain.com
    x.x.x.110 Reverse Proxy
    In IIS ARR proxy server following server farms are added and configured as per link ttp://y0av.me/2013/07/22/lync2013_iisarr/
    In proxy server had setup only following server farm : While running remote connectivity web service test : meet, dialin, lyncdiscover and lyncweb.
    The client inside works fine internally and through vpn. Login with external client also working fine. But we are getting error in MRCA as follows.
    a) While testing remote connectivity for lync getting error : The certificate couldn't be validated because SSL negotiation wasn't successful. This could have occurred as a result of a network error or because of a problem with the certificate installation.
    Certificate was installed properly.
    b) For remote web test under Lync throws error : A Web exception occurred because an HTTP 502 - BadGateway response was received from IIS7.
    HTTP Response Headers:
    Content-Length: 1477
    Content-Type: text/html
    Date: Wed, 14 May 2014 10:03:40 GMT
    Server: Microsoft-IIS/8.0
    Elapsed Time: 1300 ms.
    Regards, Ganesh, MCTS, MCP, ITILV2 This posting is provided with no warranties and confers no rights. Please remember to click Mark as Answer and Vote as Helpful on posts that help you. This can be beneficial to other community members reading the thread.

Maybe you are looking for

  • Can I download to time capsule?

    Can I use time capsule like a normal hard drive. I want to be able to stream movies from TC to other devices.

  • Photo quality on i-movie HD

    After inserting photos into i-movie and applying the Ken Burns effect the motion causes problems with the photo. Lines appear in areas and the whites of peoples eyes flicker as the motion is played. Is there any way to keep the resolution of the phot

  • Using NetBeans and Eclipse to drag and drop forms, controls etc

    Hi, can you use NetBeans and Eclipse to drag and drop like say with C# in MS Visual Studio ? like forms and listboxes, textboxes etc ??

  • Unable to write to a UNC path from a SAP program

    Hi All We have just migrated our first server in an OS/DB migration from UNIX to Windows and the developers are trying to convert all our jobs/programs in SAP to write to Windows UNC paths instead of unix directories but we cannot get it to write fil

  • An object name for the command sh hardware fabric-utilization on Nexus

    Hello, does the customer use SNMP for the monitor a fabric-utilization on Nexus?? He wants to monitor values from the command "sh hardware fabric-utilization": sh hardware fabric-utilization > ------------------------------------------------ > Slot