Issue with case when try to modify the siimple query

Hello PL/SQL Gurus/Experts,
I am stuck with an issue (could be simple) but not gettings any headsway -
select 365/day_num_yr Anul_Fact from Date where date_dt = trunc(sysdate -1) value returns is as - 1.46
need to write this in the form of case (as i need to multiply this to some other outer query), i want to store it ina variable and and then use the same in outer one -
but when use the following then it is always returning the value as 0 and not the same output as returned by the above query without case.
select (case when date_dt =trunc(sysdate -1) then 365/day_num_yr else 0 END) Anul_Fact Kindly help, i appericate your time and effort in advance.

Thanks for providing the Drop table and CTAS script. It eased the job of creating sample data;
I only used few data from the table:
drop table T4;
create table T4(day_num_yr, date_dt) as
select 249, to_date('09/05/2012', 'MM/DD/YYYY') from dual union all
select 250, to_date('09/06/2012', 'MM/DD/YYYY') from dual union all
select 251, to_date('09/07/2012', 'MM/DD/YYYY') from dual union all
select 252, to_date('09/08/2012', 'MM/DD/YYYY') from dual;
select date_dt, sysdate - 1 prev_dt, trunc(sysdate - 1) trunc_prev_dt,
       case when date_dt = trunc(sysdate - 1) then 365 / day_num_yr
            else 0
       end num_day
  from t4;
DATE_DT                   PREV_DT                   TRUNC_PREV_DT             NUM_DAY               
05-SEP-12                 06-SEP-12                 06-SEP-12                 0                     
06-SEP-12                 06-SEP-12                 06-SEP-12                 1.46                  
07-SEP-12                 06-SEP-12                 06-SEP-12                 0                     
08-SEP-12                 06-SEP-12                 06-SEP-12                 0See the output. For Date_DT as 6-Sep, i.e. a Day before Today, we are getting the Output, but for other dates we are not.
One another suggestion I would like to make is, (assuming) you are using the Table only for storing the Current day of Year and not including Public Holidays etc. then you can use a 'DDD' format model to get the Current Day of year starting 1 Jan.
Something like below:
select date_dt, sysdate - 1 prev_dt, trunc(sysdate - 1) trunc_prev_dt,
       case when date_dt = trunc(sysdate - 1) then 365 / to_char(date_dt, 'DDD')
            else 0
       end num_day
  from t4;

