Re: First day of the month

From: MarkyG <markg_at_mymail.tm>
Date: 6 Dec 2001 01:37:45 -0800
Message-ID: <ab87195e.0112060137.5d52b8ba_at_posting.google.com>


Hiya,

Created a function for you. Assumes month of MON format (ie Mar, Jan) and year of YYYY format (ie 2002).
You can put in a package and over load with different parameters if you want.

CREATE OR REPLACE FUNCTION First_Day_Of_Month(

             in_month IN VARCHAR2,
             in_year  IN VARCHAR2) RETURN VARCHAR2 IS
       

  v_first_month_date DATE;
BEGIN       v_first_month_date := TO_DATE('01-' || in_month || '-' || in_year, 'DD-MON-YYYY');
   RETURN TO_CHAR(v_first_month_date, 'DAY');  

END First_Day_Of_Month;
/

Function created.

SQL> select First_Day_Of_Month('MAR','2002') FROM DUAL;

FIRST_DAY_OF_MONTH('MAR','2002')



FRIDAY Mark

"Kees Kietelvlees" <realrockcafe_at_hotmail.com> wrote in message news:<9ulblq$juu$1_at_reader07.wxs.nl>...
> How to select the first day of month
> - where year x and month y are known
>
> Julian
Received on Thu Dec 06 2001 - 10:37:45 CET

Original text of this message