How to get the previous motnh
Hi Experts,Can someone tell me to get the previos months beginning and end date...
If m 20-dec-2012 then output should be 1 November 2012 and November 30, 2012...
Thnx in advance...
977490 wrote:
Hi Experts,Can someone tell me to get the previos months beginning and end date...
If m 20-dec-2012 then output should be 1 November 2012 and November 30, 2012...
Thnx in advance...
Use
select trunc(trunc(sysdate,'MM')-1,'MM') "First Day of Last Month",
trunc(sysdate,'MM')-1
"Last Day of Last Month" from dual
20-dec-2012
Select TRUNC (trunc (to_date (20-dec-2012', 'mon-dd-yyyy'), "LUN")-1, 'MY')
"First day of the month pr."
trunc (to_date (20-dec-2012', 'mon-dd-yyyy'), "LUN")-1
"Last day of the previous month.
of the double
Published by: Rahul India on January 24, 2013 14:37
Tags: Database
Similar Questions
-
How to get the previous month and year accordingly
Hi friends,
I wanted to select the month as a number like 4 and the new year 2011
but I want to choose the previous month from sysdate
as if the sysdate is June 10, 2011
It should give me 5 months and
in the year, it should give as 2011
If the sysdate is January 1, 2012
the month should be like 12 and year should be in 2011
Thank youHello
776317 wrote:
Thank you very much I just the 0 being the prefix... can you pls how to avoid that too well plsTO_CHAR ( ADD_MONTHS (SYSDATE, -1) , 'FMmm yyyy' )
For more information on the FM, wee manual SQL language modifier works:
http://download.Oracle.com/docs/CD/B28359_01/server.111/b28286/sql_elements004.htm#sthref456 -
How to get the previous record that meets a criterion?
Hello!
I am trying to create a query that adds information which finally fixed an element for a given 'pause'.
I have a table, let's call it actionHistory, which looks like:
ID | timestamp | action | author
------------------------------------------------
101477 | 2010-05-10 09:10:20 | Difficulty | Tim
101477 | 2010-05-10 09:10:30 | change | John
101477 | 2010-05-10 09:10:40 | breaking | Maggie
101477 | 2010-05-10 09:10:50 | Difficulty | Rick
222222 | 2010-05-10 09:10:30 | change | Lewis
222222 | 2010-05-11 09:10:40 | breaking | Maggie
222222 | 2010-05-11 09:10:50 | Difficulty | Tim
222222 | 2010-05-12 09:10:40 | Difficulty | Maggie
222222 | 2010-05-13 09:10:40 | breaking | Albert
I'm looking for is the following result:
ID | timestamp | action | author | lastFixBy
-----------------------------------------------------------
101477 | 2010-05-10 09:10:20 | Difficulty | Tim |
101477 | 2010-05-10 09:10:30 | change | John |
101477 | 2010-05-10 09:10:40 | breaking | Maggie | Tim
101477 | 2010-05-10 09:10:50 | Difficulty | Rick |
222222 | 2010-05-10 09:10:30 | change | Lewis |
222222 | 2010-05-11 09:10:40 | breaking | Maggie |
222222 | 2010-05-11 09:10:50 | Difficulty | Tim |
222222 | 2010-05-12 09:10:40 | Difficulty | Maggie |
222222 | 2010-05-13 09:10:40 | breaking | Albert | Maggie
Can you tell me how I can make?
I tried many ways but no return to what I'm looking for.
Thanks in advance.
Published by: user8910765 on June 5, 2010 13:51
Published by: user8910765 on June 5, 2010 14:00Hello
That's what you asked for in Oracle 10:
SELECT a.* , CASE WHEN action = 'break' THEN LAST_VALUE ( CASE WHEN action = 'fix' THEN author END IGNORE NULLS ) OVER ( PARTITION BY id ORDER BY tmstmp ) END AS lastfixby FROM actionhistory a ORDER BY id , tmstmp ;
Like all of the built-in functions, LAST_VALUE is documented in the manual of the SQL language:
http://download.Oracle.com/docs/CD/B19306_01/server.102/b14200/functions073.htm#sthref1508user8910765 wrote:
... just in case where it might be useful, one of the queries I've tried myself a left subquery joined that Oracle has no right ("a column may be outside not attached to a subquery').Much more, it would help if you posted the request.
It looks like you were using the old outer join notation (+). You can get the desired results by using an outer join with ANSI rating, but I think it would be more complicated and slower than with a LAST_VALUE. -
How to get the previous week from Monday to Sunday from sysdate
for example, sysdate is 15-SEP-07 We must retrieve the data from SEPT. 01.-15-06 - SEP - 2015, although 31 August 15 is Monday our application must ignore since the current month is September
SQL> with t 2 as 3 ( 4 select to_date('07-SEP-15', 'dd-mon-rr') my_sysdate 5 from dual 6 ) 7 select greatest(trunc(my_sysdate, 'iw') - 7, trunc(my_sysdate, 'month')) start_date 8 , trunc(my_sysdate, 'iw') - 1 end_date 9 from t; START_DAT END_DATE --------- --------- 01-SEP-15 06-SEP-15
-
How to get the previous group on XML element
My XML structure goes like this.
<? XML version = "1.0" encoding = "UTF-8"? >
< SA321 >
PT BOOK < P_BOOK > < / P_BOOK >
< P_YEAR > 2009 < / P_YEAR >
< LIST_G_FAMILY >
< G_FAMILY >
< PARENT_FAMILY > 2240 < / PARENT_FAMILY >
< FAM_CODE_DESC > Cruiser informatico < / FAM_CODE_DESC >
< SUBTOT_FLAG > Y < / SUBTOT_FLAG >
< NEW_USED > NEW < / NEW_USED >
< LIST_G_ASSET >
< G_ASSET >
< ASSET_DESCR > 2240 - Cruiser informatico < / ASSET_DESCR >
< ACQUISITION_YEAR > 2009 < / ACQUISITION_YEAR >
JANUARY < EFFECTIVE_MONTH > < / EFFECTIVE_MONTH >
< EFFECTIVE_YEAR > 2009 < / EFFECTIVE_YEAR >
< ASSET_AMOUNT > 3000 < / ASSET_AMOUNT >
< EXEMPT_GAIN_AMOUNT > 450 < / EXEMPT_GAIN_AMOUNT >
< EXPECTED_LIFE_YRS / >
< PRV_FY_NBV > 0 < / PRV_FY_NBV >
< RATES_DEC > 37.5 < / RATES_DEC >
< RATE_FROM_LAW > 50 < / RATE_FROM_LAW >
< RATES_DEC1 / >
< 1 > 0 < / 1 >
< FISCAL_LIMIT > 1275 < / FISCAL_LIMIT >
< DEPRN_RATE > 25 < / DEPRN_RATE >
< PY_DEPRN_RESERVE > 0 < / PY_DEPRN_RESERVE >
< YTD_DEPRN > 749.99 < / YTD_DEPRN >
< ACCUM_DEPRN > 749.99 < / ACCUM_DEPRN >
< NET_BOOK_VALUE > 2250.01 < / NET_BOOK_VALUE >
< YTD_IMPAIRMENT > 0 < / YTD_IMPAIRMENT >
< IMPAIRMENT_RESERVE > 0 < / IMPAIRMENT_RESERVE >
< ACCUM_LOST_RATES > 0 < / ACCUM_LOST_RATES >
< DEPR_REINT_LOSS_NOTEXP > 0 < / DEPR_REINT_LOSS_NOTEXP >
< GAIN_AMOUNT > 600 < / GAIN_AMOUNT >
< GAIN_YEAR > 2006 < / GAIN_YEAR >
< > 110270 ASSET_ID < / ASSET_ID >
< > 110270 ASSET_ID < / ASSET_ID >
< REINT_NOT_ACC > 437.5 < / REINT_NOT_ACC >
< PY_COL15 > 0 < / PY_COL15 >
< LIST_G_COL15 >
< G_COL15 >
< COL15_TOT > 0 < / COL15_TOT >
< COL16_TOT / >
< COL_16 > 0 < / COL_16 >
< / G_COL15 >
< / LIST_G_COL15 >
< / G_ASSET >
< G_ASSET >
< ASSET_DESCR > 2240 - Cruiser informatico < / ASSET_DESCR >
< ACQUISITION_YEAR > 2009 < / ACQUISITION_YEAR >
JUNE < EFFECTIVE_MONTH > < / EFFECTIVE_MONTH >
< EFFECTIVE_YEAR > 2009 < / EFFECTIVE_YEAR >
< ASSET_AMOUNT > 1500 < / ASSET_AMOUNT >
< EXEMPT_GAIN_AMOUNT > 0 < / EXEMPT_GAIN_AMOUNT >
< EXPECTED_LIFE_YRS / >
< PRV_FY_NBV > 0 < / PRV_FY_NBV >
< RATES_DEC > 40 < / RATES_DEC >
< RATE_FROM_LAW > 50 < / RATE_FROM_LAW >
< RATES_DEC1 / >
< 1 > 0 < / 1 >
< FISCAL_LIMIT > 750 < / FISCAL_LIMIT >
< DEPRN_RATE > 20 < / DEPRN_RATE >
< PY_DEPRN_RESERVE > 0 < / PY_DEPRN_RESERVE >
< YTD_DEPRN > 316.95 < / YTD_DEPRN >
< ACCUM_DEPRN > 166.95 < / ACCUM_DEPRN >
< NET_BOOK_VALUE > 1333.05 < / NET_BOOK_VALUE >
< YTD_IMPAIRMENT > 150 < / YTD_IMPAIRMENT >
< IMPAIRMENT_RESERVE > 150 < / IMPAIRMENT_RESERVE >
< ACCUM_LOST_RATES > 2.92 < / ACCUM_LOST_RATES >
< DEPR_REINT_LOSS_NOTEXP > 0 < / DEPR_REINT_LOSS_NOTEXP >
< GAIN_AMOUNT > 0 < / GAIN_AMOUNT >
< GAIN_YEAR / >
< > 110289 ASSET_ID < / ASSET_ID >
< > 110289 ASSET_ID < / ASSET_ID >
< REINT_NOT_ACC > 89,32 < / REINT_NOT_ACC >
< PY_COL15 > 0 < / PY_COL15 >
< LIST_G_COL15 >
< G_COL15 >
< COL15_TOT > 0 < / COL15_TOT >
< COL16_TOT / >
< COL_16 > 0 < / COL_16 >
< / G_COL15 >
< / LIST_G_COL15 >
< / G_ASSET >
< / G_FAMILY >
< / LIST_G_FAMILY >
< / SA321 >
Now, I have a query like the following.
Select *.
FROM (SELECT sap_getFileContent ('o5875854.xml', 'DIR') report_data)
T FROM dual)
xmltable)
"SA321/LIST_G_FAMILY/G_FAMILY/LIST_G_ASSET/G_ASSET.
by the way of xmltype (t.report_data)
path of VARCHAR2 (50) column column1 ' / SA321, LIST_G_FAMILY, G_FAMILY, PARENT_FAMILY.
, path VARCHAR2 (100) Column2 "ASSET_DESCR."
, Column3 VARCHAR2 (50) path 'EFFECTIVE_MONTH '.
, NUMBER column4 path 'EFFECTIVE_YEAR '.
, path NUMBER column 5 "ASSET_AMOUNT".
, path NUMBER column6 "EXEMPT_GAIN_AMOUNT".
, path NUMBER column7 'EXPECTED_LIFE_YRS '.
, path NUMBER column8 'YTD_DEPRN '.
, path NUMBER column9 "PY_DEPRN_RESERVE".
, path NUMBER column10 'RATE_FROM_LAW '.
, column11 NUMBER path '1 '.
, path NUMBER column12 'FISCAL_LIMIT '.
, path NUMBER column13 'YTD_IMPAIRMENT '.
, path NUMBER column14 'ACCUM_LOST_RATES '.
, path NUMBER column15 'YTD_IMPAIRMENT '.
, path NUMBER column16 ' LIST_G_COL15/G_COL15/COL_16.
) x ;
the query always returns NULL for collumn1. Can someone help me please.
Concerning
SAPHello
Your example of XML code is not correct, there is no LIST_G_ASSET element closing tag.
But I guess that's not the real problem.the query always returns NULL for collumn1.
The important thing to understand is that the paths that you declare in the COLUMNS clause are relative to the context item is past the main XQuery expression. He knows more about the rest of the document, in particular of his ancestors.
In this case, you try to process a node whose absolute path would be/SA321/LIST_G_FAMILY/G_FAMILY/PARENT_FAMILY
in a document which the node root is G_ASSET.
The solution is to divide the query into two parts, the first one finds PARENT_FAMILY and the collection of G_ASSET and the second more shreds the collection G_ASSET is passed the first XMLTable in relational lines:
SQL> SELECT x1.column1 2 , x2.* 3 FROM XMLTable( 4 '/SA321/LIST_G_FAMILY/G_FAMILY' 5 passing xmltype(bfilename('TEST_DIR','o5875854.xml'), nls_charset_id('AL32UTF8')) 6 columns 7 column1 VARCHAR2(50) path 'PARENT_FAMILY' 8 , assets XMLType path 'LIST_G_ASSET' 9 ) x1 10 , XMLTable( 11 '/LIST_G_ASSET/G_ASSET' 12 passing x1.assets 13 columns 14 column2 VARCHAR2(100) path 'ASSET_DESCR' 15 , column3 VARCHAR2(50) path 'EFFECTIVE_MONTH' 16 , column4 NUMBER path 'EFFECTIVE_YEAR' 17 , column5 NUMBER path 'ASSET_AMOUNT' 18 , column6 NUMBER path 'EXEMPT_GAIN_AMOUNT' 19 , column7 NUMBER path 'EXPECTED_LIFE_YRS' 20 , column8 NUMBER path 'YTD_DEPRN' 21 , column9 NUMBER path 'PY_DEPRN_RESERVE' 22 , column10 NUMBER path 'RATE_FROM_LAW' 23 , column11 NUMBER path 'CASE1' 24 , column12 NUMBER path 'FISCAL_LIMIT' 25 , column13 NUMBER path 'YTD_IMPAIRMENT' 26 , column14 NUMBER path 'ACCUM_LOST_RATES' 27 , column15 NUMBER path 'YTD_IMPAIRMENT' 28 , column16 NUMBER path 'LIST_G_COL15/G_COL15/COL_16' 29 ) x2 30 ; COLUMN1 COLUMN2 COLUMN3 COLUMN4 COLUMN5 COLUMN6 COLUMN7 COLUMN8 COLUMN9 COLUMN10 COLUMN11 COLUMN12 COLUMN13 COLUMN14 COLUMN15 COLUMN16 ---------- -------------------------------- ----------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- 2240 2240-Equipamento informatico JANUARY 2009 3000 450 749,99 0 50 0 1275 0 0 0 0 2240 2240-Equipamento informatico JUNE 2009 1500 0 316,95 0 50 0 750 150 2,92 150 0
-
How to get the product key I purchased previously?
How to get the product key I purchased previously?
Depends entirely on how you bought it in the 1st place.
A boxed product should have the key on the DVD case, which is the only trace.
An update Anytime, you should have the key in an e-mail message from Microsoft. If you log in the website to store, you should be able to find the email conversation.
If another provider such as a key, then you will need to go back to them.
If your Windows starts now while you can use a keyfinder utility to read the registry key.
-
How can I get the previous version of Muse?
HTML & Javascript in an HTML embeded object does not work properly since I downloaded the latest update (November 2013). How/where can I get the previous version of Muse?
I understand the problem. My code was beautiful, but a feature in 'on' by default in the update of November 2013 Muse has created the problem.
The thumbnails on my homepage are PNG files. They are there by registering directly (via the button placed under the file menu). However, on my subpages, the thumbnails are referenced via Javascript in an HTML object. Like the placement of the tiles according to the results of the homepage of them being available in the generated Muse 'image' file when the site is exported, I can refer to them later Javascript in an HTML object in the pages following (I do this to show some random images). However, the files that I placed on my homepage are PNG and Muse was exporting as JPG because of a feature (in file / properties of the Site) is checked by default in Version 7. The feature is "opaque PNG convert to JPEG". Once I unchecked that defining and re-exported my site referenced by my Javascript PNG thumbnails appear on the subpages.
P.S. A couple of hours on the merry Road round to find the question - Ouch!
-
How to get the month previous year?
Hello
I have to get the previous year three-months of the effective date, but I have a problem since the beginning of the year and it's because I set the incorrect query.
I mean:
I wrote this query
SELECT TO_CHAR(SYSDATE,'YYYYMM')-1, 2-TO_CHAR(SYSDATE,'YYYYMM'), TO_CHAR(SYSDATE,'YYYYMM')-3
FROM DUAL;
in order to get (on mars):
201502, 201501, 201412
but unfortunately, I get:
201502, 201501, 201500
Can you help me?
Thanks in advance!
Hello
Here's one way:
SELECT TO_CHAR (ADD_MONTHS (SYSDATE-1), "YYYYMM") AS the m1
, TO_CHAR (ADD_MONTHS (SYSDATE-2), "YYYYMM") AS m2
, TO_CHAR (ADD_MONTHS (SYSDATE,-3), "YYYYMM") M3
DOUBLE;
-
How to get the name of the previous tag of an xml in java
Hai
I need to get the name of the previous tag from an xml in java.
I got the current tagname, I need to get the previous tagname attribute
NodeList parentactionList = lParentRule.getElementsByTagName)
"parentactiondetails" );
I use this way to get the the current tag name, I need to get the name of the previous tag IE... before 'parentactiondetails'
for the sample
< / parentruledetails >
< / Parentrule >
< / SingleParentRule >
< parentactiondetails ACTION_FLAG = "RulePass" PARENT_RULE_CODE = "PR626" / >
< ParentCompliance >I have xml like this I'm getting the "parentactiondetails"... now I need to get the name of the previous tag < / SingleParentRule > Java
Can someone help me,
The following code retrieves the tag replacing "parentactiondetails."
NodeList children = doc.getElementsByTagName("parentactiondetails"); for (int i = 1; i < children.getLength(); i = i + 2) { // Alternate child (
tag). Node nd = children.item(i); // Print node name System.out.println(nd.getNodeName()); //Get attributes NamedNodeMap attributes = nd.getAttributes(); for (int j = 0; j < attributes.getLength(); j++) { Node attr = attributes.item(j); //Print the attribute key and value System.out.println("\t" + attr.getNodeName() + " -- " + attr.getNodeValue()); } } -
How to align the previous next page link in an interactive report?
Hello
interactive report navigation, links between pages are displayed at the bottom right. This becomes a problem if the report has many fields, as long as the user must do scroll down and go down to get the previous page by pressing the link (IE (< =) 15-30 (= >)). How is it possible to have this links left-aligned in a report, or put them in another part of the report?
TIAHello
You can set the display Position of the Pagination of the IR with
-BottomRight (default)
-TopLeft
-TopRight
-TopAndBottomRight
-TopAndBottomLeft
If this is not enough, you must use some top of javascript (jQuery prefs) move the object to where you want...Greetings,
Roel
http://roelhartman.blogspot.com/
You can reward this response in marking it as useful or Correct ;-) -
How to get the text have the same effect as the video?
Hello
For the first time post here, but I wonder how to get the text of the titles have the same effect as the video behind her.
For my video, I use 'bad tv' and other effects such as Gaussian that obviously changes the appearance of video, creating the look of VHS. However, I then inserted text via the title, but it normally appears. How can I make this text have the same effects as the video behind it?
A friend told me I might need to add text to the video first, then do the effects, I have not tried, but wonder if there is an easier way, as this would require me to restart.
EDIT: That's what I'm looking for. https://youtu.be/7_2PHQI89dI?t=24s The text has the same effect as the video.
Thank you
One way is to create a clip made up based on the title and the original clip. Then apply the effect.
Another way is to use an adjustment layer.
Good luck.
Russ
-
How to get the podcast of the website on the phone
I was told to put that feed into the PODCASTING app on your iOS device.
The site in question is https://randirhodes.com/how-to-get-the-podcast/
I paid for a premium podcast, now how o I get this podcast to appear on my iphone 6 s more in the podcast app?
Podcasts > select my Podcasts > press the '+' > Add Podcast > paste the URL that you got on the site.
-
How to get the video intro off my google home screen I already saw it, where is the firefox logo used to be. I started with the last update that I rebooted.
Hello
to change the homepage when opening firefox-press 'Alt' and click on tools-> Options.Main menu, you can change the URL.
If the problem persists, you can follow these simple steps:
Enter about: config in the address bar and press ENTER. Accept the message of 'dragons' to see the Advanced preferences screen. Use the above search box to enter the below pref.
You can assign an empty string to stop your Firefox to retrieve "extracts" and brandLogo changes the browser.aboutHomeSnippets.updateUrl pref. Right-click this pref and select Edit then clear the value as pref in the box that appears, and then click OK. Who will also disable "snippets" that appear under the container of the research on the default home page.
Then you must open the folder of your profile, via help > Troubleshooting Information > profile folder > > button view folder. Then close Firefox. Your profile file open with Firefox closed (Firefox '3-bar' menu key > exit/Quit), wait or two minutes, then remove the storage\moz-safe-about + home folder in the Firefox profile folder to remove the brandLogo and stored in IndexedDB code snippets to make Firefox use the default brandLogo and a defined default code snippet.
If you later change your mind about these changes, you can reset the pref browser.aboutHomeSnippets.updateUrl via the context menu and Reset allows to retrieve the default value using the storage\moz-chest-fort-about + home folder again.
-
Heard speak adds the new on Fire Fox. Where and how to get the new Firefox add - one of who is spying on us. Please mail to maheshubhayakar at rediffmail.com
edited by email address - moderator
It is helpful if you provide a link to the article you were reading.
-
Re: How to get the Tempo to work properly?
Hello
I have problems with the service of Tempo.
I don't get updates via this application (all the settings of this application are accurate, i.e. "full control"). I know this because there are updates available online to my laptop via the pilot site of toshiba.
When I installed first Tempo, updates for about a month, I received, and then all of a sudden, no update came through. My firewall is blocking either of this application.
I tried to reinstall the application, but no change in the situation.
Does anyone know if ALL updates are available via the website of driver toshiba out tempo? Because, in the month that this service worked, I got an update of the bios, but I recently saw a bios update online and Tempo has not always reports that it is available.
Any ideas on how to get the Tempo to work properly?
Thank you.
I saw in your other thread you have installed SP1 on your Vista laptop.
There may be some compatibility problems between SP1 and TempoAnd Yes, as far as I know Tempo bring all available updates!
Maybe you are looking for
-
I cleaned my laptop right buttons side screen operating speaker theft market / stop with damp cloth. Now, the sound of the loudspeaker buttons usually disappear from the screen, and buttons not bitten on the laptop? I plug in external speakers and it
-
Help needed please re the above error message
-
Security Update for SQL SP4 KB970892
Windows Update continually try to download and install the above without success. I ran MS Fix It which says everything is fixed, but the problem persists. When I try to install the update (showing as 0Ko & 0Minutes) update intall just locking the sc
-
'operating system error' at startup after installing a new hard drive
Original title: sys.error of operation I replaced my hard drive on another pc. power computer peripheral ireconizes but then goes to black screen saying operating system error. What should I do?
-
Product key is already in use/Windows is not genuine
Hello. I have a Sony Vaio with Vista. Recently restored by laptop to the factory setting and did successfully. But now it says my product key is already in use and so my windows is not genuine. I checked similar problems but the activation of the pho