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
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 return value from Java runtime.getRuntime.exec?
I am running shell from a (GR 11, 2) Oracle database commands on aix.
But, I would get a return value of a shell comand... as you get with "echo $?"
I use a code like
but I do not get a return value... because I don't know how to get the return value...CREATE OR REPLACE JAVA SOURCE NAMED common."Host" AS import java.io.*; public class Host { public static int executeCommand(String command) { int retval=0; try { String[] finalCommand; finalCommand = new String[3]; finalCommand[0] = "/bin/sh"; finalCommand[1] = "-c"; finalCommand[2] = command; final Process pr = Runtime.getRuntime().exec(finalCommand); pr.waitFor(); } catch (Exception ex) { System.out.println(ex.getLocalizedMessage()); retval=-1; } return retval; }; /
Published by: user9158455 on 22-Sep-2010 07:33Hello
Your pr.exitValue () has tried?
I think you also need a finally block that destroys the sub-process
Concerning
Peter -
Convergence 2u5 - how to get the ISO week number in calendar view?
Hello
Convergence seems to be displaying week numbers "US Standard" (e.g. 27/02/2013 is week 8).
I don't see any option to display European/ISO week numbers (27/02/2013 is week * 9 *).
You can test on this page: http://www.onlineconversion.com/day_week_number.htm
Tested with 2u5 and Convergence 2u4.
Technically, Convergence depends currently dojo to calculate WeekNumber (kernel.js called dojo.date.locale.format that calls dojo.date.locale._getWeekOfYear which uses US Standard).
The dojox.date.posix.getIsoWeekOfYear method can be called to get the ISO week number.
EDIT: ok, known problem.
https://support.Oracle.com/epmos/faces/UI/km/BugDisplay.JSPX?ID=15920988
And:
https://support.Oracle.com/epmos/faces/UI/km/SearchDocDisplay.JSPX?_afrLoop=358252901368927 & type = document & ID = 1508601.1 & DisplayIndex = 1 & _afrWindowMode = 0 & _adf. CTRL-State = hy91faqhm_93
Published by: user13722792 on 27 Feb. 2013 02:03Yes, we talk about behavior. However, demand for next development was opened on this:
15920988 DO WEEK NUMBERING CUSTOMIZABLE IN CONVERGENCE
More on that we can read in the document of knowledge:
The numbering of the week in the calendar week view is inconsistent with the ISO8601 (Doc ID [1508601.1 | https://support.oracle.com/rs?type=doc&id=1508601.1])It also contains a customization to get Convergence use week numbering.
If you want to be officially added to the demand of development, you need to open a Service request, which contains this application.
Cheers, Ben
-
How to get the current position from the point of view
can I know how to get the current position of the view?
Edited by: anIdiot July 27, 2011 22:011 - get belvedere of the universe:
u = new SimpleUniverse (canvas3D);
ViewPlat = u.getViewingPlatform (); view of the universedefinition viewplat: ViewingPlatform ViewPlat;
2 - get look a transform of the platform in an existing Transform3D
ViewPlat.getViewPlatformTransform () .getTransform (t3d).
3 - Look at the trandform: t3d.get (Quater1, vector1); orientation object Get and coords
Kind regards.
JFP -
How to get the selected values from the shuttle
Hello
Please tell me how to get the values of the option chosen by the shuttle leading the list.
Thank youCheck out this link and that this might help you.
Thank you
-Anil
http://oracleanil.blogspot.com/ -
How to get the ISO week number week start date
Hello
I have a table with the following structure
I was hoping to get something like select year, error, week 1 | "Start date of the week which is a Monday of this week" ", semaine2:" " Earlier this week, Monday again ",... table week53"Year error Week1 week2 week3 ......week53 2012 error1 2 4 2 1 2012 error2 3 0 1 1
Any suggestions please?
Thank you
SunHi, the Sun,
To see what a week N started, add 7 * (N - 1) days of the beginning of the year. (By definition, the beginning of the ISO year is the beginning of week 1 of the ISO year.)
To see when the week started 22 of the current year:
SELECT TRUNC (SYSDATE, 'IYYY') + (7 * (22 - 1)) FROM dual ;
I hope that answers your question.
If not, post a small example of data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and the results desired from these data.
Explain, using specific examples, how you get these results from these data.
Always tell what version of Oracle you are using.
See the FAQ forum {message identifier: = 9360002} -
How to get the product key from old computer running XP SP1 until she is thrown?
How can I get my registration code from my old computer with xp with service pack 1 before I throw it away
* original title - how can I get my registration key of xp to xp I can see all the files in my computer *.
Hello
You can get the product key of your Windows XP CD. To get the key from your computer, you might have to look by using a third party app that could help you achieve the same.
Please use your favorite search engine and browse for such a program that is used to.
Note: This response contains a reference to third party World Wide Web site. Microsoft provides this information as a convenience to you. Microsoft does not control these sites and no has not tested any software or information found on these sites; Therefore, Microsoft cannot make any approach to quality, security or the ability of a software or information that are there. There are the dangers inherent in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.
-
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 doublePublished by: Rahul India on January 24, 2013 14:37
-
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 items selected from indesign Document?
Hi all
I'm trying to get the objects selected by the user in the indesign document, to which the following code, I wrote, but his does not collect do not.
LayoutTarget InterfacePtr < ILayoutTarget > (myContext, UseDefaultIID());
if (layoutTarget == nil)
{
() CAlert::ErrorAlert
"layouttarget sucks" );
breaking ;
}
UIDList itemList = layoutTarget-> GetUIDList (kStripStandoffs);
where mycontext is IActiveContext and after getting the itemlist (all managers of related texts).
How to perceive the limits of the textframe? (TopLeft, TopRight, BottomLeft, BottomRight).
Thanks and greetings
Sanjeev.k
You must initialize the ILayoutTarget with a CSB. As
InterfacePtr
iLayoutCSB (iSelectionManager-> QueryConcreteSelectionBoss (kNewLayoutSelectionBoss)); InterfacePtr
layoutTarget (iLayoutCSB, UseDefaultIID()); HTH.
Jasmine
-
Hi all
I'm calling javascript from COM (c#) and it works fine. Passing parameters to javascript and playback by using the syntax of the [x] arguments also works very well.
What I can't seem to get to work is to know how to move something from javascript to the calling COM Summoner, in this case, c#. How and where should I place the return value in javascript?
Thanks in advance.
Rachiud
doScript() evaluates an expression, so just make sure that your Javascript is an expression.
For instance "(3 + 3)" 6 "
-
How to restore the previous session from a sessionstore.bak file
When I tried to open firefox that it automatically updated and deleted the sessionstore.js file. I saved the sessionstore.bak in another case, closed mozilla, changed the extension bak in js in the folder "profiles" Firefox and opened it again, but nothing happened. If the sessionstore.bak file is large 13Ko and seems to contain all the links in my previous session.
How I force Firefox to start a session by using the information in the sessionstore.bak or .js file, as it should?
Hello lordsilver2, the method you tried is correct, if does not work maybe the sessionstore.bak (renamed sessionstore.js) is corrupted.
First make a copy of the file (the renamed sessionstore.js) on your desktop and then try to create a new profile and move the copy in the new profile to see if it works. If the file is corrupt is not sure the books above.
Thank you
-
How to get the file downloaded from ECS
Hello
I have the situation where I have to send back the ECS file we downloaded in B2B configurations.
Unfortunately we lost the ecs file we downloaded. Is there a way we can recover the file ecs.
Concerning
KiranHello
It is strongly recommended to access the tables directly unless there is a strong personalization use case. Using the layer BLL is perhaps the right thing to do.
Anyway, here's the information on ecs tbl file:
Select b.SID from tip_parameter_t a, TIP_DOCUMENTTYPEPARAMETERVAL_T b where a.id = b.DOCUMENTTYPEPARAMETER and b.SID like '% % ECS ';Need to connect the 2 following tables to get to the DTD/XSD.
tip_documentdefinition_t
tip_nativedatatype_TRgds,
Riou -
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
Maybe you are looking for
-
GraphicConverter opens when the ipod connects
When I want to recharge my iPod Touch 6 to work, I plug it into the USB port on my iMac (running 10.10.5). keyboard iTunes opens to allow the backup and synchronization, but also an older version of GraphicConverter also runs and asks me if I want to
-
I'm getting messagage 'Thunderbird has stopped working ".
This message came whenever I opened it and tried to use Thunderbird today, it's driving me crazy. Also, it is not the first time that this has happened
-
Equium A60: Installtion was incomplete and applicant to re-run the installation program
Hi all I tried to recover an Equium A60. It seems to copy from the DVD with no problems - no error message in playback. It then asks me to remove the media and do a restart. Windows XP begins to install and then I get a message indicating that instal
-
Type of memory for Touchsmart 420-1100t - DIMM or SODIMM?
Hi, I keep getting conflicting information on the type of upgrade memory I need for my Touchsmart 420-1100 t. I know it's PC - 3 - 1066 DDR3, but for the life of me, I receive information contradictory re 204 PIN SODIMM or DIMM standard. The system
-
box next to my name was a red x