picture of the month

I month table. Data show properly in the number of the month in the neighborhood (MN_in_quarter). In April, the mn_in_quarter must be 1, but it shows 2. And also I wanted to display two digits for her. example 01,02,03 etc.
For many months, it should be double digit. Please correct my query.
--temp table
create table temp_month_vj
(Month_Key NUMBER --sequence
,MN_in_Year NUMBER--month number|| year
,MN_in_Quarter_and_Year VARCHAR2(128) --month number|| quarternumber|| year
,Month_Number NUMBER--month number
,Month_Name VARCHAR2(128)
,MN_in_Quarter NUMBER)--month number in quarter level. for example: apri is quarter 2. out put is month number||quarternumber 0102


CREATE SEQUENCE temp_mont_vj_s
  MINVALUE 1
  MAXVALUE 999999999999999999999999999
  START WITH 1
  INCREMENT BY 1
  CACHE 20;

INSERT INTO     xddw.temp_month_vj
( Month_Key
, MN_in_Year
, MN_in_Quarter_and_Year
, Month_Number
,Month_Name
,MN_in_Quarter
)
WITH   extrema     AS
(
     SELECT     TO_DATE('01.01.2006','DD.MM.YYYY')     AS first_date
     ,     TO_DATE('31.12.2007','DD.MM.YYYY')     AS last_date
     FROM     dual
)
,     all_days     AS
(
     SELECT     first_date + LEVEL - 1     AS date_key
     FROM     extrema
     CONNECT BY     LEVEL <= last_date + 1 - first_date
)
SELECT  
temp_mont_vj_s.nextval
,to_char(EXTRACT(MONTH FROM date_key),'09')||TO_CHAR(date_key, 'YYYY')
,to_char(trunc(to_char(date_key,'mm')/to_char(date_key,'Q')),'09')||TRIM(to_char(TRUNC(TO_CHAR(date_key, 'Q')),'09'))||TO_CHAR(date_key, 'YYYY')
 ,to_char(EXTRACT(MONTH FROM date_key),'09')
,TO_CHAR(date_key , 'MONTH')
,to_char(trunc(to_char(date_key,'mm')/to_char(date_key,'Q')),'09')
FROM     all_days ;

Daniel wrote:
my request does not have to display the number of quarter it please help me.

Use:

INSERT INTO     temp_month_vj
( Month_Key
, MN_in_Year
, MN_in_Quarter_and_Year
, Month_Number
,Month_Name
,MN_in_Quarter
)
WITH   extrema     AS
(
     SELECT     TO_DATE('01.01.2006','DD.MM.YYYY')     AS first_date
     ,     TO_DATE('31.12.2007','DD.MM.YYYY')     AS last_date
     FROM     dual
)
,     all_days     AS
(
     SELECT     first_date + LEVEL - 1     AS date_key
     FROM     extrema
     CONNECT BY     LEVEL <= last_date + 1 - first_date
)
SELECT  temp_mont_vj_s.nextval,
        to_char(date_key,'MMYYYY'),
        to_char(mod(to_char(date_key,'mm') - 1,3) + 1,'00') || TO_CHAR(date_key,'QYYYY'),
        to_char(date_key,'mm'),
        TO_CHAR(date_key ,'FMMONTH'),
        mod(to_char(date_key,'mm') - 1,3) + 1
FROM     all_days ;

For example:

SQL> INSERT INTO temp_month_vj
  2  ( Month_Key
  3  , MN_in_Year
  4  , MN_in_Quarter_and_Year
  5  , Month_Number
  6  ,Month_Name
  7  ,MN_in_Quarter
  8  )
  9  WITH   extrema AS
 10  (
 11   SELECT TO_DATE('01.01.2006','DD.MM.YYYY') AS first_date
 12   , TO_DATE('31.12.2007','DD.MM.YYYY') AS last_date
 13   FROM dual
 14  )
 15  , all_days AS
 16  (
 17   SELECT first_date + LEVEL - 1 AS date_key
 18   FROM extrema
 19   CONNECT BY LEVEL <= last_date + 1 - first_date
 20  )
 21  SELECT  temp_mont_vj_s.nextval,
 22          to_char(date_key,'MMYYYY'),
 23          to_char(mod(to_char(date_key,'mm') - 1,3) + 1,'00') || TO_CHAR(date_key,'QYYYY'),
 24          to_char(date_key,'mm'),
 25          TO_CHAR(date_key ,'FMMONTH'),
 26          mod(to_char(date_key,'mm') - 1,3) + 1
 27  FROM all_days ;

