Cast operator: Can a date be cast in to a number? Can someone provide an eg

Hi guys,
Can someone tell me if a date can be cast in to a number data type? I happen to come across a few lines of code that suggested it might be done.But when I tried it out it gives me an error
ORA-00932: inconsistent datatypes: expected DATE got NUMBER"
Would be helpful if anyone provided an example..
Thanks.

user8716986 wrote:
Hi,
Thanks for the responses..
Sorry about the operator part.. Guess gt a lil confused with C++ while googling..
What I am looking fr is to convert '01-JAN-95' to something like this 20120901 (the format I mean).Why not say
"convert '01-JAN-95' to *19950101* "       or
"convert *'01-SEP-12'* to 20120901 "       ?
The code that I came across goes something like this...
CREATE MATERIALIZED VIEW SUB
AS
SELECT cast(SCT as char (3)) SCT,
cast(EFFECTIVE_DATE as number (9)) EFFECTIVE_DATE,
cast(CANCEL_DATE as number (9)) CANCEL_DATE,
where EFFECTIVE_DATE and CANCEL_DATE are of DATE data type...
I know this can be done using TO_CHAR and TO_NUMBER.. i.e
TO_NUMBER((TO_CHAR(EFFECTIVE_DATE,'YYYYMMDD'))) EFFECTIVE_DATE,
TO_NUMBER((TO_CHAR(CANCEL_DATE,'YYYYMMDD'))) CANCEL_DATE,Why do you want NUMBERs in those columns? Why not VARCHAR2s (or even DATEs)?
I can understand wanting to have output in the desired format, so maybe (just maybe) that justifies converting the DATEs to VARCHAR2s, but why convert those VARCHAR2s to NUMBERs? The properties of NUMBERs don't apply to them. That is, the results you get from averaging those numbers, or adding another NUMBER to them, or subtracting them, just aren't meaningful: you're liable to get results like 20120055. It's true, you can sort and compare those NUMBERs, but you can sort and compare the corresponding VARCHAR2s (and the corresponding DATEs) just as well.
If you really have to convert the DATE to a NUMBER in that format for some reason, then what you posted above (TO_NUMBER (TO_CHAR ...)) is the right way to do it.
These stmts give me the desired results .. but what I still would like to know is how is that the above CAST stmts work while when I try them they don't.They don't work for me. I get "ORA-00932: inconsistent datatypes: expected NUMBER got DATE".

