Get the SQLs In between a date range
Get the SQLs irrespective of sessions in the order of its execution from a specified schema with in a date time range
Which version of Oracle are you using?
Jaffar
Similar Messages
-
Customer exit to get the result in between two fiscal periods
Hi Guys,
I have a requirement to write customer exit, in which i have to get the result for a range of fiscal periods,
that is in Between fiscal period1 and fiscal period3,
and i am getting this Fiscal period from other variable called version in which it consists of combination of fiscalperiod and text
and now i have filtered the fiscal period and stored in Final_val ( this is an interger), but how can i use dynamically this Final_val to get the results in between Final_val1 and Final_val3 ( that means if the Final_val is 2008010 then i have to get the results in between 2008011 and 2009001).
Please provide me the solution, with the possible piece of codeHi Diogo,
Here is the code
WHEN 'ZC_PVR'.
DATA: FIN_YEAR(4) TYPE C,
FIN_DATE(3) TYPE C,
FIN_VAL(7) TYPE C.
IF I_STEP = 2.
READ TABLE I_T_VAR_RANGE INTO LT_VAR_RANGE WITH KEY VNAM = 'ZC_VCS'.
IF SY-SUBRC EQ 0.
CONCATENATE '20' LT_VAR_RANGE-LOW+2(2) INTO FIN_YEAR.
CONCATENATE '0' LT_VAR_RANGE-LOW+4(2) INTO FIN_DATE.
CONCATENATE FIN_YEAR FIN_DATE INTO FIN_VAL.
CLEAR L_S_RANGE.
L_S_RANGE-LOW = FIN_VAL.
L_S_RANGE-HIGH = ''.
L_S_RANGE-SIGN = 'I'.
L_S_RANGE-OPT = 'BT'.
APPEND L_S_RANGE TO E_T_RANGE.
ENDIF.
ENDIF.
which i am using for Filter the fiscal period, after this when i tried to restrict on this "ZC_PVR" vairable and set the offset like
zc_pvr 1 to zc-pvr3 under value of ranges, but i am facing an error saying the " variable may be deleted or used incorreclty",
could u plz suggest -
How can i get number of days between two dates represented by two dates?
how can i get number of days between two dates represented by two date objects. One is java.sql.Date, the other is java.util.Date?
tej_222 wrote:
But how do I do that conversion. from java.sql.date and java.util.date to calender?
-thanks for the quick response.You may find the following utility code samples useful:
[http://balusc.blogspot.com/2007/09/calendarutil.html]
[http://balusc.blogspot.com/2007/09/dateutil.html]
ganeshmb wrote:
(date1.getTime() - date2.getTime())/(1000*60*60*24) should do.
getTime returns millsecond value of date object and the difference divided by no of milliseconds in a day should fetch you the difference in terms of days.This doesn't respect the DST. Use java.util.Calendar. -
How to get the SQL file name in SQL*plus
hi all,
I have created two sql file at C drive as "c:\Createtable.sql" and "c:\Deletetable.sql"
afterwards i open
C:\>sqlplus
SQL*Plus: Release 10.2.0.1.0 - Production on Wed Jan 30 11:37:10 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Enter user-name: scott/tiger
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> @C:\Createtable.sql'
Table created.
SQL> @'C:\Deletetable.sql'
Table dropped.
SQL>My problem is to get the name of the file as "c:\createtable.sql" and "C:\Deletetable.sql" in sql*plus enviornment.
Thanks & Regards
SinghDear Damorgan,
>>your version number to three decimal places
My Oracle DB Version i have already stated in my previous post is 10.2.0.1.0
Actually my problem is to get the sql files name we run in sqlplus enviornment with @ symbol. like
i have created one sql file in c drive as
"C:\Createtable.sql"
afterwords i have connected to sqlplus as
sql> conn scott/tiger
sql>@c:\createtable.sql
Now i want some query to get the name of the file which is run.
In actual my problem is as
i have suppose 10 or more SQL files in some folder ( sql1.sql, sql2.sql, sql3.sql ....).
i created one file to call all the 10 sql files (main.sql)
i have also one track_table which will keep track that which sql file is runned.
I want some automated script which will insert the record in that track_table....... for that i need the name of sql file which is runned.
Hope this will help you.
Thanks & Regards
Singh -
Extracting a count of distinct values between two date ranges over months
Hi All,
I am having a bit of difficulty in figuring out the query to build a list of active campaigns over a date range.
i.e. I have a table with campaign IDs and their start and end date details like this
Campaign_id Start_date End_date
10001 1-Jun-09 31-May-11
10002 1-Jun-09 23-Jun-11
30041 21-Aug-09 31-Dec-09
20005 3-Jun-10 31-May-11
90021 21-Nov-09 30-Nov-10
54000 1-Jun-11 1-Dec-12
35600 1-Mar-10 31-Mar-12 What the above data means is, for eg. the campaign 10001 is active from 1-Jun-09 to 31-May-11 i.e. for 24 months (inclusive of the month Jun-09 and May-11)
What I need to figure out is the counts of active campaigns between a date range and display that active count at a month level (for e.g. lets say we want to see all the campaigns that were active
between the date range '01-JUN-2007' and '30-APR-2012' ). So the partial output would be as seen below. The list would continue till december-2012
Month Year Count of active campaigns
Jan 2009 0
Feb 2009 0
Mar 2009 0
Apr 2009 0
May 2009 0
Jun 2009 2
Jul 2009 2
Aug 2009 3
Sep 2009 3
Oct 2009 3
Nov 2009 4
Dec 2009 4
Jan 2010 3
Feb 2010 3
Mar 2010 4
Apr 2010 4
Dec 2012 1 Could anybody please help me with the right query for this.
Thanks a lot for help
Regards
Goldiset pagesize 40
with tab as
select 1 id, sysdate -100 start_date, sysdate end_date from dual
union
select 1 id, sysdate -200 start_date, sysdate -150 end_date from dual
union
select 1 id, sysdate -600 start_date, sysdate - 400 end_date from dual
union
select 1 id, sysdate -300 start_date, sysdate - 150 end_date from dual
union
select 2 id, sysdate -100 start_date, sysdate-50 end_date from dual
year_tab as
select
add_months(min_date, level -1) m
from
select min(trunc(start_date,'YYYY')) min_date, add_months(max(trunc(end_date,'YYYY')), 12) max_date
from tab
connect by level <= months_between(max_date, min_date)
select to_char(m,'YYYY') year_,
to_char(m,'Month') month_,
nvl(act, 0) act
from year_tab,
select m date_,count(*) act
from tab, year_tab
where m between trunc(start_date,'MM') and trunc(end_date,'MM')
group by m
) month_tab
where m = date_(+)
order by m;
YEAR_ MONTH_ ACT
2010 January 0
2010 February 0
2010 March 0
2010 April 0
2010 May 0
2010 June 0
2010 July 0
2010 August 0
2010 September 1
2010 October 1
2010 November 1
2010 December 1
2011 January 1
2011 February 1
2011 March 1
2011 April 0
2011 May 0
2011 June 0
2011 July 1
2011 August 1
2011 September 1
2011 October 2
2011 November 2
2011 December 2
2012 January 2
2012 February 2
2012 March 2
2012 April 1
2012 May 1
2012 June 0
2012 July 0
2012 August 0
2012 September 0
2012 October 0
2012 November 0
2012 December 0
36 rows selected. -
I have a date '12/02/1989'. how do i get the year out of this date.
or take a sysdate and get the year out of it.
Thanksthis?
SQL> ed
Wrote file afiedt.buf
1 SELECT EXTRACT (YEAR FROM TO_DATE('12/02/1989','mm/dd/yyyy')) year
2* FROM dual
3 /
YEAR
1989
or this/
SQL> ed
Wrote file afiedt.buf
1 SELECT to_char( TO_DATE('12/02/1989','mm/dd/yyyy'),'YYYY') year
2* FROM dual
SQL> /
YEAR
1989too late
Message was edited by:
devmiral -
Hello there,
I am totally green in web development.
my goal is to, for the user will input a date range from and
to and will out put the records in the intranet when they press a
button.
However, the good news is: I have experience in programming.
I have written applications for desktop in VB>NET and I
understand RDBMS /sql concepts .
But CF and WEB development is new to me.
My current projects involves in connecting to DB and testing
it. (it works fine)
And outputting reports by to a intranet page. (records)
i need help on how to start this asap. I will even do some
practice at home.
Tools I have at work
• Development server(test)
• Home site.
• Toad for db connection.
• Html reference guide
• Cf dummies book.
How can start my projects.
(ex. Create cf, outputpage?)
seriously, I am new to this.
Thanks.Well, I had a really nice response with some concepts and
ideas for you to practise on etc, but these dumb forums timed out
and I lost it all
If you want to pop me an email we could probably do a few
exercises together that way - or even by MSN Messenger if you want. -
How to calculate the Time difference between 2 dates
HI All,
I am using HR_hk_diff_btw_2_dates to calculate the employee service dates.
For that i am inputing his hire date and Term dates and Output format as '05' i am getting output perfectly....
But problem is whe i am inputting the employee hire date is Dec 1 2007 and Term date is
March 31 2009 It is coming as 1 year 3 months 31 days instead of 1 year 4 months directly .......How could we make it make last date also working day and get the O/p as 1 year 4 months ?Please Advice..
Regard
sas1. FM for difference betwwen two times:SCOV_TIME_DIFF
Import parameters Value
IM_DATE1 2008-01-01
IM_DATE2 2008-01-01
IM_TIME1 10:00:00
IM_TIME2 11:30:00
Export parameters Value
EX_DAYS 0
EX_TIME 01:30:00
2. SD_CALC_DURATION_FROM_DATETIME : Finds the difference between two date/time and report the difference in hours
L_MC_TIME_DIFFERENCE : Finds the time difference between two date/time -
Select Between two date ranges from xml file
Hi ,
I have a column date_ with datatype VARCHAR2(150) it stores
data as
05/19/2010 11:23 AM
05/20/2010 12:23 PM
05/22/2010 11:23 AM
05/25/2010 11:23 AM
i have to select all the rows between 05/19/2010 and 05/22/2010 how to do that this column is in xml fileI have a table wit two fields
Field1 is integer and field2 is xmltype
in the xmltype i store an xml file
<ParentNode>
<Node>
<Cat>1</Cat>
<Date>05/19/2010 11:23 AM </Date>
</Node>
<Node>
<Cat>2</Cat>
<Date>05/20/2010 12:23 PM </Date>
</Node>
<Node>
<Cat>3</Cat>
<Date>05/22/2010 11:23 AM </Date>
</Node>
</Parentnode>
I am using teh below query to retrive teh result
SELECT T.Feild1, XML.* FROM Tablename T,
XMLTable( 'Parentnod/Node' PASSING T.Feild2 COLUMNS Cat NUMBER PATH 'Cat' ,
DATE_ VARCHAR2(100) PATH 'Date'
)XML where cat >1;
now i have to do teh same to select the rows between two date range 05/19/2010 and 05/21/2010
hope i am able to make teh question simple -
I'm new in Oracle. And I need to get the sql file of a database which already created so that I can use this sql file to create all the tables or modify some of the fields easily.
How to get started? Any recommend documents?When you install oracle 8i you will get some testing users with example tables like 'scott' user, if you install oracle 9i, you will have HR and other testing users with data and tables. You can start from there.
http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96590/toc.htm -
How do i get number of days between 2 dates?
How do i get number of days between 2 dates?
and the result must be in int.
for example
Ex. startdate: 2006-06-01 enddate: 2006-06-30 and the result is: 30
how to do so? thxmel
Iv'e used this method. It assumes startdate,enddate and days have been defined before but you could pass them as args.
void days()
try
Date d1 = DateFormat.getDateInstance().parse(startdate);
Date d2 = DateFormat.getDateInstance().parse(enddate);
long days = (d2.getTime()-d1.getTime())/1000/60/60/24;
days = ""+days;
catch (ParseException e)
System.out.println("Invalid date format");
}It actually gets the duration in ms and divides down to days.
Regards
Chris -
How can I get number of days between 2 dates ?
How can I get number of days between 2 dates ?
Give me answer as soon as possible.....Mukesh_Prajapat wrote:
How can I get number of days between 2 dates ?
Give me answer as soon as possible.....Is google broken again?
[How To Ask Questions The Smart Way|http://www.catb.org/~esr/faqs/smart-questions.html] -
Logic to build report to get the stock on a particular date
Dear Guru's,
We are trying to build a report for getting the stock on a particular date. It is not possible to copy MB5B that option is ruled out. We have also tried to get the data from MBEWH but that is also not helping as the table is not updated for all the periods.
Please advice
Thanks,
SamDear Sameer,
You can copy MB5B report and can modify as per your reuirement.
If you want get stock a paticular date.It is hard to get, why because you have to fetch all the Material documents
and you have to use MBEW table to get the current date stock and you have to do add/subtract from calculated stock.
Due to this there will performance issues also.
So try to copy MB5B and change as per your requirement.
regards
Subhash -
MacPro backed up to Time Machine, added Mac Mini now get "The backup disk image “/Volumes/Data/Jerry Booher’s MacBook Pro.sparsebundle” is already in use." error when Mac Pro tries to back up
It is standard Mountain Lion error due to the networking ability which is comparable to wet string. (actually that was lion.. it dried out some with Mountain Lion.. higher in the hills perhaps!!)
See C12 and C17
http://pondini.org/TM/Troubleshooting.html
But many people are suffering the same issue..
And the above is even a little out of date.. you might need to do a reset to the TC.
Welcome to Apple's beta program for everyone. -
How can i get the SQL of a tablespace from the database
Hello All,
I am using Oracle 11g R2. I want to get the SQL of some tablespaces on my database. in the same way i get the DDL of the table using the GET_DDL function.
How can i get that ?
Regards,try this please
select dbms_metadata.get_ddl('TABLESPACE',tb.tablespace_name) from dba_tablespaces tb;or
select 'create tablespace ' || df.tablespace_name || chr(10)
|| ' datafile ''' || df.file_name || ''' size ' || df.bytes
|| decode(autoextensible,'N',null, chr(10) || ' autoextend on maxsize '
|| maxbytes)
|| chr(10)
|| 'default storage ( initial ' || initial_extent
|| decode (next_extent, null, null, ' next ' || next_extent )
|| ' minextents ' || min_extents
|| ' maxextents ' || decode(max_extents,'2147483645','unlimited',max_extents)
|| ') ;'
from dba_data_files df, dba_tablespaces t
where df.tablespace_name=t.tablespace_name Edited by: Mahir M. Quluzade on Mar 14, 2011 4:51 PM
Maybe you are looking for
-
I know this is beating an old dead horse, but I find it frustrating that Java does not support unsigned types. I frequently work with binary file formats that store data in unsigned types. In Java there is no easy way to work with these files. For ex
-
Nouveau doesn't start with some error messages
I have Samsung NP300V5A laptop, with GeForce GT520MX installed. After nouveau installation I saw some errors I've never seen before, and I didn't find anything useful on the web on that matter. Any suggestions appreciated. dmesg|grep nouveau: [ 11.
-
Hi I am trying to translate an application from English to French and have been following the normal Translate Application process. I downloaded the XLIFF file and made some translations into French then completed the stage 'Apply the Translation fil
-
AuthorizationFailure Error while executing the BPEL Process
Hi, We have created BPEL Process with Partner Link, while executing BPEL Process we are facing the following error as <Summary>AuthorisationFailure: User Not Authorised to execute Service. </Summary> We are currently using SOA 10.1.3.0.. Please help
-
XPS 8500, AMD Radeon HD 7870, TF2 Crashes
Team Fortress 2 crashes my XPS 8500. I have an AMD Radeon HD 7870. It always crashes, ALWAYS. There are wild audio and screen artifacts associated w/ this. Often the card dies and I get a message that the card failed but then recovered. The game whit