Similar Messages

  • Report hanging (when try to modify the report)

    Post Author: aneel
    CA Forum: WebIntelligence Reporting
    Hi All,
    This becomes a longlosting issue for me Please anyone look into this.
    I have created one report with 6 global and 3 local filters, 12 local variables.
    When I try to modify the webi report it strucks up and keeps on running continuously with out giving any kind of result.
    Please reply anyone !!!!!!!!!

    Post Author: jsanzone
    CA Forum: WebIntelligence Reporting
    Vinl,
    The WebI (and BOE XI server) is not completely tuned out of the box to support multiple data providers and large data sets.  There are tuning parameters that must be set (and which will cause more memory usage, etc, etc) and must be monitored to expand performance in order to resolve unwanted timeouts.  If you are not the administrator, then you'll have to work with him or her (and possibly open a trouble ticket with tech support for more help, if needed).
    The timeout aspect is frustrating.  We have three servers, development, testing, and production.  The development system is totally off-line and not under any security-lockdown influences.  Testing is our pre-stage and was built by our BI team.  And production is in the server farm built by the Sysadmins.  Of the three servers, only the production server suffers from a two-minute WebI timeout (and Infoview timeouts where the report just spins all day without a response, but in WebI at least we get an ugly "error notice" when the two-minute timeout occurs).  We think that some kind of lockdown was performed on our production server that causes the two-minute timeout for an executing report to occur.  On the one hand it keeps us sharp in not building reports that will make the user wait a long time, and to encourage them to schedule a report through scheduler when it will take longer than two minutes to execute.  On the other hand it can be troublesome to maintain a report that takes so long to run in terms of modifications and corrections.  At times I've had to go into the datawarehouse and rename a production table to something else, then create a mini-version of that production table in order to run the report and modify it (all done in the off-hours of course), and then when done modifying the report, delete the mini-version of the production table and rename the off-named production table back to its original name in order to press on.  The things we gotta do to press on with life....  Good luck, and hang in there Vinl.

  • Hello, Im new to this website. Im having issues with my Macbook. I have the old 2009 model Macbook and it is our schools macbook. The school just upgraded these MacBooks to OSX Mavericks and when i try to open Minecraft it won't let me. It says no jd

    Hello, Im new to this website. Im having issues with my Macbook. I have the old 2009 model Macbook and it is our schools macbook. The school just upgraded these MacBooks to OSX Mavericks and when i try to open Minecraft it won't let me. It says no jdk installed. I also try to install Java SE runtime but half way through the Software Update it says cant download software because of network problem but I'm connected to the internet and i can browse stuff just fine. Can any one help with my problems. P.S. I don't know the administrator password or stuff like that. And yes we are allowed to play games and stuff on these laptops but only at home not at school so don't tell me i need to focus on school and not games. 

    Since you updated the operating system, it is probably Minecraft is missing certain files that ware remove or are not longer comparable with the new version of the OSX. what I recommend, is to check is there is an update for Minecraft and install that. If there is not update available, probably the best thing will be reinstalling Minecraft. Hope this will help you.   

  • I have a 17" Macbook pro with flickering red and cyan(blue) lines across the screen. The issue disappears temporarily when I tap on the computer, and the problem does not occur when I use external display or try to screen capture the problem.

    I purchased my Macbook (17") through a certified apple tecnition in August 2012, it was refurbished and the motherboard was completely replaced. I do a lot of photo editing, but I have been unable to do so because of the red vibrating lines that interrupt my screen. The issue disappears temporarily when I tap on the computer, and the problem does not occur when I use external display or try to screen capture the problem. I brought the computer back to the technition I purchased it from and he said that it was a problem with my fan, so I have two new fans but the issue is still occuring. He says he doesnt know whats wrong. Does anyone have any information on this issue?
    Here is an image of the issue
    http://www.flickr.com/photos/67839707@N08/8884847081/

    I recommend having your Mac serviced by someone competent. A force sufficient to "blow apart" the fans was clearly excessive and may have damaged the display cable, as well as any number of other problems.
    Dust is properly cleaned with a vacuum, preferably one designed for computer service, and they are not cheap.
    Compressed air should never be used. It just blows dust everywhere, often into places where it can no longer be removed.

  • TS1398 I have the ipad retina display version - I have a BIG issue with this when out and about that on about 50% of the time will it see my HTC mobile WiFi hotspot - rebooting either, or both devices doesn't cure the problem it drives me MAD!!!!

    I have the ipad retina display version - I have a BIG issue with this when out and about, that only about 50% of the time will it see my HTC mobile WiFi hotspot - rebooting either, or both devices doesn't cure the problem it drives me MAD!!!!
    The HTC hotspot works fine with everything else I connect to it.
    Also - ipad will not connect to my HTC via bluetooth. Again, I can connect to everything else with my HTC other than my ipad.
    I have to say this is my first venture into Apple products and I have always wanted to get away from my windows based laptop to get a MacBook, the problems I have had (flash player etc) & continue to have (as above) are putting me right off swapping over. I HATE technology that doesn't work and my ipad has been hard work!

    I stated my ipad as being an ipad2, but I now think it is a 3??? It was new Jan this year and is the 64gb retina display version.
    I really would like to get to the bottom on this problem wit mobile hotspots as it is sitting on my desk next to me now and I cannot get it to connect to my HTC mobile hotspot!!!! It might be taking a flying lesson soon at this rate!!! Grrrrrrr...........

  • I am having issues with MLBtv, when I switch on my ATV it no longer comes up as an option nor does vimeo or the iTunes store, i've tried resets etc and after those they appear. put the tav into sleep mode and mysteriously they don't re appear. Any ideas?

    I am having issues with MLBtv, when I switch on my ATV it no longer comes up as an option nor does vimeo or the iTunes store, i've tried resets etc and after those they appear. put the tav into sleep mode and mysteriously they don't re appear. Any ideas?

    I am having the same issue but mine is with Netflix.  And there are only 4 categories now on the main menue when there used to be 5.  Something went crazy with ATV software.

  • Ok, i am not terribly familiar with the program premiere elements 12 as of yet, i am having some difficulty at times, current issues...when in play mode, the timeline marker? hiccups backwards then forward as it plays, some of my image clips freeze and do

    ok, i am not terribly familiar with the program premiere elements 12 as of yet, i am having some difficulty at times, current issues...when in play mode, the timeline marker? hiccups backwards then forward as it plays, some of my image clips freeze and don't play while the marker keeps going, this also happens when on full screen mode...what do i need to do to correct this problem...currently i am working this on my mackbook 2009.  thankyou for your reply.

    <moved from Downloading, Installing, Setting Up to Premiere Elements>

  • IPhoto will not open with pictures when I click on the icon.  It does show that it is open on top toolbar. What happened to my photos?

    iPhoto will not open with pictures when I click on the icon.  It does show that it is open on top toolbar. What happened to my photos?

    Did you run any updaters recently, i.e. like just before this happened?  Try this first fix: make a duplicate copy of the library and try the following:
    1 - delete  the iPhoto preference file, com.apple.iPhoto.plist, that resides in your Home/Library/Preferences folder. 
    2 - delete iPhoto's cache file,, Cache.dbt, that is located in your Home/Library/Caches/com.apple.iPhoto folder. 
    3 - reboot, launch iPhoto and try again.
    NOTE: If you're moved your library from its default location in your Home/Pictures folder you will have to point iPhoto to its new location when you next open iPhoto by holding down the Option key when launching iPhoto.  You'll also have to reset the iPhoto's various preferences..
    OT

  • Issue with VO which is attached to the picklist

    Hi,
    Currently i have an issue with VO which is attached to the picklist
    if i try to attach the same VO (but query changed) to diff picklists , the picklists are overridden with last executed query (all the code is inside a loop)
    while(rs.next()) {
    String lookupDefn=rs.getString(2);
    if (lookupDefn!=null) {
    id="InputValue_Lookup"+count_lookup;
    OAMessageChoiceBean oamessage=(OAMessageChoiceBean)webBean.findIndexedChildRecursive(id);
    oamessage.setPickListCacheEnabled(false);
    if (oamessage!=null) {
    ElementInputValuesVOImpl oaviewobject = (ElementInputValuesVOImpl)am.findviewobject(ElementInputValuesVO1)
    if(!(oaviewobject ==null))
    oaviewobject.setWhereClause("lookup_type = '" + lookupDefn + "'");
    oaviewobject.executeQuery(); //Setting where clause Dynamically of Poplist VO
    // System.out.println("Query is"+);
    oamessage.setPrompt(rs.getString(1));
    oamessage.setListViewObject(pageContext, oaviewobject);
    oamessage.setListDisplayAttribute("Meaning");
    oamessage.setListValueAttribute("lookup_type");
    oamessage.setPickListCacheEnabled(false);
    any one please help :)

    Use different instances of the VO for each picklist.

  • HT4623 Is anyone else having issues with scaling down photos to fit the screen for home and lock screens with ios7??

    Is anyone else having issues with scaling down photos to fit the screen for home and lock screens with ios7??  Installed ios7 this morning. Tried to use one of my photos from camera roll as background for lock screen and I can't scale the photo to fit the screen.  Never had a problem before and now when I pinch the photo to get it to the right size of the screen, it won't stay that way. The photo is enlarged way beyond the screen size so it doesn't look right. Does anyone know how to fix this?

    Hello, cliffiapp4.  
    Thank you for visiting Apple Support Communities.  
    Here are the steps that I would recommend going through when experiencing this issue.  
    Resolution
    If a single application is not responding or stops responding when it opens, you can force it to close.
    If the device is unresponsive or if certain controls aren't working as expected, restart your device.
    If the device remains unresponsive or does not turn on (or power on), reset your device.
    If the above steps do not resolve the issue, contact Apple.
    iOS: Not responding
    http://support.apple.com/kb/TS3281
    Cheers, 
    Jason H.  

  • Wheni try to use the VHScrCap as video the Adobe flash media live encoder 3.2 just closes?

    Wheni try to use the VHScrCap as video the Adobe flash media live encoder 3.2 just closes?
    how do i fix this?

    Moving the discussion to Flash Media Forum.
    Regards,
    Anit Kumar

  • I am having font issues with font book. It validates the font, yet it is not availabe in my software programs (Adobe  or Microsoft). What can I do to use these fonts?

    I am having font issues with font book. It validates the font, yet it is not availabe in my software programs (Adobe  or Microsoft). What can I do to use these fonts?
    I actually created these fonts with fontagrapher in 1998 and have been using them regularly ever since and now they are not available in InDesign. I really need to use them.

    I found a page on Adobe, Troubleshoot fonts | Mac OS X
    On PostScript type 1 fonts you need to copy/move the fonts to the correct font folder because Font Book doesn't copy them into the folder. Select the fonts double-click the fonts and Find in the font Book app and validate.
    The correct font folder depends how you are set up. I am by myself so my font folder was MyHarddrive/Library/Fonts. I was using Suitcas fusion and the fonts are located in a different folder.
    Most of the fonts have worked. Go to
    http://helpx.adobe.com/x-productkb/global/troubleshoot-fonts-mac-os-x.html
    This should help. Good Luck.

  • HT201406 I pod-touch touchscreen does not respond, when try to slide the slidder to turn unlock the device it won't respond

    Hello,
    please help. when try to slide the slidder to turn onlock it won;t respond.

    Try:
    - A reset. Nothing is lost
    Reset iPod touch: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Restore from backup
    - Restore to factory settings/new iPod
    If still problem that indicates a hardware problem and an appointment at the Genius Bar of an Apple store.

  • After Compressing file with Compressor when somthing move in the picture

    After Compressing file with Compressor when somthing move in the picture , it will get a kinda interlaced in the edges of it , the orginal files was Uncompressed DV and I add subtitle on it and then used the 90 min best dvd preset for it .
    I really need some help .
    thanks a lot .

    I would take  a step back here before going further.  William's suggestion might very well clean up the library but something obviously did not go right and to start mucking about in the library might make things worst.
    For starters I'm surprised to see the folder structure you showed in your first post. Aperture stores managed masters (originals) by import date and time. The structure (in all libraries I've ever seen) looks like:
    So something seems wrong with your master folder.
    Also the three folders you showed the first and third are identical ( the middle one has the (1) added to which is how the OS handles duplicates in a folder) so this shouldn't even be possible, those folders should not be there.
    I'm wondering if this is something left over from your using Duplicate Annihlator. Do you have a copy of the library before you ran the merge and used DA on it? Would be interested to see what the master folder looks like.
    Finally when you ran the merge which library did you tell Aperture to use as the master, the one that was used to resolve conflicts?
    Again William's suggestion might be all you need to do but it would be good to figure out want went wrong before proceeding.
    regards
    Message was edited by: Frank Caggiano - A better first step might be to run the Aperture first aid tools, repairing and possibly rebuilding the library.

  • Modifying the sql query in doDML of entity

    I am using Jdev 11.1.1.4.0 and SQLServer Database
    I want to modify the sql query in "doDML(int operation, TransactionEvent e)"
    I could check what kind of operation like (operation == DML_UPDATE) and do some additional stuff.. But I want to edit the query because of which we entered doDML..
    I want to edit the query because when i use SQLServer database with SQLBuilder as SQL92, the update statement will have table alias like "update table <table alias>" which the SQLServer is not recognizing.. So I want to remove that alias from sql query in doDML..

    It isn't possible.
    However as per the following MSDN page a table alias is fine in an UPDATE statement so are you sure this is your problem?: http://msdn.microsoft.com/en-us/library/aa260662(v=sql.80).aspx
    CM.

Maybe you are looking for

  • How do you reference a valueObject located in main to a custom component created in Catalyst?

    Hello, I have been working with the Catalyst Beta 2 / Flash Builder beta trying to create a photogallery and have hit a little bit of a snag, try as I might I can't seem to find the answer anywhere. I am still new to Flex so please excuse me if this

  • Lightroom5 to Photoshop Elements

    A while ago I downloaded Lightoom 5 and Photoshop 6 as a trial. As I decided not to have monthly financial commitments and chose to opt out of the cloud. Instead I purchased Lightroom 5 and Photoshop Elements. Unfortunately when I want to open my ima

  • Eclipse ME with SDK 3.0 problem

    Hello, There is actually a thread a few below this one on the same issue, but it has been locked as someone bumped it from many pages down. My problem is that I can no longer run my Java ME projects on the emulator in Eclipse, having just changed fro

  • Airport Express in Cisco Business

    Hello! We got a Cisco Wireless Business network setup. Two Cisco 521 Accesspoints and a Cisco Wireless Controller 526. Encrypted with AES on WPA2 Personal. Everything is working fine, all windows and mac os x computers/laptops work on it. But after w

  • Error 'Handling unit was not blocked - action cancelled' for Packing

    Hi Friends I am trying to execute Functional Module  HU_PACKING_AND_UNPACKING  to Pack Sales Order Line Items in to HU. But System is throwing unusual error Handling unit was not blocked - action cancelled The Other SAP SDN thread advised to implemen