Similar Messages

  • TS3694 Can up date my iPad 1 two ios 6 can you help

    Can u hlp me updat my iPad

    The iPad 1 can only run up to iOS 5.1.1. You cannot go to iOS 6.

  • How do I report my phone missing so that an alert can be put on the phone's serial number and someone can't try to reactivate it?

    I lost my phone Monday night and I can tell by the data usage that someone found it and doesn't intend to return it. I suspended it at that time. Someone told me that I should report it to Verizon so they can put an alert on the serial number so that someone can't try to reactivate it. How do I go about doing that?

    Call Phone Number
    800-922-0204  
    Talk to a Human
    Press #, then 6, then 0 when it asks for your number. EXISTING CUSTOMERS press 4, then say "Customer Service" then wait and enter last four of social security number.

  • Dynamic equivalent of the Java language CAST operator

    Hello,
    Here is what I want to do:
    I have an Object that contain "something" (I don't know at compilation time). And I want to do this call:
    Object myObject = new String("Hello");
    myMethod (myObject);
    having declared these:
    public void myMethod (Integer dInt);
    public void myMethod (String sString);
    I want the second method to be called. How can I do that?
    I'm looking for something like a dynamic equivalent of the Java language cast operator:
    ??? myMethod ( (myObject.getClass())myObject ); ???
    or ?? myMethod ( (myObject.castTo(myObject.getClass()) ) ; ??
    Thanks.

    How 'bout using the instanceof operator?
    Like this:
    public myMethod(Object obj)
    if (obj instanceof String)
    //do String stuff
    else if (obj instanceof Integer)
    //do Integer stuff
    }

  • 'CAST' operation ('?=' or 'MOVE ?TO')

    Hi Experts,
    Need your support to understand and fix below WD A error.
    The error is apearing due to casting taking place in Component Controller, could you please redirect me to fix it.
    Error:
    It was tried to assign a reference to a rereference variable using the
    'CAST' operation ('?=' or 'MOVE ?TO').
    However, the current content of the source variable does not fit into
    the target variable.
    Code:
    DATA lv_result TYPE REF TO if_wd_message_area.
      DATA lo_controller TYPE REF TO if_wd_window_controller.
    *&* Comments: Cast error happening at below point.
    lo_controller ?= wd_this->wd_get_api( ).
      CALL METHOD lo_controller->get_message_area
        RECEIVING
          result = lv_result.
      CLEAR lv_result.

    Hi.,
    What exacly u are trying to do., if u want to display message., use message manager., refer below code..
    *       get message manager
           data lo_api_controller     type ref to if_wd_view_controller.
           data lo_message_manager    type ref to if_wd_message_manager.
           lo_api_controller = wd_This1->Wd_Get_Api( ).
           CALL METHOD lo_api_controller->GET_MESSAGE_MANAGER
             RECEIVING
               MESSAGE_MANAGER = lo_message_manager
    *       report message
           CALL METHOD lo_message_manager->REPORT_ATTRIBUTE_ERROR_MESSAGE
             EXPORTING
               MESSAGE_TEXT              = 'Enter user name'  " message text
               ELEMENT                   =       lo_el_user " element
               ATTRIBUTE_NAME            = 'UNAME'   .  " attribute name
    hope this helps u.,
    Thanks & regards
    Kiran

  • Hi guys, an empty folder is stuck in my trash & I get this message: "The Finder can't complete the operation because some data in the folder can't be read or written. (Error code -36). It won't shift no matter how I try to Secure Empty trash. Any ideas?

    Hi guys, an empty folder is stuck in my trash & I get this message: "The Finder can’t complete the operation because some data in the folder can’t be read or written. (Error code -36). It won't shift no matter how I try to Secure Empty trash. Any ideas?

    The Time Machines Backup is formated as Mac OS Extended (Case Sensitive, Journaled), my mac is formated as Mac OS Extended (Journaled).
    The names on the file are all Uppercase
    When I try to copy the Aperture file, it copies about 70% of the file (it's about 33GB in size), and halfway through I get this error.
    I'm able to copy 99.99% of all of the images if I open the Aperture Folder using the "show package contents" under the backups using finder (Time Machine Backups>Backups.backupdb>CQ Macbook Air>2012-04-30-070933>HD.....>Pictures>Aperture Library). The only file I can't copy is that picture, which I'm totally ok with deleting, but Finder won't delete it for me. If nothing else works, I could copy the individual masters and re-create the folders, however I'd hate to do this as I would have to go through 10,000+ pics

  • I have been exporting lightroom webgaleries to my iweb site without any problem.  Suddenly I get the error message "finder can't complete the operation because some data can't be read or written" - error code -36 - thoughts?

    i have been exporting lightroom web galleries to my iweb site without any problem.  Suddenly I get the error message "finder can't complete the operation because some data can't be read or written" - error code -36 - and the move to the sites folder on my idisk fails..... thoughts?

    Try this community: MobileMe on my Mac: MobileMe: Apple Support Communities.
    And you can continue to use iWeb for some time to come. The following will explain:
    It's now confirmed that iWeb and iDVD have been discontinued by Apple. This is evidenced by the fact that new Macs are shipping with iLife 11 installed but without iWeb and iDVD.
    On June 30, 2012 MobileMe will be shutdown. HOWEVER, iWeb will still continue to work but without the following:
    Features No Longer Available Once MobileMe is Discontinued:
    ◼ Password protection
    ◼ Blog and photo comments
    ◼ Blog search
    ◼ Hit counter
    ◼ MobileMe Gallery
    All of these features can be replaced with 3rd party options.
    I found that if I published my site to a folder on my hard drive and then uploaded with a 3rd party FTP client subscriptions to slideshows and the RSS feed were broken.  If I published directly from iWeb to the FPT server those two features continued to work correctly.
    There's another problem and that's with iWeb's popup slideshows.  Once the MMe servers are no longer online the popup slideshow buttons will not display their images.
    Click to view full size
    However, Roddy McKay and I have figured out a way to modify existing sites with those slideshows and iWeb itself so that those images will display as expected once MobileMe servers are gone.  How to is described in this tutorial: #26 - How to Modify iWeb So Popup Slideshows Will Work After MobileMe is Discontinued.
    In addition the iLife suite of applications offered on disc is now a discontinued product and the remaining supported iApps will only be available thru the App Store from now on.
    HOWEVER, the iLife 11 boxed version that is still currently available at the online Apple Store (Store button at the top of the page) and those copies still on the shelves of retailers will include iWeb and iDVD.

  • Help with "The Finder can't complete the operation because some data in "iPhoto Library" can't be read or written. (Error code -36)" Any ideas on how to fix this?

    While trying to copy my iPhoto Library (49.61 GB) to an external hard drive, I receive the error message "The Finder can’t complete the operation because some data in “iPhoto Library” can’t be read or written. (Error code -36)"
    I need to move my library because I have no more disk space.  This was going to be step 1 followed by backing up to another EHD.
    More details: iPhoto version 9.6 (910.29) OX X Yosemite Version 10.10.1 (Mid 2011 Mac Book Air).  EHD= WD Elements 1 TB (purchased at B&H Photo where the sales associate formatted it for a Mac).
    Any step by step ideas for help are appreciated!  I've read through a few threads but need more step by step directions.

    That error message is an I/O error which can mean a number of things, among them a bad file.  Here's a couple of fixes you can try:
    1 - use the free version of  iPhoto Library Manager  to rebuild the library with the rebuild being created on the  EHD as follows:
    Using iPhoto Library Manager  to Rebuild Your iPhoto Library
    1 - download iPhoto Library Manager and launch.>Click on the Add Library button,
    2 -  select the library you want to add from those in the selection window.
    3 - make sure that in the rebuild window the checkbox  "Scavange orphaned photos" is checked.
    4 - now that the library is listed in the left hand pane of iPLM, click on your library and go to the Library ➙ Rebuild Library menu option
    5 - in the next  window name the new library and select the location you want it to be placed. Click on the Create button.
    Note 1: This creates a new library based on the LIbraryData.xml file in the library and will recover Events, Albums, keywords, titles and comments. However, books, calendars, cards and slideshows will be lost.
    Note 2:  Your current library will be left untouched for further attempts at a fix if so desired.
    When iPLM finishes it will display a log file entry showing which files it was unable to use in the rebuild.  Open the old library with iPhoto, locate and delete the photos that iPLM listed in its log.  Then try dragging the library to the EHD again.
    If the above fails continue with:
    2 - create a new, empty library on the EHD.  Use the paid version of iPhoto Library Manage to copy the events (1-2 at a time) to the new library on the EHD.  At one point iPLM may run into the bad file and be unable to copy the event.  You can check iPLM's log to see what file it is.  Then open that library, delete the file and either try to copy the entire library by dragging and dropping or contine with the copying of events from the old library to the new library.

  • "The Finder can't complete the operation because some data in "For Desta 008 SUR-BPBO-00019.tif" can't be read or written. (Error code -36)

        i'm trying to backup MacBook white 10.6.3 manually to my external HD but it gives me this error,"The Finder can’t complete the operation because some data in “For Desta 008 SUR-BPBO-00019.tif” can’t be read or written. (Error code -36). i tried taking the HD out, but it gives me the same error, so pls tell me what to do, i need the backup fast.

    Aint you quick to jump to conslusions? So becasue one thing isn't working of the hundreds of things I donwloaded doesnt work, my drivers are broken?
    Ok then, let me download some other things to make sure
    Minecraft: it worked ✓
    Firefox: it worked✓
    Synthesia: it worked✓
    iExplorer: it worked✓
    Pencil: it worked✓
    Flash: it worked✓
    Synfig was made in 2006, so it's not unlikely that it might not work for some people. By 'some people', I mean me. I was just asking if it was something on my side, but if that's all you got, I think it's highly unlikely that it's my fault. I don't even want it anymore, I got Flash Professional. I was just wondering. I could have sworn you used to write more detailed answers before jumping striaght to conclusions. 'Did this happen to you on anything else?' or maybe even 'Why don't you complain to them?' would have been fine.

  • The finder can't complete the operation because some data on iPhoto Library can't be read or written. Error code -36

    Hi,
    Installed a new startup drive and cannot access my photos. While copying/pasting iPhoto library from old to new drive I get,
    The finder can't complete the operation because some data on iPhoto Library can't be read or written.
    Getting help from Apple senior advisor caused more problems, was unable to boot up for a while. Back up now but still can't transfer iPhoto Library.
    Anyone seen this before?
    Thank you

    Linc and Larry, could you please have a look at this thread? Sorry, it is in German:
              Re: Fehlermeldung beim Verschieben von iPhoto
    The OP is trying to copy the iPhoto library to an external drive and getting "The finder can't complete the operation because some data on iPhoto Library can't be read or written. Error code -36". This happens even when copying to the same drive.  The destination drive is correctly formatted.
    The Console is showing a message I don't understand:
    03.06.14 18:26:40,990 Finder[1154]: NSFileCoordinator: Sending of a providerCheckin message was interrupted. Details: Connection interrupted
    Any idea what this means?

  • The Finder can't complete the operation because some data in "Adobe Acrobat" can't be read or written. (Error code - 36)

    I recently did a clean install on a 2011 MacBook Pro with Mavericks. Went to install Adobe Acrobat 9 with the DVD media and about 3/4 of the way through the install, the install stopped and the following window appeared:  The Finder can't complete the operation because some data in "Adobe Acrobat" can't be read or written. (Error code - 36).  I've tried to install a few times and get the same message.  Is Adobe Acrobat 9 incompatible with Mavericks.  I've seen some posts on Apple Support Communities indicating that it is indeed compatible, but no explanation why the error pops up. 

    The hard drive may be dying anyway, or the directory damaged because it is so full.  You should never let the hard drive get over 85% full.
    A -36 error is a read/write error.
    All you did with the power is reset the SMC.  Does nothing to reset everything to factory settings. 
    Do you have your original 10.4 installer discs for the MacBook?
    Is your data backed up?

  • The Finder can't complete the operation because some data in "Chronicles" can't be read or written. (Error code -36)

    The Finder can’t complete the operation because some data can’t be read or written.
    (Error code -36)
    What does this error code mean?

    I faced the same problem and i fixed it by going to applications - utility - disk utility and fixing the errors.

  • The Finder can't complete the operation because some data can't be read or written. (Error code -36)

    Since the upgrade to 10.9 I have the most annoying issue when copying files. I have a secondary drive for media in which I keeo my media on / Samples / Video etc. I keep an exact copy on 2 external drives.
    95% I can't copy the the new media across my drives without a few restarts. I get the following:
    The Finder can’t complete the operation because some data can’t be read or written.
    (Error code -36)
    This is not a permissions issue. I've checked every folder down the the exact file it calls on. Everyone has READ & WRITE. If I restart the computer after getting this message it will do a little bit more then get stuck on another folder or file and pop the message.
    If I do smaller chuncks, it seems to do better but not all the time.
    PLEASE someone, tell me you have seen this before and you have a workaround. This is killing me,
    All HD are OS Extended Journaled - No FAT
    MacBook Pro I7
    16GB RAM
    250SSD
    450SSD
    2TD Lacie FW800 External
    is the equation right now
    thanks in advance for any help

    Please read this whole message before doing anything.
    This procedure is a diagnostic test. It’s unlikely to solve your problem. Don’t be disappointed when you find that nothing has changed after you complete it.
    The purpose of the test is to determine whether the problem is caused by third-party software that loads automatically at startup or login, by a peripheral device, by a font conflict, or by corruption of the file system or of certain system caches.
    Disconnect all wired peripherals except those needed for the test, and remove all aftermarket expansion cards, if applicable. Start up in safe mode and log in to the account with the problem. You must hold down the shift key twice: once when you turn on the computer, and again when you log in.
    Note: If FileVault is enabled, or if a firmware password is set, or if the startup volume is a Fusion Drive or a software RAID, you can’t do this. Ask for further instructions.
    Safe mode is much slower to start up and run than normal, with limited graphics performance, and some things won’t work at all, including sound output and Wi-Fi on certain models. The next normal startup may also be somewhat slow.
    The login screen appears even if you usually login automatically. You must know your login password in order to log in. If you’ve forgotten the password, you will need to reset it before you begin.
    Test while in safe mode. Same problem?
    After testing, restart as usual (not in safe mode) and verify that you still have the problem. Post the results of the test.

  • The finder can't complete the operation because some data in "VIDEO_TS.BUP "can't be read or written (error code-36)

    the finder can't complete the operation because some data in "VIDEO_TS.BUP "can't be read or written (error code-36)

    I faced the same problem and i fixed it by going to applications - utility - disk utility and fixing the errors.

  • The Finder can't complete the operation because some data in "iPhoto Library" can't be read or written.(Error code -36)

    I have a backup from Time machine of my iPhoto and I get the above error when I try to restore them. Thae backup was done with Mountain Lion and I upgraded to Mavericks. The backup is on an external drive.
    Again this is the error:
    The Finder can’t complete the operation because some data in “iPhoto Library” can’t be read or written.(Error code -36)
    I have also tried going to earlier dated backup and get the same error.
    Any help would be greatly appreciated. Thank You

    That error message is an I/O error which can mean a number of things, among them a bad file.  Here's a couple of fixes you can try:
    1 - use the free version of  iPhoto Library Manager  to rebuild the library with the rebuild being created on the  EHD as follows:
    Using iPhoto Library Manager  to Rebuild Your iPhoto Library
    1 - download iPhoto Library Manager and launch.>Click on the Add Library button,
    2 -  select the library you want to add from those in the selection window.
    3 - make sure that in the rebuild window the checkbox  "Scavange orphaned photos" is checked.
    4 - now that the library is listed in the left hand pane of iPLM, click on your library and go to the Library ➙ Rebuild Library menu option
    5 - in the next  window name the new library and select the location you want it to be placed. Click on the Create button.
    Note 1: This creates a new library based on the LIbraryData.xml file in the library and will recover Events, Albums, keywords, titles and comments. However, books, calendars, cards and slideshows will be lost.
    Note 2:  Your current library will be left untouched for further attempts at a fix if so desired.
    When iPLM finishes it will display a log file entry showing which files it was unable to use in the rebuild.  Open the old library with iPhoto, locate and delete the photos that iPLM listed in its log.  Then try dragging the library to the EHD again.
    If the above fails continue with:
    2 - create a new, empty library on the EHD.  Use the paid version of iPhoto Library Manage to copy the events (1-2 at a time) to the new library on the EHD.  At one point iPLM may run into the bad file and be unable to copy the event.  You can check iPLM's log to see what file it is.  Then open that library, delete the file and either try to copy the entire library by dragging and dropping or contine with the copying of events from the old library to the new library.

Maybe you are looking for

  • Buttons that trigger forms fields in InDesign 5.5

    Hello, I have a 13 page InDesign doc that has hyperlinked text and buttons. When I export as an interactive PDF, I get the purple/pink form field bar at top. I have spent 8 hours trying to trouble shoot the issue (I have previously worked on similar

  • Macbookpro a1297 boot problem

    I bought an old macbook pro 17 inch a1297 and later found that it did not have hard drive. So I installed a new blank hdd n installed mountain lion. Laptop works fine but with a boot problem. I always have to disconnect the battery connector from the

  • Yet again with (probably) php/mysql issues

    Hello, everyone. I think I am setting a record for asking the most questions about basically the same thing, but here goes: Okay, I am trying to install a message board on one of my sites. I downloaded mysql 5 and made it possible for php to access i

  • Help I'm Going Crazy

    I recently purchased a G4 Titanium 1ghz with 1gb ram and all the other standard options. I was working fine, but the person I purchased it off of installed it with using the Spanish language. I decided to wipe the hard drive and put a fresh install o

  • How to remove an object from Buffer Cache

    Hi, I have a simple question. How can I remove an object from the Buffer Cache in Oracle 10gR2 ? I am doing some tuning tasks in a shared development database, so I can't do "alter system flush shared_pool" because it will affect other people who are