Really Simple Date conversion function... but doesn't work
For my application I need a function that converts a date to a date that is a monday.
I wrote this simple function, and I've been trying for many many times... but it just doesn't work. It returns a null value. The problem lies with the IF-statement.
I'm using iSQL 9
CREATE OR REPLACE FUNCTION to_monday ( datum IN DATE )
RETURN DATE
AS
BEGIN
FOR n IN 0..6 LOOP
IF ( TO_CHAR(datum + n, 'day') = 'friday' ) THEN
RETURN (datum + n - 4);
END IF;
END LOOP;
END;
SELECT to_monday(CURRENT_DATE) FROM dual;Edited by: popovitsj on 11-mrt-2012 5:07
Edited by: popovitsj on 11-mrt-2012 5:09
Edited by: popovitsj on 11-mrt-2012 5:09
Edited by: popovitsj on 11-mrt-2012 5:12
popovitsj wrote:
For my application I need a function that converts a date to a date that is a monday.
I wrote this simple function, and I've been trying for many many times... but it just doesn't work. It returns a null value. The problem lies with the IF-statement.
I'm using iSQL 9
CREATE OR REPLACE FUNCTION to_monday ( datum IN DATE )
RETURN DATE
AS
BEGIN
FOR n IN 0..6 LOOP
IF ( TO_CHAR(datum + n, 'day') = 'friday' ) THEN
RETURN (datum + n - 4);
END IF;
END LOOP;
END;
SELECT to_monday(CURRENT_DATE) FROM dual;Edited by: popovitsj on 11-mrt-2012 5:07
Edited by: popovitsj on 11-mrt-2012 5:09
Edited by: popovitsj on 11-mrt-2012 5:09
Edited by: popovitsj on 11-mrt-2012 5:12You have to use format modifier. to_char(...,'day') will return "friday" with padded space. You have to use to_char(..,'fmday').
SQL> CREATE OR REPLACE FUNCTION to_monday ( datum IN DATE )
2 RETURN DATE
3 AS
4 BEGIN
5 FOR n IN 0..6 LOOP
6 IF ( TO_CHAR(datum + n, 'fmday') = 'friday' ) THEN
7 RETURN (datum + n - 4);
8 END IF;
9 END LOOP;
10 END;
11 /
Function created.
SQL> SELECT to_monday(sysdate) from dual;
TO_MONDAY
12-MAR-12
Similar Messages
-
Informix Date Conversion Functions
I am converting some Informix ESQL/C programs to Oracle Pro*C.
I was wondering if there are any libraries out there that do the same thing as the Informix Date conversion functions(to avoid re writting them).
Thank You
nullHi ,
Please try this one.
if ITAB_DTL-date <> ''.
CONCATENATE ITAB_DTL-date+6(2) '.'
ITAB_DTL-date+4(2) '.'
ITAB_DTL-date+0(4)
INTO ITAB_DTL-w_date.
endif
Thanks
Karthik -
Microsoft Exam Questions On Functionality That Doesn't Work!
What does a student do if they are tested, in a Microsoft exam, on functionality that's known not to work?!
It seems absurd that Microsoft is doing this.Assume it does work when you take the exam.
How can functionality that doesn't work outside of the exam suddenly and mysteriously work in the exam? that doesn't make sense!
Turn a blind eye toward "real world" experiences in these types of cases.
Turning a blind eye to functionality that doesn't work isn't the correct solution: fixing the software or removing the question
from the exam is.
Be sure to mark the exam questions that you disagree with.
- and what happens if the student concerned did not think to do this at this time but only after she had time
to think about it afterwards?
Thank you for your contribution but I feel that it does not really address the problem I have highlighted. -
Hi i need help please i been playing clash of clans over 13 months. And today o realise what someone using my game Centra. Someone playing on my game Clash of Clans. I been change my Apple ID password, email, but doesn't work. When I playing game I can see what someone else trying connecting to my game And I don't know what to do.So if you can help me please? I don't wanna lose my game.
Hello Vaidas Vaidas,
It sounds like you are noticing someone else is accessing your Clash of Clans data by playing the game and you have tried to reset your Apple ID password. If you are following the steps outlined in this article:
Apple ID: Changing your password
http://support.apple.com/kb/ht5624
What is preventing you from changing your password? Any error messages or prompts?
Thank you for using Apple Support Communities.
All the best,
Sterling -
Functional keys doesn't work in Windows 7.
I have installed BootCamp 3.0 and installed all drivers; however, functional keys doesn't work such as keyboard backlight, volum control.
Let me know if there is any solution.
Thank you,' Installed device in another PC with same OS. And it worked (seems like fine) with latest drivers from Creative site.
May be, the problem is that Setup doesn't delete old drivers or other stuff which conflicts with latest drivers? Before released drivers I tried to install beta and them didn't work. Yes, I uninstalled them and removed all drivers and software which I could with Device Manager. But it seems like it is installing well on "clean" system. -
I created an apple ID account to my Iphone, but the system doesn´t send the verification link to my email adress. I tried many times with the buton "send verification email" but doesn´t work. My mailbox doesn´t receive any mail.
My account work correctly.
please I need help.
Thank you.It's a really bad idea to post your email addresess - it's an invitation to spam - and I've asked the Hosts to remove them.
This is a user-to-user forum and no-one on here can take any direct action. If your Yahoo address is not working that's something you would need to take up with Yahoo - have you checked it by sending yourself an email to it?
Otherwise you will need to contact Support: go to https://expresslane.apple.com/ and click on 'iTunes' in the center column and then 'iTunes Store' in the right-hand column and proceed from there. -
The wifi at my school isn't very good. And I can't send iMessages through it. It works for some apps like score center and my radar app, but doesn't work for other apps like clash of clans and iMessage. How can I get it to work on my school wifi. I have an iPhone 4S on AT&T and iOS 7.04
In a roaming network, your "main" router is the device that would require port mapping/forwarding to be configured in order to access the IP camera from the Internet. This router is also the one that would be provide the private IP address for the camera which you will want to be a static one.
So as you described your network, the IP cameras should be getting an IP address or you assigned it a static one and this is the address that you would enter in the Private IP address (or equivalent depending on the router used) field when setting up port mapping.
If you are not able to access this camera from the local network, then this should be troubleshot first. -
I updated my iphone 5 to ios 6.0.2. my wifi says its connected but doesn't work now. It doesn't matter what wifi network I connect to. It worked before updating my phone. I can no longer use facetime or use wifi at all. I'm not sure what to do to fix it.
I'm having similar issues with my phone. I got my first iPhone recently, only had an iPod touch gen4 for a little over a year. Updated to 6.0.2 when we got the phone (iPhone 5) a few days before Christmas. When I got home on the evening of January 11, my phone would not connect the router anymore. I was able to get it to connect after resetting the phone and the router, updating the router, and manually connecting. That laste for a few minutes and then wouldn't work anymore. I live in an area with very limited service, we have a network extender installed to help, and I am barely getting a 3G signal at times.
My wife's iPad 4, my touchiPod 4, and all of our laptops are working just fine on the router. When I dropped my kid off at school today, I noticed that I am not even seeing the school network anymore from the parking lot where before I got 3 or 4 bars and could connect to their wifi when I was there. Today my phone goes back and forth between seeing my home network but not connecting, to not even seeing the network at all even from the same room that the router is in.
Hope Apple fixes this problem soon.............. -
Hi i need help please i been playing clash of clans over 13 months. And today o realise what someone using my game Centra. Someone playing on my game Clash of Clans. I been change my Apple ID password, email, but doesn't work. Then I playing game I can see what someone else trying connecting to my game And I don't know what to do.So if you can help me please? I don't wanna lose my game.
Contact iTunes
Contact iTunes -
I have a VGA adapter and an iPad2. Tried projecting my iPad2 to projector using the VGA but doesn't work. Tried it with friend's iPad1 and it works. Why?? Pls help.
Yup - nothing happens. I then took the same VGA cable and plugged it into my friend's iPad1 and it worked perfectly when she opened Keynote. My understanding is that the iPad2 mirrors the entire screen, so no need to go into any specific application in order to project to the screen, right? Do I need to download any specific app or change any settings in order to be able to project the screen using VGA?
Sorry - novice at this. Not very tech minded either... -
after i update the 10.10.2 OS X Yosemite my iPhoto stops working. In the warning that appears when I try to open the app says that happened a mistake because of this update. I reinstalled the app but doesn't work anyway. Please, HELP!
I already tried that but it doesn't work. Appears a warning saying: "See the developer to make sure that iPhoto works with this version of OS X. You may need to reinstall the application. Be sure to install all available updates in the application and OS X."
-
I accidently turned voice over on,I've tried triple clicking the home button to bring up voice over options but doesn't work. I can't scroll down to get to Accesibility in genereal even with three fingers.
This article can show you how to disable it through iTunes on a PC/Mac:
iOS: Configuring accessibility features -
I was wondering if there's a way to connect to my work server from my home iMac i7. I can't seem to get Share Screen to work. I have tried connecting to server using the vnc but doesn't work.
The easiest way would be to use Back to My Mac, but that will only work if the server is a Mac running OS X 10.7 or later and you have the cooperation of the network administrator.
OS X: Using and troubleshooting Back to My Mac with your iCloud account -
Since I updated, Firefox is crashing daily. The finger scroll feature on my PC works with other browsers, but doesn't work on Firefox. It is also very, very slow, but other browsers aren't. I can't use it anymore until it's fixed.
To open the <i>about:config</i> page, type <b>about:config</b> in the location (address) bar and press the "<i>Enter</i>" key, just like you type the url of a website to open a website.<br />
If you see a warning then you can confirm that you want to access that page.<br />
*Use the Filter bar at to top of the about:config page to locate a preference more easily.
*Preferences that have been modified show as bold (user set).
*Preferences can be reset to the default via the right-click context menu if they are user set
*Preferences can be changed via the right-click context menu: Modify (String or Integer) or Toggle (Boolean)
*http://kb.mozillazine.org/about:config -
I have internet optic fiber connection and I'm trying to configure it with my Airport Express but doesn't works, appears that I have IP and DNS, as I'm a computers dummy , who could help me to configuration it, please?
You're welcome.
Voicemail is left at your carrier's server. That will continue to work unless you report your iPhone as lost or stolen with your carrier.
You may never find it again and you can't if the iPhone remains offline or out of service which means the iPhone is powered off or doesn't have cellular reception.
Maybe you are looking for
-
I need help on how to look up a multi column MULTI ROW table given two variables which exist row one and column one cells. Something like .... Lookup Column One to find X then lookup Row One to find Y then pull the content of cell XY and insert ... J
-
Cannot open itunes at all. Please help
I have recently upgraded to the newest version of itunes but everytime I try to open the program it says that a newer version of quicktime is needed to open itunes and for me to reinstall itunes. Well I have done this about twenty times and it still
-
How to output column of text to array
Hi, In attached vi, How can I output all column of text into 1D array? I only able to read the first line. Thanks. Attachments: 1.vi 8 KB
-
How to best sync multiple collections of contacts between multiple users
What is the best way to sync multiple collections of contacts among multiple users on iOS and OS X? For example, suppose I have three collections of contacts: Bob's, Sally's, and Common. I want Bob to be able to access and sync Bob's contacts and Com
-
WHERE DID THE POWER GO?!?
I woke up this morning and couldn't access my Airport... so I came upstairs to check it and it wasn't on. So I checked everything else plugged into that surge protector was on and running fine, including the modem that I'm currently plugged into. I u