730 rows created.

SQL> select  *
  2    from  temp_month_vj
  3    where mod(month_key,28) = 0
  4  /

  MONTH_KEY  MN_IN_YEAR MN_IN_QUARTER_AND_YE MONTH_NUMBER MONTH_NAME  MN_IN_QUARTER
----------- ----------- -------------------- ------------ ----------- -------------
         28       12006  0112006                        1 JANUARY                 1
         56       22006  0212006                        2 FEBRUARY                2
         84       32006  0312006                        3 MARCH                   3
        112       42006  0122006                        4 APRIL                   1
        140       52006  0222006                        5 MAY                     2
        168       62006  0322006                        6 JUNE                    3
        196       72006  0132006                        7 JULY                    1
        224       82006  0232006                        8 AUGUST                  2
        252       92006  0332006                        9 SEPTEMBER               3
        280      102006  0142006                       10 OCTOBER                 1
        308      112006  0242006                       11 NOVEMBER                2

  MONTH_KEY  MN_IN_YEAR MN_IN_QUARTER_AND_YE MONTH_NUMBER MONTH_NAME  MN_IN_QUARTER
----------- ----------- -------------------- ------------ ----------- -------------
        336      122006  0342006                       12 DECEMBER                3
        364      122006  0342006                       12 DECEMBER                3
        392       12007  0112007                        1 JANUARY                 1
        616       92007  0332007                        9 SEPTEMBER               3
        644      102007  0142007                       10 OCTOBER                 1
        672      112007  0242007                       11 NOVEMBER                2
        700      122007  0342007                       12 DECEMBER                3
        728      122007  0342007                       12 DECEMBER                3
        420       22007  0212007                        2 FEBRUARY                2
        448       32007  0312007                        3 MARCH                   3
        476       42007  0122007                        4 APRIL                   1

  MONTH_KEY  MN_IN_YEAR MN_IN_QUARTER_AND_YE MONTH_NUMBER MONTH_NAME  MN_IN_QUARTER
----------- ----------- -------------------- ------------ ----------- -------------
        504       52007  0222007                        5 MAY                     2
        532       62007  0322007                        6 JUNE                    3
        560       72007  0132007                        7 JULY                    1
        588       82007  0232007                        8 AUGUST                  2

26 rows selected.

SQL> 

SY.

Tags: Database

