Created
June 27, 2011 19:40
-
-
Save makanimason/1049635 to your computer and use it in GitHub Desktop.
simple Oracle 11 stored function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE FUNCTION weekStartingFriday(dayval IN DATE) | |
RETURN DATE IS | |
adjustment NUMBER; | |
BEGIN | |
adjustment := TO_NUMBER(TO_CHAR(dayval, 'D')); | |
IF (adjustment >= 6) THEN | |
adjustment := adjustment - 6; | |
ELSE | |
adjustment := adjustment + 1; | |
END IF; | |
RETURN(dayval - adjustment); | |
END; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment