Function to find the name of the nth month [V 10 g]

Hi Experts,

Please, help me find the name of Nth last month [months].

Simply use a variable?

SQL > n number of var
SQL > exec: n: = 3

PL/SQL procedure successfully completed.

SQL > select to_char (add_months (sysdate,: n), 'Month') twice;

TO_CHAR (ADD_MONTHS (SYSDATE,: N), 'MOUNT)
------------------------------------
December

1 selected line.

SQL > exec: n: = - 1

PL/SQL procedure successfully completed.

SQL > select to_char (add_months (sysdate,: n), 'Month') twice;

TO_CHAR (ADD_MONTHS (SYSDATE,: N), 'MOUNT)
------------------------------------
August

1 selected line.

SQL > exec: n: = 1658

PL/SQL procedure successfully completed.

SQL > select to_char (add_months (sysdate,: n), 'Month') twice;

TO_CHAR (ADD_MONTHS (SYSDATE,: N), 'MOUNT)
------------------------------------
November

1 selected line.

Tags: Database

Similar Questions

  • find the nth highest salary

    Hi guys, I'll try to find the nth highest salary

    using the sub query, is there a case in which the following query may fail

    Select

    * de (

    Select

    distinct rownum rn,salary from emp_mgr order by rownum) t where t. rn = 3

    ;

    I do something like that, but he got 3 selects, so I'm a worried buit, trying to optimize it

    Select * from)

    Select rownum rn, t t.salary (salary select distinct from emp_mgr by salary desc)

    ) rs

    where rs.rn = &n;

  • To find the nth higher/lower value in a table

    Hi all

    I have a question

    in the table a1(empid,sal) are the 2 columns

    EmpID sal

    100-5000

    105 7500

    110 3500

    087 11136

    14336 95

    I didn't want to write the query that will give me the 3rd highest salary. or generalized to find the nth more eleve/nieme the lowest value of the table.

    Note:-Rownum and Rowid must not be used

    Thank you

    Hello

    You can use a generic result of queries to find nth highest salary...

    Just put the value of N in the query, you will get the answer...

    Query:

    SELECT E1. Salary OF EMP E1 WHERE (N) = (SELECT COUNT (DISTINCT E2. Salary) OF EMP E2 WHERE E2. Salary > = E1. Salary);

    hope you got the answer...

    Check if it really helps...

    thanxx...

  • 1 - where is the search function to find the authors muse a list?

    1 - where is the search function to find the authors muse a list?

    Hello

    Regarding your first question of the creation of a search box in your site from muse, please see this forum post:- Re: how to create a search box in MUSE?

    In addition, you can use different widgets available on Adobe Exchange .

    Now, regarding your second please can question of the creation of a bulleted in Muse, you these tutorials:

    Adobe help Muse | Bullets and numbers

    Bullets and lists numbers | Adobe Muse CC tutorials

    Now, it seems that the Muse version you are using is obsolete and it is possible that you might not find these features in it. I would ask update you your Muse to the latest version 2014.2 using the CC desktop application to take advantage of all these features. Please refer to this screenshot:- http://prntscr.com/55uvs9

    Hope this helps

    Kind regards

    Rohit Nair

  • Query to find the nth highest salary...

    Hi guys,.

    I can't understand this query that we got a Web site. It is used to find the nth highest salary of the employee... Can someone explain to me please each and every part of it...

    The Charly is:

    Select distinct (a.salary)
    EMP a
    where 1 = (select count (distinct (salary))
    b emp
    where a.salary < = b.salary)

    The "BOLD" part which is the return value... is my main question about this query...

    Help, please

    It is called a correlated sub query. The inner query is executed for each iteration of the outer query. For example, if the table emp has 14 rows and then for each salary 14 the inner query will run.
    The part

    select count(distinct(sal))
    from emp b
    where a.sal<=b.sal
    

    actually counts the number of treatments that are less than or equal to the treatment of the outer query.
    Clearly for the King, who gets the highest salary is greater than or equal to 1 (himself). It returns the highest salary.

    SQL> select *
      2  from emp a
      3  where 1 >= (select count(distinct(sal))
      4  from emp b
      5  where a.sal<=b.sal)
      6  order by sal desc;
    
         EMPNO ENAME                               JOB              MGR HIREDATE         SAL       COMM     DEPTNO
    ---------- ----------------------------------- --------- ---------- --------- ---------- ---------- ----------
          7839 KING                                PRESIDENT            17-NOV-81       5000                    10
    

    Salary of the first two.

    SQL> ed
    Wrote file afiedt.buf
    
      1  select *
      2  from emp a
      3  where 2 >= (select count(distinct(sal))
      4  from emp b
      5  where a.sal<=b.sal)
      6* order by sal desc
    SQL> /
    
         EMPNO ENAME                               JOB              MGR HIREDATE         SAL       COMM     DEPTNO
    ---------- ----------------------------------- --------- ---------- --------- ---------- ---------- ----------
          7839 KING                                PRESIDENT            17-NOV-81       5000                    10
          7902 FORD                                ANALYST         7566 03-DEC-81       3000                    20
          7788 SCOTT                               ANALYST         7566 09-DEC-82       3000                    20
    
  • Oracle Spatial function to find the closest channel line according to lat/long

    Hello

    Here's my scenario. I have a table that contains the geometries of type line (road network) channels. The line geomteries are of type Ohio state South (SRID 41104) plan.
    I have a requirement - given a lat/long, find the string line that aligns with this lat/long or the nearest set of strings of line at 0.02 miles.
    It is a typical example of an attempt to identify an accident on our road network situation. Accidents reported us in lat/long through the GPS system.
    How can I achieve this through any space function?

    Thanks for the help in advance.

    Thank you
    L.

    Hello L,

    SELECT
      r.
    FROM
      roadsegments r
    WHERE SDO_NN(r.geometry,
                 sdo_geometry(2001, 41104, sdo_point_type(lat,lon,NULL), NULL, NULL),
                 'sdo_num_res=2 distance=0.02 unit=mile') = 'TRUE';
    

    This will give you the two segments of road nearest you at 0.02 miles. See [url http://docs.oracle.com/cd/E11882_01/appdev.112/e11830/sdo_operat.htm#i78067] documentation on the operator SDO_NN, especially the bit about the use of the index indicator.

    HTH,
    Stefan

  • Function to find the County of ocurrances of an XML tag in developer j

    Hi all

    I need to find the number of xml tag that appears more than once in an xml load.

    I have not found any function in bpel in doing so. I use the developer of j 11.1.1.5.0 and SOA Composite editor version 11.1.1.5.0.01.74 version

    Is there any function in Bpel giving as the number of occurrence of an element in a payload?

    Kindy suggerez_ me on this.

    Hello

    You must use the ora:countNodes () function.
    For example:
    Ora:countNodes('inputVariable','payload','/client:GetData/client:input')

    Arik

  • Any function to find the difference?

    Hi all

    Rtf model we are performing manual calculations.
    We need to find the difference between two values.
    Is there a function that is used to find the difference between the two values in rtf model?

    Pointers on the same are appreciatable

    Use absolute funcion.

  • Function to find the number of lines to display by the foreach loop?

    Hi all

    Is it possible to find the number of lines to display per the foreach loop in the rtf model?
    We need to get the number of rows without using the count() in the xml file.
    We do some calculations based on the count in the rtf model.

    Thanks in advance

    Paste your file xml here, patients show us how count.

    You can count the number of lines.

    use

  • The search function will find the content of the banner?

    I see that the search only works with items and NO banners and collections. It will be something that will be added to collections or banners.

    (1) is currently only to objects.

    (2) Yes, at one time given, it can be extended, but there is no time horizon clear for when and if it will happen.

  • Could you help me to find the last months security updates for IE8 for Vista SP1?

    Please note Vista SP1

    http://www.Microsoft.com/download/en/details.aspx?ID=26473

    http://www.Microsoft.com/download/en/details.aspx?ID=26240

  • How to find the query select bind variables

    How to extract the variable name to bind to AS suite of sql queries
    ' SELECT NAME IN: NAME OF THE DOUBLE '
    or
    "SELECT * FROM WHERE DOUBLE (: NAME = NAME)".
    or
    "SELECT * FROM WHERE DOUBLE: NAME IS NULL'."
    or
    "SELECT * FROM WHERE DOUBLE: NAME | NAME = LAST_NAME'
    or
    ' SELECT * FROM DUAL WHERE: a = 10'
    or
    "SELECT * from where DOUBLE: A > = 10'.
    or
    "SELECT * from where DOUBLE: A < = 10 '.

    Give a solution using SUBSTR, REGEXP_SUBSTR, please answer quickly
    best answer will be marked correct/good...

    Search: and then search for the following word breaker then have the substr for them: and the separator.
    You can build an own function to find the same.

  • Find the value of MessageStyledText

    Hello

    I have a field (Dates of expenditure) typed MessageStyledText and the value of this files is 29/04/2011 - 29/04/2011 i.e. ' expense date 29/04/2011-29/04/2011.

    I need to remove "-29/04/2011"because the date is written twice in that filed and client wants the date filed only once in that. " So I have to delete the other date. I am dointg the same substring function but cannot get the value of messagStyledText bean.

    In the controller, I wrote-


    OAMessageStyledTextBean MessageStyledTextBean = (OAMessageStyledTextBean) webBean.findChildRecursive ("ExpenseDates");

    String ValueMessageStyledText1 = (String) MessageStyledTextBean.getValue (pageContext);

    String ValueMessageStyledText = MessageStyledTextBean.getText (pageContext);

    But I have not been messageStyledText.

    I am unable to file viewattribute on this page and Jdeveloper so that I can get the value of messagestyledtext through VO.

    Y at - it a function to find the value of messsagestyledtext for that I make my requirement fruther.

    Thank you
    Amit Jaitly

    Another way, I can suggest is to make the existing bean made false and create a new bean MessageStyledText and check the logic seeds while to get 1 one and together these in extended controller.

    Thank you
    -Anil
    http://oracleanil.blogspot.com/

  • Extract the first and the last Date of the previous month

    This seems to be a delicate but again it is perhaps easy for some of you people.

    Here is how I find the previous month

    Any ideas on how to get the first and last date of the previous month?

    Thanks in advance.

    Hello!

    SQL>
    SQL> select last_day(add_months(sysdate,-1)) from dual;
    
    LAST_DAY
    --------
    28.02.10
    
    SQL> select trunc(add_months(sysdate,-1),'MM') from dual
    
    TRUNC(AD
    --------
    01.02.10
    
    SQL> 
    

    T

  • Easy way to locate the function used on the diagram by name?

    Is there an easy way to locate the functions used in the diagram under the name of the generic function?

    I have user appears somewhat to the user on my diagram functions to help me debug a difficult sequence of agross events live multiple now that it works, I want to go back and disable most of these postings. Most of them went up to now within the layers a little structure and is not easy to find.

    So is there an easy way to get a list of where these functions are used so that I can quickly go and edit them?

    I find the function is with the display hierarchy that does just what I need.

    Thank you.

Maybe you are looking for