Similar Questions

  • I have a complete picture of 12 months subscription given by Canon, but Adobe CC guard resetting my account for free from the trial subscription.  I've updated Photoshop CC 2014 month last to find he wasn't an update at all but a trial version of 2015, th

    I have a complete picture of 12 months subscription given by Canon, but Adobe CC guard resetting my account for free from the trial subscription.  I've updated Photoshop CC 2014 last month to find he wasn't an update at all but a trial version of 2015, which seems to have deleted 2014 my system, so I do not have Photoshop at all now.  Adobe support is a continuous loop of questions meaningless and I find myself at a forum instead of a human being who could address this issue.  In the average time that I tell my clients that are waiting for images?  My subscription runs out in October, and now I see little incentive to renew because I don't get what has already been paid.  If someone from Adobe would like to contact me that would be a start.

    Please try the steps listed in https://helpx.adobe.com/manage-account-membership/cc-reverts-to-trial.html

    I hope this helps.

  • Keep the pictures in the pictures folder in order, when burning a data CD disc

    I arranged laboriously 357 pictures from several sources in order to a folder in the Windows Photo Gallery by changing the time the photos were taken.  When I burn on a CD of data, either in the Gallery of photos or Windows Media Center, they return to their original order.  I need them to be in order at the time wherever I put to them.  Please help me to do this.  I'm so frustrated trying to make CDs for the members of the family of the 100th birthday of my uncle.  What I try to do on this project takes me forever!  They should have mailed last month.  Help, please. Thank you very much!

    I arranged laboriously 357 pictures from several sources in order to a folder in the Windows Photo Gallery by changing the time the photos were taken.  When I burn on a CD of data, either in the Gallery of photos or Windows Media Center, they return to their original order.  I need them to be in order at the time wherever I put to them.  Please help me to do this.  I'm so frustrated trying to make CDs for the members of the family of the 100th birthday of my uncle.  What I try to do on this project takes me forever!  They should have mailed last month.  Help, please. Thank you very much!

    ==================================
    Something to try... it works on XP and I have no
    a Vista system handy right now to test on...

    Best bet IMHO... would be numbered files.

    Birthday (10001) .jpg

    Birthday (10002) .jpg

    Birthday (10003) .jpg

    This can be done in a batch...

    Navigate to the folder in which the files are saved... (not in the photo gallery
    but in the actual file)... I'm guessing it's in your pictures folder.

    Open the folder containing the 357 photos and go...
    View / details...

    You said you changed the 'Date taken' to sort photos...
    If you click on the bar at the top of the column Date taken, you can
    Sort photos... If the Date of the column is not visible, right-click
    the bar and add it by selecting it in the list... (you may need to
    choose... Continued... to find)

    OK, when the pictures are sorted... Right-click the first picture in the
    the list and choose... Rename... Enter a descriptive word for the Group
    and the number (10001)... do not forget the extension is included...

    Birthday (10001) .jpg

    When you press on... Come in... Windows should rename other
    files. If it works as it should... when burn you the CD... files
    will be in order.

    Good luck...

    Volunteer - MS - MVP - Digital Media Experience J - Notice_This is not tech support_I'm volunteer - Solutions that work for me may not work for you - * proceed at your own risk *.

  • RECENTLY I bought the subscription for the month, but then canceled (I think?) because I'm frustrated. I've been using bridge and photoshop cs6 for 4 years. I've never understood light room and where it is located. I've dabbled with it and I could not

    RECENTLY I bought the subscription for the month, but then canceled (I think?) because I'm frustrated. I've been using bridge and photoshop cs6 for 4 years. I've never understood light room and where it is located. I've dabbled with it and I couldn't find out how to save my images in my workflow of currengt, or how to resize and put a border around my images. How to save for web and as TIFF, as I did for all my files for four years. LR seems to be taking pictures of my Iphoto folder and I don't use that. I tried to cancel the cc of photoshop and lightroom cc and cc bridge but I don't know if I did. I am really confused, and I have work to do. What can I do, do I do, help me! @@ !

    Cancel see answer #1 in https://forums.adobe.com/thread/2023066 - includes a link to Chat from Monday to Friday

    Your subscription to cloud or serial number to show on your account page?

    https://Accounts.adobe.com/ , then click on Plans & products top

    Cloud of reading takes up https://forums.adobe.com/thread/2089127 for some ideas

  • The monthly subscription includes the license?  If so, which standard or extended license?

    The monthly subscription includes the license?  If so, which standard or extended license?

    Hi Raquel

    Yes, he does.

    Please check the terms of the license for more details - Royalty free images, pictures and graphics. Adobe Stock

    Thank you

    Bev

  • Can I use pictures from the reserve for commercial use for my members to do with.  We would not sell the photos but the use for commercial use.

    Can I use pictures from the reserve for commercial use for my members to do with.  We would not sell the photos but the use for commercial use. (the 29.99 price months?)

    Thank you.

    Barbara

    In your case you will very likely get extended licenses for images from Fotolia.com otherwise you would have to buy a new license for each Member who has access to use the weather picture they actually use it or not...

  • Why Photoshop CC2015 open a RAW file with the file name right but wrong picture / not the picture that I chose?!!?!

    Suddenly new bug in my Photoshop CC 2015. It is a few days, he has begun to allow me to choose "open file", select a RAW file in my picture folder, click Open and then he shows me a different photo in RAW, but with the correct file name. That's happened? I changed nothing in the month and work on files Nikon or Canon RAW almost every day... that is something new that I need to find a patch or something that I am on... Help!

    Hi Modernmatt,

    I suggest you contact adobe support chat

    Please click on the link below-

    Contact the customer service

    Concerning

    Rohit

  • Calendar is the name of the month showing

    This is a new, just started my laptop this morning and the menu bar showed M10 5 sea, which is also how it looks in the calendar. All other months are the same (M01, M02, etc.).

    Tried resetting the PRAM, but can't see any prefs calendar that I needed trash as the only one is the synchronization agent.

    Anyway to get my laptop to remember what it October again? Do not know if it is connected but it also completely forgotten that I have my trackpad tap to click and three fingers to drag, and I put DND in Notifications.

    Hi Ben Collier.

    Looks like you're some problems with your Mac, specifying the digital number for the month, instead of the names of the months themselves. Also, you have some problems with the trackpad preferences and do not disturb for notifications. I can see how you would like to get this all resolved. We'll see what we can do.

    I would like to first of all, you have set the trackpad preferences and do not disturb the notifications as you want, then start up the Mac in safe mode.

    OS X El Capitan: Notifications preferences

    OS X El Capitan: start in safe mode

    Once you're in safe mode, please try to see if the names of the months are returned and that the trackpad still works as expected. If the names of the months back, please restart the Mac and open the calendar application and then check to make sure that the problem is solved. If issues are not resolved in safe mode, please create a test user and verify. This will help us to determine if the questions are the scale of the system or a specific user.

    How to test a question in another account on your Mac.

    Thank you for using communities Support from Apple. Have a good night!

  • Missing thumbnails in 2 pictures on the Sierra

    Hi all! After the search for photos by date, I noticed that a big piece of my photo library is without vignettes. This is after the 2 pictures on the Sierra of the OS. I already tried to repair the library usage.

    Sorry, I'm not about to open individually 40 000 photos, so I can fix the thumbnails.

    Apple, fix!

    I think this is my most photo library of 40 k takes just to always update, but it has been almost a week already. To make things even better, the update dialog box leave not the slightest idea of how much time is remaining.

  • Huawei P9 - I have many issues with getting my pictures from the phone to my Imac

    Huawei P9 - I have many issues with getting my pictures from the phone to iphoto on my Mac.

    Before the summer I bought a Huawei P9 phone, I can easily see the photos on the phone - I can't just them on my mac.  When I connect via a USB cable, it refuses my permissions.

    I try to use my Google account to view on the Mac and move the iPhoto - I can't work either! I can see them, I can't move them!

    I'm pulling my hair out and I have enough to do with! Help, please...

    Jim Hosking

    You need the phone provider support - there is a problem with the way their phone works and how to use it and has nothing to do with the Photos or iPhoto - if pictures is consistent with standards of good Photos and iPhoto won't work with it

    You may need special third party software for your phone load in Photos or iPhoto

    LN

  • Why do I need the monthly 'Apple music' subscription?

    Why do I need the monthly 'Apple music' subscription?  I do not buy music... ever!

    You don't 'need' to an Apple music subscription, only keep it if you're going to use it or cancel the subscription.

    You probably are just signed up to the free 3-month trial, you will need to cancel before 3 months is up if you do not want to start paying for it.

    View, change or cancel your subscription - Apple Support

  • How to attach a picture to the default email

    How to attach a picture to the default email

    Since the iPhone user Guide:

    http://help.Apple.com/iPhone/9/#/iph3caef30a

  • can you help to reset the iPhone 6 +? used of the year and the month. Now, when you update, it asks activation and I can't remember anything! Arouca and verification is in stock

    can you help to reset the iPhone 6 +? used of the year and the month. Now, when you update, it asks activation and I can't remember anything! Arouca and verification is in stock

    To activate you need your Apple ID and password. If you forgot their date on https://iforgot.apple.com.

  • Change the location of several pictures at the same time?

    I see how to change the location of a photo at a time. Is it possible to change the location of several pictures at the same time?

    Thank you

    Phil

    Select the photos and info - enter the location (or any other field of the info) and it is applied to all photos

    This is described in using Photos - a good place to get help with Photos

    View and add information about the photos

    To view or change information for the photos, you select one or more photos, and then open the information window.

    • Open the Info window: Double-click a photo to view it, and then click the Info button in the toolbar or press on command I.
    • Add or change information: Change the following.

      • Title: Enter a name in the title field.
      • Description: In the Description field, type a caption.
      • Favorite: Click the Favorites button to mark the photo as a favorite. Click the button again to deselect.
      • Keywords: Enter the keywords in the keywords field. When you type, Photos suggest keywords that you have used before. Press enter when you have finished a keyword. To remove a keyword, select it and press DELETE.
      • Faces: Click on and type a name to identify a face. Click on several times, and then drag the identifier of the face different faces to identify many faces in a photo.
      • Location: Enter a location in the location field. When you type, Photos suggest places you can choose. To change a location, you can search a different location or change the location by dragging a PIN on the map. To remove location information, delete it or choose Image > location, then choose Remove location or back to the original location. You cannot assign a location if your computer is not connected to the Internet.

    LN

  • Put the picture of the camera in shared album

    Put up the picture of the camera to a shared album?

    Try the steps here:

    iCloud: create a shared album

Maybe you are looking for