I require to find the years between any given date range. For example what are the years between the dates '01/12/2010' and '01/02/2012'? Answer must be '2010,2011,2012'. how to code the query for this result?
here we have an scenario where we want to find out all the sql statements that are executed in a particular time. The sql statements are executed via our application. I tried in awr report but it shows only the sql query which has taken long time to execute. and i even tried in V$session and V$sqlarea. how to view the executed sql statements in a particular session/current session
insert into call values(1,9818764535,9899875643,'IN','24-APR-13 02:10:43',10); insert into call values(1,9818764535,9898324234,'IN','24-APR-13 05:06:78',10); insert into call values(1,9818764535,9215468734,'IN','24-APR-13 15:06:78',10); insert into call values(1,9818764535,9899875643,'OUT','25-APR-13 01:06:78',10); insert into call values(1,9899875643,9899875643,,'OUT','25-APR-13 22:06:78',10);
Query : need to find first and last call of '9818764535' mobile number and of call_date between '24-apr-13' and '25-apr-13';
Table: temp_user_access NAME Null? Type ------------------------------- --------- ----- USERGROUP VARCHAR2(255) USERNAME NOT NULL VARCHAR2(40) NICKNAME VARCHAR2(40) AAACC VARCHAR2(70) SYSTEM VARCHAR2(10)
I have one table which has two columns name,qty and it has data like arif,3 pcs i want to display it in 3 lines if the qty is 3 and in 2 lines if the qty is 2 using sql query
I brought in the Northwind database 2003 in to SQL Developer. I was looking at the view 'Summary of Sales by Quarter' But this report brings in everything. It doesent give me summary of sales for Qtr1, Qtr4 etc
These are the columns:
ShippedDate OrderId Subtotal CREATE OR REPLACE FORCE VIEW "NORTHWIND"."SUMMARY_OF_SALES_BY_QUARTER" ("SHIPPEDDATE", "ORDERID", "SUBTOTAL") AS
[code]....
How can i recreate this view to show me summary data for qtr1, qtr2, qtr3 and qtr 4 for the year 1997??
EFFECTIVE_START_DATE: SCD field, Date ABACUS moves from one department to another.
EFFECTIVE_END_DATE: SCD field, Date ABACUS left the department from another. To keep history of movement.
The sample report shows possible scenario on my data.
I want to build monthly report to cater from departmental headcount on monthly basis, starting from from ABACUS start date.
see sample report below
MONTH | DEPARTMENT |NEW_HIRES | RELOCATION (OUT) | RELOCATION (IN) | NET TOTAL PREV MONTH | NET TOTAL PRESENT MONTH | WHERE MONTH: REPORT MONTH DEPARTMENT: THE DEPARTMENTS IN THE ORGANIZATION NEW_HIRES: NUMBER OF NEW STAFFS HIRED THAT MONTH BASE ON EMP_START_DATE RELOCATION_OUT: NUMBER OF STAFFS MOVEMENT TO ANOTHER DEPARTMENT (EMP_END_DATE IS NULL, EFFECTIVE_START_DATE AND
Create a procedure generate_daily_session_summary that will read the pcm_session_summary (pk sess_id) table and create a per day summary in the pcm_session_summary_daily table.
1. Summarize all records from pcm_session_summary for session start timestamp (START_TS) greater than the max existing SESS_DT from pcm_session_summary_daily table and less than the start of current day. Insert the records into the pcm_session_summary_daily table.
2. Populate the fields in pcm_session_summary_daily as follows :
sess_dt - truncated date from pcm_session_summary.start_ts unique_user_cnt - count of unique cws ids encountered in that day, sess_cnt number - count of total sessions in that day , max_concurrent_sess_cnt number - maximum number of concurrent sessions at any point of time in that day. Concurrent sessions are defined as those that have overlapping start_ts or end_ts - sessions that were active at the same moment in time would be concurrent with each other.
3. The procedure will be scheduled to run every day in a batch job and will summarize session data until the end of the previous day
I have the table with below details.
desc PCM_SESSION_SUMMARY Name Null Type ---------- -------- ------------ SESS_ID NOT NULL NUMBER USER_CUPID VARCHAR2(10) START_TS TIMESTAMP(6) END_TS TIMESTAMP(6) ACT_CNT NUMBER
[code]....
I have written the below query to get the result for question no:1
select trunc(start_ts,'DDD') start_ts,count(distinct(user_cupid)) user_cnt,count(SESS_ID) Sess_cnt from PCM_SESSION_SUMMARY where START_TS < sysdate or START_TS > (select max(sess_dt) from pcm_session_summary_daily where sess_dt < sysdate) group by trunc(start_ts,'DDD') order by start_ts;
However i tried a lot but not sure how to get maximum concurrent session count for a day.One of my friend comment below.
The Pcm_session_summary_daily is empty so you need to handle nulls when doing max. That will fix the issue of no results for the Greater Than condition.
You need to get concurrent count of sessions with respect to one another, the query that you have will not work. Do it in PL/SQL using procedural logic. The queries would return multiple rows, you need to handle that.
I've been experiencing strange Oracle behavior from time to time when using "explain plan". what could be the reason? (I'm going to create an Oracle ticket when I could find the cause...)
The total cost of a query was low (ex. ~500) while sub-parts of the query has high cost (ex. ~10000).I don't want to provide the query itself as the issue is observed for huge queries (like 2M characters!).The execution plan looks like this:
and we click on create summary folders we got this error Summary management not available because : this user has no privilige or quota to create materialized view in the current schema External summary registeration not available because : this user has no privilige or quota to create materialized view in the current schema
I have one group wise report and my requirement is i need to print both the Outputs in one single report first, is group with details and the summary in the last page showing machine code and summary of qty as totals ,I have given below test case .
insert into ot_cut_detail values ('L1','01','1001',2); insert into ot_cut_detail values ('L1','01','1002',2); insert into ot_cut_detail values ('L1','01','1003',2); insert into ot_cut_detail values ('L2','01','1004',2); insert into ot_cut_detail values ('L2','01','1005',2);
I'm wanting to create a query that will give me a summary of parts and labor from work orders. However there are three tables. work_order, parts, labor. Sometimes there will only be parts, sometimes just labor, or sometimes both. Well my query will only return results when they are on both. Sample query is below. Do I need to create a temp table to gather the data or is there a way to do this with a sub query.
select work_order.wono, sum(parts.cost), sum(labor.cost) from work_order, parts, labor where work_order.wono = parts.wono and work_order.wono = labor.wono group by work_order.wono;
ck_amt is checkbox.. ck_amt_tot is total of jtt_amt_1 [but total only those record whose checkbox is checked]
My task is like this When i checked checkbox whatever value in jtt_amt transfer to jtt_amt_1 field
but i can change value in jtt_amt_1 field ...i want to take addition of that changed field and show that sumation in ck_amt_tot.
I write trigger when-checkbox-changed like this ------------------------------------------------- IF :jou_tra1_tab.ck_amt = 'Y' THEN set_item_INSTANCE_property ('jou_tra1_tab.jtt_amt_1',CURRENT_RECORD, UPDATE_ALLOWED, PROPERTY_TRUE); :jou_tra1_tab.jtt_amt_1 := :jou_tra1_tab.jtt_amt; else :jou_tra1_tab.jtt_amt_1 := 0; END IF;
and when validation item trigger for jtt_amt_1 : -------------------------------------------------- IF :jou_tra1_tab.ck_amt = 'Y' then :jou_tra1_tab.ck_amt_tot := :jou_tra1_tab.ck_amt_tot + :jtt_amt_1 ; else :jou_tra1_tab.ck_amt_tot := :jou_tra1_tab.ck_amt_tot - :jtt_amt_1 ;
But when i changed value in jtt_amt_1 field i cant get write summation .
how to put exceptions while defining the summary item ? In one of my datablock there are certain lines whose "inactive_flag" gets a "Y" value on certain events. I want my summary item to exclude such amounts from summing up.
I have got another curly one with regard to Sql Loader. My original issue via [message #513696] was resolved. In summary, SQL Loader opens a comma delimited csv file and it is able to successfully populate the appropriate Oracle table. However, during the run to process each unique csv file, SQL Loader produces a both a .log file (indicating what transpired during the load) and a .bad file of the records from the csv file that where rejected by SQL Loader.
the users have requested that "is it possible to update a separate table of the summary results of what went wrong and what was right?" It just so happens that the csv file contains some summary records (rows) with processing audit infor...as the following .bad file wrote out.... ___________________________ ModuleID,ModuleSN,Lat,Lon,GMT Time,Tag Count,GMT Date,Client,Farm,Field,Variety,Machine No Module ID ,No SN ,-30.178958,149.63844,9:55:58,0,21/04/2011,101,Widgen ,9,71BRF ,5987 3500B9880611170260179BFB,10202094587,-30.199379,149.661333,7:10:35,2,22/04/2011,101,Widgen ,30,71BRF ,5987 ,,,,,,,,,,, Total Modules,1602,,,,,,,,,, Mis-reads,1,,,,,,,,,, Mis-read %,0.06,,,,,,,,,,
1. The first record (starting in the 1st postion is "ModuleID") is a heading record in the csv file and can be disregarded. 2. The secord record (starting in the 1st postion is "No Module ID") is an error record in the csv file and can be disregarded. 3. The third record (starting in the 1st postion 3500B9880611170260179BFB, ) is a valid record, however, is was rejected as it is a duplicate of a preceeding record ...and the log indicates ...
Record 124: Rejected - Error on table PTLIVE.MODULE_CSV_LOADS. ORA-00001: unique constraint (PTLIVE.MODULE_SERIAL_NUMBER_UK) violated
4. The fourth record (starting in the 1st postion is ,,,,,,,,,,, ) is a blank record in the csv file and can be disregarded. 5. The fifth record (starting in the 1st postion is "Total Modules" has a value of 1602 which I need to capture to write into a separate table. 6. The sixth record (starting in the 1st postion is "Mis-reads" ) has a value of 1 which I need to capture to write into a separate table. 7. The last record in the csv file and can be disregarded.
The summary Oracle table is CREATE TABLE PTLIVE.SUBMODULES_SUMMARY ( IMPORT_CSV_FILE_NAME VARCHAR2(256 ), TOTAL_SUBMODULES_LOADED NUMBER (5), TOTAL_SUBMODULES_MIS_READ NUMVER (5), DATEIMPORTED DATE default SYSDATE )
Now I would like to trap the value 1602 and load that into the Oracle column TOTAL_SUBMODULES_LOADED and the value 1 and load this into TOTAL_SUBMODULES_MIS_READ.
The name of the csv file is known and I can (as the previous [message #513696] resolved) simply use a SQL Loader control file command > IMPORT_ CSV_FILE_NAME CONSTANT "Batch_2011Jun29_TEST.csv".
Reg. Area Age <=19 20 <= Age <= 24 25 <=Age <= 29 Total No. of Voters xxxx 10 15 7 32 yyyy 5 7 3 15
I have work out a script but the age is not in a range
select * FROM (select rgs_id_reg_area, count(decode(fbd_age,19,fbd_age)) Age19, count(decode(fbd_age,20,fbd_age)) Age20 FROM rubyvoterstat where vote ='Y' GROUP by rgs_id_reg_area) order by rgs_id_reg_area
1) Alter table STS.DNA_ACCESSION add PARTITION DNA_ACC_P143 VALUES LESS THAN (286000000); ORA-14074: partition bound must collate higher than that of the last partition
2) ALTER TABLE STS_RO.DNA_ACCESSION SPLIT PARTITION DNA_ACC_P999 AT VALUES LESS THAN (286000000) INTO (PARTITION DNA_ACC_P143,
I have table :TABLE_X and want to select some data locate into specific range of Day/Month. But so far i couldn't find out the way to.
For example, i want to select people born within specific range of date(range : sysdate to (sysdate+7months ahead) Year here should not be consider, only the day and month.
e.g. a range could be from today:Sept,20 to Apr,18.
so what i was trying is to select doing the following.
select TABLE_X_ID, TABLE_X_BIRTH_DATE from TABLE_X where to_date(TABLE_X_BIRTH_DATE, 'DD/MM') between to_date (to_char(SYSDATE, 'DD/MM'), 'DD/MM') and to_date (to_char(SYSDATE+210, 'DD/MM'), 'DD/MM')
first am not sure if BETWEEN & AND will work for this case, bt it was the most logical way i could think about to get such range.
I am trying to create a SQL query which will check that various postcode formats are valid, but I am having trouble getting oracle sql to check for values within ranges - for example the following returns no rows, even though most of the postcodes I am dealing with start with 'P'.
select postcode from mytable.addresses where postcode like '[N-R]%' ;
This data needs to be represented in a SQL report as below. The Date Range in the below i.e., Starts with FEB, by checking against the sysdate.. That is from sysdate it will display the Quarter data for 4 months as below.
Currently I am using a procedural logic to populate data into a different table in the above format. Is there any method to do with a single SQL using PIVOT. Below given is the table structure and Insert scripts.