How to get the year and month of a whole year

Hello

I have a list of selection and when the user selects the list values are like this 201101,201102,201103

I tried like this


declare
T_DATE varchar2 (25);
Start
because me in 1.12 loop
Select TO_CHAR (ADD_MONTHS (SYSDATE, + 1), "YYYYMM") in the double T_DATE;
dbms_output.put_line (V_DATE);
end loop;
end;

But its bad and I can not get clear idea where to change the code

Thanks and greetings
Srikkanth.M

Srikkanth.M wrote:
Hello

I have a list of selection and when the user selects the list values are like this 201101,201102,201103

If you want to list for the current year from Jan 201101,201102, 201103... 201112, then try this

DECLARE
  v_Date  VARCHAR2(25);
  n_month NUMBER;
BEGIN
  SELECT extract (MONTH FROM sysdate) INTO n_month FROM dual;
  FOR i IN 1..12
  LOOP
    SELECT TO_CHAR(ADD_MONTHS(SYSDATE, (i-n_month)), 'YYYYMM')
    INTO v_date
    FROM dual;
    dbms_output.put_line(v_date);
  END LOOP;
END;

Vivek L

Tags: Database

Similar Questions

  • How to get the days and months when two dates are given

    Hi all

    I have a requirement where I need to return the number of months and days between two given dates.
    I have no need to take account of the year as the difference in dates is always less than a year

    I have 28 June 2012 and January 31, 2013, as dates.

    I'm working on 10g

    When I select the double months_between(:a,:b) and provide the dates he gives me 7.09677
    I want to give only 7 months and 9 days, or what ever the exact days are.

    Your contributions are appreciated

    Try this:

    WITH t AS
    (SELECT TO_DATE('28-JUN-2012', 'DD-MON-YYYY') date1, TO_DATE('31-JAN-2013', 'DD-MON-YYYY') date2 FROM dual)
    SELECT TRUNC(MONTHS_BETWEEN(date2, date1)) months,
           date2 - ADD_MONTHS(date1, TRUNC(MONTHS_BETWEEN(date2, date1))) days
    FROM   t
    
  • How to get the second and third weekend of every month over a period of time?

    Hello

    No idea how to get the second and third weekend of every month on a given period without use of CLAUSE?

    Thanks in advance.

    Try it below,

    SELECT CASE WHEN TO_CHAR (ADD_MONTHS (TRUNC(startdate,'MM'),(LEVEL-1)), 'DY') = 'SAT '.

    THEN ADD_MONTHS (TRUNC(startdate,'MM'),(LEVEL-1)) + 1

    WHERE TO_CHAR (ADD_MONTHS (TRUNC(startdate,'MM'),(LEVEL-1)), 'DY') = 'Sun '.

    THEN ADD_MONTHS (TRUNC(startdate,'MM'),(LEVEL-1)) + 6

    Of OTHER NEXT_DAY (ADD_MONTHS (TRUNC(startdate,'MM'),(LEVEL-1)), "SAT") + 1

    END as second_weekendday,

    BOX WHEN TO_CHAR (ADD_MONTHS (TRUNC(startdate,'MM'),(LEVEL-1)), 'DY') = 'SAT '.

    THEN ADD_MONTHS (TRUNC(startdate,'MM'),(LEVEL-1)) + 7

    WHERE TO_CHAR (ADD_MONTHS (TRUNC(startdate,'MM'),(LEVEL-1)), 'DY') = 'Sun '.

    THEN ADD_MONTHS (TRUNC(startdate,'MM'),(LEVEL-1)) + 7

    Of OTHER NEXT_DAY (ADD_MONTHS (TRUNC(startdate,'MM'),(LEVEL-1)), "SAT") + 7

    END AS third_weekendday

    FROM (SELECT SYSDATE startdate,

    SYSDATE + 300 enddate

    THE DOUBLE)

    CONNECT BY LEVEL<=>

  • How to get the width and height of Flex Mobile view?

    Hello

    The following instructions can get the width and height of the current Flex app:

    var request: UIComponent = FlexGlobals.topLevelApplication as UIComponent;

    trace (application. Width);

    trace (application. Height);

    But I don't know how to get the width and height of mobile display Flex current (i.e. the content size excludes bar action and the Navigation bar). Why the "this.width" always returns 0?

    Thank you!

    Looks like you're running in this bug: https://bugs.adobe.com/jira/browse/SDK-30070

  • How to get the phone and messages back in my dock apps? And for some reason, I discover now all my app pages from the middle of my phone and not at the top?

    How can I get the phone and messages apps in my dock? And for some reason, I discover now all my app pages from the middle of my phone and not at the top?

    Try

    Settings > general > reset > reset home screen presentation.

    Note: All other applications will be organised by alphabetical order.

  • How to get the scanning and fax utilities works from 2840 printer. Print function works from pc

    I changed my google chrome browser and I finally got my confiquered pc and printer. He is an all-in-one 2840 color laser jet. How do I get the scan and fax utilities to perform?

    It is useful to include the manufacturer and model number.

    What version of Windows you have, including the service pack?

    How the device is connected to your computer (USB, Ethernet, other)?

    Have you installed the software that came with your HP Color LaserJet 2840 AiO printer?

    If not, why?  If you did, what error messages you are seeing?  Please report messages completely, without paraphrasing.

    Start here: HP Color LaserJet 2820 and 2840 AiO products Series - first installation and install

  • How to get the number and the name of the contacts selector

    Hi all

    I got the Contact Picker work but I have no idea how to get the selected telephone number and the name.

    There are attributes that I can put like contactId.value () to retrieve or there is another way?

    Thanks in advance.

    ImageButton{
                        defaultImageSource: "asset:///images/bluebutton.png"
                        onClicked: {
                            contactPicker.open();
                        }
                        attachedObjects: [
                            ContactPicker {
                                id: contactPicker
                                onContactSelected: {
                                    result.text = "You chose contact: " + contactId;
                                }
                            }
                        ]
    
                    }
    
                    Label {
                        id: result
                        text: "You chose contact: "
                    }
    

    Hello

    You can get the contact name and phone number as this,

    ImageButton{
                        defaultImageSource: "asset:///images/bluebutton.png"
                        onClicked: {
                            contactPicker.open();
                        }
                        attachedObjects: [
                            ContactPicker {
                                id: contactPicker
                                onContactSelected: {
                                    result.text = "You chose contact: " + contactId;
    // call a cpp method to get the details
    
    app.getDetails(contactId); } } ] } Label { id: result text: "You chose contact: " }
    

    the CPP code:

    void ContactDetails(ContactId id)
    {
    Contact contact_info = m_contactService->contactDetails(id);
    
        QString firstName = contact_info.firstName();
        QString lastname = contact_info.lastName();
            QList phoneno_list = contact_info.phoneNumbers();
    
        QStringList no_s;
    
        foreach(ContactAttribute attr, phoneno_list)
        {
            no_s << attr.value();
        }
    }
    

    You can get details like this.

    Kind regards

    Naresh Kodumuri.

  • How to get the name and number of the procedure parameter list or a function?

    I stated the procedure described in the package

    If I want to get the number and the name of the parameter list, so how do I it

    I don't have I her name with the package.

    create or replace package demoApp is

    PROCEDURE insert_data (p_fname IN VARCHAR2,

    p_lname IN VARCHAR2,

    p_address IN VARCHAR2,

    p_cellno IN VARCHAR2,

    p_email IN varchar2);

    end demoApp;

    create or replace package demoApp body is

    PROCEDURE insert_data (p_fname IN VARCHAR2,

    p_lname IN VARCHAR2,

    p_address IN VARCHAR2,

    p_cellno IN VARCHAR2,

    p_email IN varchar2) IS

    EmpID number;

    BEGIN

    Select nvl (max (emp1.empid), 0) + 1 in EMP1 empid;

    INSERT INTO VALUES EMP1 (empid, p_fname, p_lname, p_address, p_cellno, p_email);

    EXCEPTION

    WHILE OTHERS THEN

    raise_application_error (-20001,' insert the problem ' |) SQLERRM);

    END;

    end demoApp;

    -----------------

    I want to get the name of the parameter and the number of use of stroredrprocedure ""demoApp.insert_data " "

    Select *.

    of all_arguments

    where package_name = 'DEMOAPP.

    and object_name = 'INSERT_DATA.

  • How to get the LOGO and company name in the theme of the 4 apex

    Hello

    I use the theme 4 for apex 4.0.2.
    I must have the logo as well as the name of the company the two, but when I select den Image it shows only the image in the dashboard and when I select den text it shows the name of the company.
    How to get the two logo and the name of the company?

    Thanks for your help.

    Kind regards
    Sébastien Pallav.

    Pushpesh Pallav says:
    Hello

    I use the theme 4 for apex 4.0.2.
    I must have the logo as well as the name of the company the two, but when I select den Image it shows only the image in the dashboard and when I select den text it shows the name of the company.

    The word is spelled 'then', not 'den '.

    How to get the two logo and the name of the company?

    Select the text, and include HTML, making reference to the image in the text:

    
    

    The image src URI used depends on the location of the image, which you have failed to specify.

  • How to get the length and sub lymph nodes.

    Hello

    find the script below.

    < List1 >

    < list >

    < List1 >

    < List1 >

    < List1 >

    < / list >

    < list >

    < List2 >

    < List2 >

    < List2 >

    < / list >

    --

    --

    -

    -

    -

    -< / list1 >

    Here the tag list will be growing based on the I / p. Now what I want is to know how to get the length of the tag < list >.

    To implement the above I used the code below

    var number = xfa.record.List1.List [0].nodes.length; (Does not work)

    But if var account = xfa.record.List1.nodes.length; (work)

    and also I want to delete a tag inside the < List > tag. How?

    Very Urgent.

    Thanks in advance.

    Yes, you need to use the name instead of the value to get the tag name...

    xfa.datsets.data.Root.nodes.item (0) .name

    Thank you

    Srini

  • How to get the public and private keys to use recaptcha?

    I registered with google to get a recaptcha for my Web site. I've gotten has been the key to site and the secret key! If I need to get the public and private key for muse!

    Hello

    Please use the site as a 'public key'key key and Secret as "clΘ privΘe".

    Concerning

    Vivek

  • How to get the speed and the influence of the keyframe?

    Hello world

    I'm sorry if my question is due lack of understanding of script in AE but I can't seem to get the speed and influence the properties of selected or closest to the keyframe, I found that the ways to implement.

    Can someone tell me please in the right direction?

    Thank you!

    property.keyInTemporalEase (key) and property.keyOutTemporalEase (key) will give you the objects made easy with speed and influence the attributes for a particular key.

    Dan

  • How to get the .rbf and .through files?

    Hello I am currently working on the project, which provides for automatic deployment and launch programs everchanging.

    Ev3 are scattered in different schools. I wrote a simple script that can download a file and then send it to ev3 via wifi.

    But I'm currently stuck on how to get .rbf and Labview .through files.
    I know that I can deploy .vi using the target to ev3 and then upload these files to the PC, but I can't add script.
    Is it possible to compile .vi to the file?

    Sorry, try this

  • How to get the height and width of the screen of the blackberry device?

    Can someone tellme how to get details of the screen of the blackberry device?

    Display.getWidth () and Display.getHeight ().  If this isn't what you want, let us know.

  • How to get the color and stroke of ComboBox

    I would get the selected color and stroke selected ComboBoxes to print these values as strings in an .ini file to save the settings.

    Here is my example http://s24.postimg.org/q59kivgxh/Z055.png where I have a scene with ComboBoxes.List

    The list of colors is an ObservableList in the classroom

    public class ComboBoxColorCellFactory {
      
     public static  ObservableList<String> colorList = FXCollections.observableArrayList(
             
    "White", "WhiteSmoke", "GhostWhite", "Ivory", "MintCream", "Beige", "Transparent", "Seashell", "Snow", "Honeydew", "FloralWhite", "Cornsilk", "BlancheDalmond","Wheat", "AntiqueWhite", "NavajoWhite"); 
    

    and the list of race

    public class ComboBoxLineCellFactory {
        
       public static ObservableList<String> linesList = FXCollections.observableArrayList(
         "-fx-stroke-dash-array: 1;", "-fx-stroke-dash-array: 12 2 4 2;", "-fx-stroke-dash-array: 2 2;", 
         "-fx-stroke-dash-array: 15 5.0 15 5.0;", "-fx-stroke-dash-array: 0.8 8.0;", "-fx-stroke-dash-array: 3 3;", "-fx-stroke-dash-array: 6 3;");
    

    In my previous version of swing, I used to get these values in this way (PriceRetracementIni is the class with the statements of private fields and define and use the get methods).

    PriceRetracementIni.setColor1(Integer.toString(((Color)jComboBoxColor1.getSelectedItem()).getRed())+ "|" + Integer.toString(((Color)jComboBoxColor1.getSelectedItem()).getGreen())+ "|" + Integer.toString(((Color)jComboBoxColor1.getSelectedItem()).getBlue()));
    
    

    PriceRetracementIni.setStyle1(ComboLineTypeConstants.getStrokeArray((BasicStroke)jComboBoxStyle1.getSelectedItem()));
    
    

    PriceRetracementIni.setFontStyle(jComboBoxFontStyle.getSelectedItem().toString());
    
    

    How do I make FX 2, assuming that I have comboboxColor, comboboxStyle and comboboxFont?

    Thank you.

    Post edited by: acepsut missed some info about the color and stroke list

    comboBox.getSelectionModel () .getSelectedItem)

    See the Javadocs for ComboBox and SelectionModel

  • How to get the coordinates and the size of the swf to scale components

    I use the Web (I put it to the size of the entire screen) to frame a swfloader that loads a swf file with the width and height set to 100%. This swf has a movieclip. How can I get the exact coordinates of his position and its size after the scaling in Flex?

    In Flash CS4, the movielip a x = 40, y = 700. In Flex, the swf file is set to 100% scale, but when I get the x value of this movieclip, it is always 40. I try to get the scale of the x axis ratio using scaleX of swf. But his 1, pretty weird.

    How can I get the correct coordinates of the movieclip?

    The coordinates are usually compared to something.  X is relative to the parent.

    LocalToGlobal and globalToLocal convert coordinated areas.

    You can go to transform.pixelBounds and

    transform.concatenatedMatrix.

Maybe you are looking for