Function MAX to get the recent date does not work as expected

Hello
I recently started working on Oracle and came across this problem. I've coded below, given the query to obtain the most recent date in the table and compare with Sysdate + 1 timestamp. I am not able to understand what I coded wrong but the query gives me bad such results as explained below:

Select NVL (MAX (to_char (max (last_update),' dd/mm/yyyy hh12:mi: ss AM')), to_char (sysdate + 1, ' dd/mm/yyyy') |') 12: 00')
of Audit_Table_Name
where col1 = 'AA '.
and location_type = 'STATE '.
and original_flag = 'Y '.
Group of col1, location_type, original_flag;


Here Max (last_update) of value Audit table contains--> 25/08/2009 12:00:00 AM
Note: The last_update data type is Date
If ideally, it should give 26/08/2009 12:00:00 AM, but surprisingly it gives 25/08/2009 12:00:00 AM as output. Can someone explain why this is happening and what to do to get the correct results?

Kind regards
Amol

user11826653 wrote:
Hello
I recently started working on Oracle and came across this problem. I've coded below, given the query to obtain the most recent date in the table and compare with Sysdate + 1 timestamp. I am not able to understand what I coded wrong but the query gives me bad such results as explained below:

Select NVL (MAX (to_char (max (last_update),' dd/mm/yyyy hh12:mi: ss AM')), to_char (sysdate + 1, ' dd/mm/yyyy') |') 12: 00')
of Audit_Table_Name
where col1 = 'AA '.
and location_type = 'STATE '.
and original_flag = 'Y '.
Group of col1, location_type, original_flag;

Here Max (last_update) of value Audit table contains--> 25/08/2009 12:00:00 AM
Note: The last_update data type is Date
If ideally, it should give 26/08/2009 12:00:00 AM, but surprisingly it gives 25/08/2009 12:00:00 AM as output. Can someone explain why this is happening and what to do to get the correct results?

Kind regards
Amol

Your sysdate + 1 is the second half of your NVL function it will return only sysdate + 1 when max) last_update) is set to null. I think what you need is

select to_char(greatest(max(last_update),trunc(sysdate)+1),'mm/dd/yyyy hh:mi:ss AM') 

Tags: Database

