Problem with case when try to alter the query from siimple
Hello PL/SQL gurus and Experts.I'm stuck with a question (can be simple), but not gettings all headsway.
select 365/day_num_yr Anul_Fact from Date where date_dt = trunc(sysdate -1)
value returns is as - 1.46need to write it in the form of case (I have to multiply it to some other outer query), I want to store variable ina and then use the same in an outside -.
but when use the following syntax, then it always returns 0 and not the same output returned by the query above without the scabbard.
select (case when date_dt =trunc(sysdate -1) then 365/day_num_yr else 0 END) Anul_Fact
Help kindly, I appericate your time and effort in advance.
user555994 wrote:
Problem is that I do not get the output as 1.46, even the output is coming like the 0 only if using the query - nextselect /*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 date_dim;
Completely, which seems to be a question of DATA. Have you checked if the table contains data for DATE_DT = SYSDATE - 1? Can you check if the data stored do not have hours and Minutes stored?
Although I have provided examples of data, which is the same as the data in my main table and once I used the previous solution you provided and then also gives the result as same as those mentioned by you.
I think it's something like -
select date_dt, sysdate - 1 prev_dt, trunc(sysdate - 1) trunc_prev_dt, case when date_dt = trunc(sysdate -1) then 366/day_num_yr where day_num_yr=(select day_num_yr from date_dim where date_dt = trunc(sysdate -1)) else 0 end num_day from date_dim;
Once we get the day_num_yr then he deviding by 366/day_num_yr :(
but he does not like throwing an error ORA-95 - missing keyword
Yes, it does not work
-case when date_dt = trunc (sysdate-1) then 366/day_num_yr where day_num_yr = (select day_num_yr from the date_dim where date_dt = trunc (sysdate-1))
due to a syntax of alien.
I don't think that you really need. I already said, with the data in your Table, you will be having only * 1 * record with a Non - zero value. Thus, simply apply a filter to extract the corresponding record SYSDATE - 1 and you should get an output which is Non-zero. If you apply a where predicate, then would not need you a CASE statement. You can directly use something like below:
select date_dt, sysdate - 1 prev_dt, trunc(sysdate - 1) trunc_prev_dt,
365 / day_num_yr num_day
from t4
where date_dt = trunc(sysdate - 1);
Published by: Jen K, September 7, 2012 16:00
Tags: Database
Similar Questions
-
I move the file from my old PC which took place with Vista on a new computer running with Win 10 where I have Windows Live Mail is installed. When I try to copy the files from Windows Mail on Vista on a USB key I get the message "you are about to copy this file without its properties". After studying this issue on the forums, a proposed solution was to reformat the drive in NTFS format, I did. This does not solve the problem. Any suggestions? Would it be OK in this case to ignore the message and copy the file without its properties?
Well data files/user of vista should work. Yes a NTFS format is good, go to run, or cmd, type:
diskmgmt.msc in msc, R.click on the material, delete the partition, create one, format. Use the default settings,
Once thru, L.click the disk, go to actions, all, select 'enable '.
In addition, live windows for vista is microsoft discontinud
-
Hi, I have a problem with FF, when I click on a google site, opening in a new tab and I don't want to, can you help me?
Hello, this may be a preference in your google search parameters. go to google.com/preferences and disable the option to search results open in a new browser window.
-
When I try to remove the program from the toolbar of Verizon Broadband it is said "the toolbar DLL not found, help
We are not in a position to help unless you help by providing us with as much information as possible.
Suggestions for asking for help on a site.
http://support.Microsoft.com/kb/555375
http://answers.Microsoft.com/en-us/Windows/Forum/windows_other-windows_update/what-information-to-post-in-the-Windows-Update/1467f44b-ee27-4F7D-98d7-f1c4b35b3395
-
reset the link
while trying to use re set link sent in your email, response comes back "temporary problem with this service, try again later" it has been like this for more than 1 month since early December! Help!Hello
· What service provider or of the e-mail client that you are using?
· What version of Internet Explorer you are using?
· What operating system is installed on your computer?
· It happens with all webmail or with any what particular webmail?
I suggest you to follow the link and check if it helps:
The problems of access to webmail using Internet Explorer
http://support.Microsoft.com/kb/2483955
Post back with detailed information on the issue so that we can help you further.
-
Hello, after 3 years of use of this helmet and having no problems with it, now I can hear the sound in the right ear... what should I do? Help, I don't want to say 'goodbye' to it already... Thank you
It could be the plug on the computer that is the cause of the problem. Try another helmet or a pair of speakers in it.
If you hear only on one side, who will tell you that is the question.
If you hear from both sides, you must obtain a new helmet
Software will fix either of the foregoing...
-
Does anyone have problems with playback when editing v9.2?
I have problems with playback when you change a small project (4 min). I had a few problems on previous projects, but this one is particularly bad. When I read my edition, the (unique) audio plays normally but video lags or freezes completely. I can get around it temporarily by parts of the sequence rendering, but that's a lot of time and as soon as I make a change, the problem reappears. I updated drivers etc. After reading the other reviews but it now becomes impractical, and I'm seriously considering whether I should continue with first or look for something more reliable
PLUG
Samsung Chronos i7 with 8 GB of RAM and a lot of spare
WIndows 10 build 10586.218
First Pro 9.2 zigzag
Pilot of 640 M from NVIDIA Ge Force GT 353.90
The only area I think needs expansion is the disk configuration. Here's what I recommend as a starting point.
C: Windows and programs
D: project files, audio, and still images
E: cache and Scratch
F: media camera only
G: export
In addition, a form of backup solution in place.
The above will give you excellent disk performance, spreading things to prevent the creation of a bottleneck. It is based on the use of the HARD drive, simply because they always have the best bang for the buck. But if you have the scratch for some good sized SSD, the situation changes a bit. You could probably combine D and E on a single SSD and F and G on a third party, without slowing things down significantly.
-
still no luck with highlighting and try to use the Edit with photoshop elements Editor
still no luck with highlighting and try to use the Edit with photoshop elements Editor.
Yes, I clicked the change of use with photoshop elements, editor in Chief but still, don't put not to...
region and I select view selected in organzier files. I don't understand what is happening. I never had this problem before and I have 12 for a long time. How can I fix it?
You can keep answers to the original discussion, or it's going to go very confusing - http://forums.adobe.com/thread/1438997?tstart=0.
See you soon,.
--
Neale
Insanity is hereditary, get you your childrenIf this post or by post from another user solves the original problem, please mark as correct and/or useful messages accordingly. This helps other users with similar trouble getting answers to their questions more quickly. Thank you.
-
Question
I can't see the pictures in my yahoo email, I did not have this problem with other browsers. I used the mode 5 firefox safe and always without success. Help, pleaseTo help other users find solutions, please come back to this Thread and connect you to the
Forum with your user name and password:Click on 'resolved' beside the answer above that BETTER resolved your issue
DO NOT CLICK on 'Solved It' next to this answer
-
I don't know why I had problems with FF 3.6.16 and the last update for thunderbird
I'm at the Canada and for some reason, downloads for the two FF 3.6.12 and Thunderbird was last updated was the BritishVersions is why I UK search engines, not the US versions is maybe why I'm struggling with my email and addons. The other 2 computers in my house is the American version.
But there is always something a bit screwey with 3.6.12 that some addons do not work correctly on other computers. Can you please change the software for the US version please? Thank you
I deleted the software twice already. before realizing I was downloading the British version... same problem with my Thunderbird cannot connect to the Internet service provider even if everything is done correctly! Help!
You can find the version en here:
-
I get error number ox80248015 when I try to install the update from the ms window
I get error number ox80248015 when I try to install the update from the window
see if that covers your situation: http://support.microsoft.com/kb/896226
Also make sure that the date and the system time is set correctly.
-
UID copy failed
I have windows vista. When I try to delete the mail from the Inbox I get the message that says: "the selected message could not be copied to the destination, UID copy failed."
Hello
· What mail client do you use?
If you use Microsoft Outlook, please post your questions in the Forums of Microsoft Office.
If you use Windows Live mail, please post your questions in the Windows Live Forum.
-
I have printer color laserjet 5550N having problem with error 59.C0. What is the cause of the error?
Thanks Ray,
Hello... How can I get the manual download for all the error on any printer laser color spray top of HP range.
Kind regards
Monday Nwankwo
-
Administrator permissions
I am logged in as administrator. When I try to move the files from drive c to e drive, I get the message that I currently don't have permission
to access this file.As an administrator, I though I had permission. How can I fix it?
I've only logged on as administrator.
Even logged on as administrator, you have not all privileges unless you raise them. This is done to prevent malware to take control of your computer when logged in as an administrator.
What files you try to move?
-
A subscription but when try to activate the hearing is 'no subscription found' for this adobeID
A subscription but when try to activate the hearing is 'no subscription found' for this adobeID
Hi Tonym16124306,
Please do not forget that you have use the same Adobe ID (email address) while signing the creative cloud application.
You can also check: Troubleshooting FAQ: what should I do if I have a subscription, but my application acts as if I had a trial?
Let us know if that helps.
Maybe you are looking for
-
When to use the sleep/wake button?
I'm a little confused on how to better close my 5th generation iPod touch - IOS 9.3.2 - when I finished a session. I must: Let the power down on its own? Turn off with the sleep button sleep? What is "best practice"? Thank you! Dan
-
How to set a property for all of a type of control in a cluster, by programming?
Good afternoon everyone, I have a couple of clusters on my front, each consisting of 7 rings, 7 LEDs, numbers 7 and 7 channels... all the controls. There is a left and right cluster of these... but just focus on the left one to play with... specifica
-
Low battery notification is not displayed
Even if the low battery notification is defined as 'ON' notification is not displayed when the battery goes down
-
I bought a Dell Ultrasharp U2414H monitor online at CompuIndia.com (membership Store Dell India) I got this article on June 22, 2015 Since the day I got it, I faced too many problems with it. The goal of buying the new monitor was to connect to my Ac
-
supports portrait mode or landscape to the blackberry.
Hello I'm not able to support portrait or landscape in blackberry using gap phone, please help. ? I change a lot of thing config .xml, but nothing happens...