Similar Questions

  • Question of Safari and Chrome. indicates on the navigation screen. "An element of the Protection of the family filter does not work as expected. Restart your computer. If the problem persists, contact support.  Error: failed to hose CPI. »

    Question of Safari and Chrome. indicates on the navigation screen. "An element of the Protection of the family filter does not work as expected. Restart your computer. If the problem persists, contact support.  Error: failed to hose CPI. »

    Quit Safari, Chrome to quit smoking. If necessary Forcequit.

    Start Safari while holding the SHIFT key, select the menu Safari ClearHistory, then after this check that the homepage is the one you want.

    Do the same for Chrome.

    Close all browsers, restart the mac.

  • Get the error, Drivermax does not work in Compatibility Mode

    I installed an updated driver called drivermax, but whenever I try to download the updates, it says does not work in compatibility mode, change back the settings to devices.exe. I don't know what they mean or how to do that, someone has an idea?

    Please make sure that you have installed the latest version of DriverMax, this problem should be solved. Anyway, please contact us at http://www.innovative-sol.com/contact/ and we will do our best to help you.

  • Help! The Liquify tool does not work as expected in Photoshop CC.

    I used CS5 for a few years and used the Liquify tool very frequently without problem. I joined Photoshop CC 2 weeks and have been having this problem with the tool:

    When I use the bloat, pinching or rebuild, it seems not too do its function and completely distorts the picture, even with a simple click. If I move the cursor even by a millimeter, the entire image is sucked into a white circle with the size of the brush. See examples (I used the bloat for these):

    Single click with brush density 50:

    Bloat Fail.jpg

    Single click with a density of 0:

    Bloat Fail 2.jpg

    Proposed by a tiny little slider to the right:

    Bloat Fail 3.jpg

    I tried to adjust the density of the brush, the brush rate. Photoshop I rebooted several times. I searched online for a solution and tried the 'Kelby trick' by pressing SHIFT while starting up of Photoshop. None of these work. I had only CC for two weeks and have not changed any settings (except the States history increased to 99) and have not installed plug-ins or anything.

    Any ideas how to solve this problem? It was one of my favorite tools!

    Hello, if you click ALT + liquefy in the menu filter, it will run in mode CPU, so you can check if get it different behaviors.

  • Stick to the original Position does not work as expected

    Experiencing a bug "Stick to the initial Position": the copied sequence is stuck slightly forward with regard to the point of law

    What are the LPX and OS X versions?

  • I get the message: firefox does not when I try to browse the web sites

    For some time now, when I load a web site, it takes a long time to load and then I get the message: firefox does not, or long-running script and does not. This occurs on many web sites, and when that happens, it takes a long time to browse this web site. I also have this problem on other browsers. Any suggestions as to what might help? Thank you.

    Hello

    Many issues of the site can be caused by corrupted cookies or cache. To try to solve these problems, the first step is to clear cookies and cache.
    Note: This will be you temporarily disconnect all sites, you're connected to.
    To clear the cache and cookies to do the following:

    1. Click the menu button

      , choose historic, then "Claire recent history...". ».

    2. Under "Time range to clear", select "all".
    3. Now, click the arrow next to details to toggle the active details list.
    4. In the list of details, see the Cache and Cookies and uncheck everything.
    5. Now click on the "Clear now" button

    More information can be found in the article remove the navigation, search and download history on Firefox .

    This solve your problems? Please report to us!

    Thank you.

  • No matter what I try to play, I get this message, "Windows Media Player has encountered a problem while playing the file." And the media player does not work

    Windows Media Player

    No matter what I try to play, I get this message, "Windows Media Player has encountered a problem while playing the file."  And the media player does not work

    Reset the WMP.

    Step by step instructions are given here: -.

    http://www.mydigitallife.info/how-to-uninstall-and-re-install-Windows-Media-Player-12-WMP12-in-Windows-7/

  • I can't get my updates. the Windows Installer does not work how to fix it

    I can't get my updates. and I can not install other programs. the Windows Installer does not work. How can I fix?

    http://support.Microsoft.com/kb/2438651#reso1

    See the above article, I suggest you use not Fixit, but it's your choice.

    For manually fixit it you follow the steps in the resolution.

    fyip

  • Urgent - the sound recorder does NOT work after getting the window system 7 (64-bit)

    I have a problem with the sound recorder. After that I got the system with Windows 7 (64-bit), the sound recorder does not work. It's very urgent because I need to procticing my English pronunciation and the test day is coming.

    Please would you give me help? I really appreciate!

    Thank you very much.

    Eleanor

    A prompt by right clicking and select "Run as Administrator"
    and then at the command prompt, type: chkdsk /f r, then press the Enter key.

    If you are asked to plan the volumn to check the next time that the system restarts,
    Enter: y

    If you know the manufacturing of your hard drive you can also download their diagnostic software.

    Another use: SpeedFan has an online health analysis function
    (SMART tab) for hard drives. It will show how your disks
    compared with other discs of the same brand and model.
    http://www.almico.com/SpeedFan.php

    ========================================================================

    Run the SFC/scannow command. This will check and repair if necessary all of the critical Windows system files.

    Click on start / all programs/accessories then
    Right-click on the command prompt option and select "Run as Administrator".
    (or "Safe Mode" open a command prompt)
    At the command prompt, enter: SFC/scannow

    Windows 7 - order SCANNOW SFC - System File Checker
    http://www.SevenForums.com/tutorials/1538-SFC-SCANNOW-Command-System-File-Checker.html

    How to use the System File Checker tool to fix the system files missing or corrupted on Windows Vista or Windows 7
    http://support.Microsoft.com/kb/929833

    How to analyze the entries in log file generating the program Checker (SFC.exe) resources of Microsoft Windows in Windows Vista:
    http://support.Microsoft.com/kb/928228

    J W Stuart: http://www.pagestart.com

  • When I complete and sign a form and then print it out, the form data does not print.

    When I complete and sign a form and then print it out, the form data does not print. The form fields are empty with the exception of any signature.

    Thank you. Depending on your answer, I have compiled a procedure:

    Fill & sign a form in Adobe CD and print the form fields:

    (1) open the document.

    (2) click on tools - prepare the form. All fields are displayed in a vertical list in the bottom right of the screen.

    3) click on the first field in the list, scroll to the bottom of the list and shift-click to select all.

    4) click on the first field in the document, make a right click, select Properties.

    (5) on the general tab, uncheck the box locked in the lower left corner. Under field properties common form, select Visible and uncheck the read-only box, close.

    (6) print out and save the file.

    Note: even if you select all the fields in the document in step 3, this procedure may work for the fields on page 1. In this case, repeat steps 3 through 5 for each subsequent page.

  • offline activation code how can I get a when the site getactivated does not work?  MSG: failed to process your request. Please try again later.  Help!

    Activation code offline - how to do when the site: getactivated does not work?  MSG: Failed to process your request. Please try again later.    Help!

    Since this is an open forum, not Adobe support... you must contact Adobe personnel to help
    Chat/phone: Mon - Fri 05:00-19:00 (US Pacific time) <===> NOTE DAYS AND TIME
    Don't forget to stay signed with your Adobe ID before accessing the link below

    Creative cloud support (all creative cloud customer service problems)
    http://helpx.Adobe.com/x-productkb/global/service-CCM.html

  • my browser cannot open google and facebook and other https sites that it does not open even the app store does not work, I tried to change my DNS google DNS and disable IPv6 but still no use, help PLZ!

    my browser cannot open google and facebook and other https sites that it does not open even the app store does not work, I tried to change my DNS google DNS and disable IPv6 but still no use, help PLZ!

    You may have installed one or more variants of the malware "VSearch' ad-injection. Please back up all data, and then take the steps below to disable it.

    Do not use any type of product, "anti-virus" or "anti-malware" on a Mac. It is never necessary for her, and relying on it for protection makes you more vulnerable to attacks, not less.

    Malware is constantly evolving to work around defenses against it. This procedure works now, I know. It will not work in the future. Anyone finding this comment a couple of days or more after it was published should look for a more recent discussion, or start a new one.

    Step 1

    VSearch malware tries to hide by varying names of the files it installs. It regenerates itself also if you try to remove it when it is run. To remove it, you must first start in safe mode temporarily disable the malware.

    Note: If FileVault is enabled in OS X 10.9 or an earlier version, or if a firmware password is defined, or if the boot volume is a software RAID, you can not do this. Ask for other instructions.

    Step 2

    When running in safe mode, load the web page and then triple - click on the line below to select. Copy the text to the Clipboard by pressing Control-C key combination:

    /Library/LaunchDaemons

    In the Finder, select

    Go ▹ go to the folder...

    from the menu bar and paste it into the box that opens by pressing command + V. You won't see what you pasted a newline being included. Press return.

    A folder named "LaunchDaemons" can open. If this is the case, press the combination of keys command-2 to select the display of the list, if it is not already selected.

    There should be a column in the update Finder window. Click this title two times to sort the content by date with the most recent at the top. Please don't skip this step. Files that belong to an instance of VSearch will have the same date of change for a few minutes, then they will be grouped together when you sort the folder this way, which makes them easy to identify.

    Step 3

    In the LaunchDaemons folder, there may be one or more files with the name of this form:

    com Apple.something.plist

    When something is a random string, without the letters, different in each case.

    Note that the name consists of four words separated by dots. Typical examples are:

    com Apple.builins.plist

    com Apple.cereng.plist

    com Apple.nysgar.plist

    There may be one or more items with a name of the form:

    com.something.plist

    Yet once something is a random string, without meaning - not necessarily the same as that which appears in one of the other file names.

    These names consist of three words separated by dots. Typical examples are:

    com.semifasciaUpd.plist

    com.ubuiling.plist

    Sometimes there are items (usually not more than one) with the name of this form:

    com.something .net - preferences.plist

    This name consists of four words (the third hyphen) separated by periods. Typical example:

    com.jangly .net - preferences.plist

    Drag all items in the basket. You may be prompted for administrator login password.

    Restart the computer and empty the trash.

    Examples of legitimate files located in the same folder:

    com.apple.FinalCutServer.fcsvr_ldsd.plist

    com Apple.Installer.osmessagetracing.plist

    com Apple.Qmaster.qmasterd.plist

    com Apple.aelwriter.plist

    com Apple.SERVERD.plist

    com Tether.plist

    The first three are clearly not VSearch files because the names do not match the above models. The last three are not easy to distinguish by the name alone, but the modification date will be earlier than the date at which VSearch has been installed, perhaps several years. None of these files will be present in most installations of Mac OS X.

    Do not delete the folder 'LaunchDaemons' or anything else inside, unless you know you have another type of unwanted software and more VSearch. The file is a normal part of Mac OS X. The "demon" refers to a program that starts automatically. This is not inherently bad, but the mechanism is sometimes exploited by hackers for malicious software.

    If you are not sure whether a file is part of the malware, order the contents of the folder by date modified I wrote in step 2, no name. Malicious files will be grouped together. There could be more than one such group, if you attacked more than once. A file dated far in the past is not part of the malware. A folder in date dated Middle an obviously malicious cluster is almost certainly too malicious.

    If the files come back after you remove the, they are replaced by others with similar names, then either you didn't start in safe mode or you do not have all the. Return to step 1 and try again.

    Step 4

    Reset the home page in each of your browsers, if it has been modified. In Safari, first load the desired home page, then select

    ▹ Safari preferences... ▹ General

    and click on

    Set on the current Page

    If you use Firefox or Chrome web browser, remove the extensions or add-ons that you don't know that you need. When in doubt, remove all of them.

    The malware is now permanently inactivated, as long as you reinstall it never. A few small files will be left behind, but they have no effect, and trying to find all them is more trouble that it's worth.

    Step 5

    The malware lets the web proxy discovery in the network settings. If you know that the setting was already enabled for a reason, skip this step. Otherwise, you should undo the change.

    Open the network pane in system preferences. If there is a padlock icon in the lower left corner of the window, click it and authenticate to unlock the settings. Click the Advanced button, and then select Proxies in the sheet that drops down. Uncheck that Auto Discovery Proxy if it is checked. Click OK, and then apply.

    Step 6

    This step is optional. Open the users and groups in the system preferences and click on the lock icon to unlock the settings. In the list of users, there may be some with random names that have been added by the malware. You can remove these users. If you are not sure whether a user is legitimate, do not delete it.

  • Open - recent items does not work in preview or Mellel (one third) word processor app

    The 'Open recent element' function under the file menu does not work in preview mode before and in a third of processing (Mellel) I use. It works very well until two weeks or two there. It works in Word,

    May be a corrupt .plist.

    Make a backup, preferably 2 backups on 2 separate drives.

    Quit the application.

    In Finder and hold the option/alt key while clicking on the menu item Go. Select the library. Then go to Preferences/com.apple.Preview.LSSharedFileList.plist. Move the .plist on your desktop.

    Restart your computer, open the application and test. If it works fine, delete the plist for the office.

    If the application is the same, return the .plist where you got it, crushing the latest.

    If you want to make your library user visible permanently, run the command in Applications/Utilities/Terminal Server below.

    chflags nohidden ~/Library/

    You will need to do after the updates.

    If it works, it should be a .plist to the other application.

  • I have a Hp and the micro build does not work how to fix this?

    Can someone help me please? I have a HP T5800 and the micro build does not work how can I solve this problem?

    Hello

    Check with HP, their drivers support and documentation online and ask in the forums about known issues.

    Support HP & drivers
    http://welcome.HP.com/country/us/en/support.html

    Contact HP
    http://welcome.HP.com/country/us/en/contact_us.html

    HP forums
    http://h30434.www3.HP.com/PSG/

    ========

    It's probably the pilots who are responsible and who may not really be later or they need to be
    re-installed anyway. The best way is to manually review using the methods below.

    References to Vista also apply to Windows 7.

    Control Panel - device - SOUNDS - look for HD Audio Manager - Mine said RealTek High
    Audio definition (this is an example and you can have an other name/maker).

    Write the description and the model double click on it - tab drivers - write down
    Version. Now click on update drivers who cannot do anything as MS is far behind certifying
    drivers. Then CLICK RIGHT on it and UNINSTALL - REBOOT - this will rebuild the driver
    stack.

    You can have the default windows or a former certified pilot and it's all or part of the
    issue.

    Now, go to the site of the manufacturer of the system and get the latest Audio/Sound drivers - download - SAVE - go to
    where you put - right-click on Reboot - RUN AS ADMIN-

    Check the Version tab of the driver in the Device Manager as the restoration of the sound card drivers often
    and then install the latest version. Restart and check after each test, not
    rare to have to run the pilot of 1 to 4 times or more. Just the version make sure you
    installed shows upward on the tab of the driver.

    Go to the site of the manufacturer of the device, and then search for the even more recent drivers and install repeat
    operating mode. Download - SAVE - go to where you put them - click on - RUN AS
    ADMIN - Reboot

    Look at the sites of the manufacturer for drivers - and the manufacturer of the device manually.
    http://pcsupport.about.com/od/driverssupport/HT/driverdlmfgr.htm

    Installation and update of drivers to 7 (updated drivers manually using the methods above is)
    to ensure that the latest drivers from the manufacturer of system and device manufacturers are are preferably)
    http://www.SevenForums.com/tutorials/43216-installing-updating-drivers-7-a.html

    ---------------------------------------------------------

    After the updated driver.

    Click with the right button on the speaker near clock - recorders - right click in the box - check see the
    Disconnected devices and show disabled devices - check your micro - highlight
    then on lower right properties. Make sure that the appropriate injector is selected and check
    other parameters - levels tab make sure that MUTE is disabled and APPLY / OK to change
    .

    Also in the search for some Audio Manager Panel (perhaps named after the manufacturer of the sound driver). Mine
    is the RealTek Audio Manager, yours can be quite different name if you have one.

    How to activate Audio devices hidden in Vista
    http://www.Vistax64.com/tutorials/143447-audio-device-enable-hidden-devices.html

    Connect one microphone, music player or other audio device to your computer
    http://windowshelp.Microsoft.com/Windows/en-us/help/b0e3d7fb-1b4a-4926-8254-65da289209261033.mspx

    Problems with sound and audio or no sound - a Mr Fixit
    http://support.Microsoft.com/GP/NO_SOUND

    Tips for solving common audio problems
    http://Windows.Microsoft.com/en-us/Windows7/tips-for-fixing-common-sound-problems

    The volume of the audio recorded by sound recorder in Windows Vista or in Windows 7 is less than
    in Windows XP (or Vista)
    http://support.Microsoft.com/kb/973446

    I hope this helps.

    Rob Brown - Microsoft MVP<- profile="" -="" windows="" expert="" -="" consumer="" :="" bicycle=""><- mark="" twain="" said="" it="">

  • My optical drive is not displayed in "Device Manager" the eject button does not work

    Latitude Dell with Windows 7

    My optical drive does not show in the "Device Manager", the eject button does not work - I can only eject through the pin hole.

    This means that the drivers are missing or that the disc is broken?

    I tried to restart.

    Thanks in advance

    Dave Roberts

    Original title: Reader in mind windows 7

    Its possible the drive has failed. Is this an internal or an external drive? In both cases, make sure that all cables are properly connected and functional, including the power cables. If its a USB external drive then try another USB port.

    But, assuming that you tried to update the drivers (get the latest compatible drivers on the manufacturers for your brand/model/OS(32/64 bit) PC support site and install to see if that helps - first set a system restore point)) and then see if this MS article helps - https://support.microsoft.com/en-us/mats/cd_dvd_drive_problems?wa=wsignin1.0

Maybe you are looking for