In oracle query can i want find out how many day wise count for a year days (for example how may sundays, mondays, tuesdays, wednesdays ,thursdays,fridays,saturdays) in a given year (we can give the start day of the year and the end day of a year).
example
----------
jan sun-5 mon-4 tue-5 wed-5 thu-5 fri-4 sat-5
feb ------------do---------------------------------
like this for all 12 months at a single query.
i hav the following records i need to display the records of financial year wise (i.e april year-1 to mar year) here there are no records for months 9,10(september and october)
what i want is 0 to be displayed over there in the below table
s.no key id yyyymm ce1 ce2 ce3 t ihu pf mi pwd F 920110600000156431372010043424541500065457709539XXXXXXXXXXU 10201106000001565313720100534245415000009539XXXXXXXXXXU 11201106000001566313720100634245415000009539XXXXXXXXXXU 12201106000001567313720100738555415000009539XXXXXXXXXXU 13201106000001568313720100836445415000009539XXXXXXXXXXU 1420110600000157131372010110000009539XXXXXXXXXXU 15201106000001572313720101276881082200001888009539XXXXXXXXXXU 1620110600000157331372011010000009539XXXXXXXXXXU
I have form (table GL_PV)in this form I want to generate voucher no financial year wise.
I have Four columns
Year varchar2(4) Month number(2) Pv_no number(6) Pv_date date
--- I use pre-insert tirgger---
when Insert record year save pv_date 'YYYY' (2010)
Month save as 'MM' (7) and pv_date I enter manulay
now I want Pv_no it should generate auto according to financial year.
I have 2 financial year 2009-2010 June-July 2010-2011 June-July
I want that every financial year PV_no should be separate. both financial year pv_no start from 1. when I enter data any financial year first it check the MAX(PV_no) then generate next Pv_no No. MAX(pv_No)+1
( select 0001 item_code, to_date(1997,'yyyy') Yr from dual union all select 0002 , to_date(1998,'yyyy') from dual union all select 0003 , to_date(1999,'yyyy') from dual union all select 0004 , null from dual union all select 0005 , null from dual) select count(Yr) from test group by yr
COUNT(YR)
1 1 1 0
But I want the completed year count and non completed year count The non completed year count should be 2 as there are two null How I would acheive?
Using Oracle 11g...We have a table in our database of data with the following information:
MASTER_RECORD, MEMBER_RECORD, BUSINESS_UNIT, GENDER, DOB (date), age [at time of month_record], MONTH_RECORD (date) [31-MON-YEAR for recorded active month]
The table has ~55 million records. Existing index is only on MASTER_RECORD.There is now a need to create a view which is an aggregate count of member records, grouped by business_unit,gender, age per year. eg:
business_unit, gender, age, month_record, num_of_members -> for every combination unit5, F, 25, 31-JUN-2011, 622 unit3, M, 18, 31-MAY-2011, 573
The view can be created now, but, is not fast enough to be reasonably considered a view. This table is re-created every month from a procedure, so there is flexibility on how it is created. Use interval partitioning by year( something I have not experienced using), create an index on the month_record,then create view.
select in1.empid,in1.atttime,out.atttime from (select empid ,atttime from attend where status=1 and to_char(atttime,'mmyyyy')='022012' order by empid,atttime desc) in1, (select empid,atttime from attend where status =0 and to_char(atttime,'mmyyyy')='022012' order by empid,atttime desc) out where in1.empid=out.empid and in1.empid='02256' order by in1.atttime,out.atttime
But this query do .one value relation with all column.means first february in time with all out time.
If a particular department has 10 employees it should have data upto emp_name_10,if department has only 5 employess it should data upto emp_name_5 and so on.I came up with below approach, in this approach I need to create new table to store the data in row wise.
In my actual requirement 4 tables needs to be joined and 2 of the tables are very large.Is there any other approach without creating a new table, something within pl/sql.
drop table emp_dept; create table emp_dept(deptno number,dept_name varchar2(100),emp_name varchar2(100),hire_date date,seq_cnt number,total_cnt number); insert into emp_dept
OS : Windows 2003 DB : 10.2.0.4 I am doing capture and replay first time.I want to take 2 captures at a time. 1st capture for 2 schemas and 2nd capture for other schemas.Is it possible?I have searched on internet but didn't get any clue about it..
I have a table with starting date and ending date.
I want to fetch monthwise days for given two dates
IE starting 25/12/2009 ending 25/03/2010
Result should like below.
Dec-09 7 Jan-10 31 Feb-10 28 Mar-10 25
I have tried this but it is not giving me the result which want..
select to_char(thedate,'mon-yy') mnth,count(to_char(thedate,'mon-yy')) days from (SELECT TRUNC(to_date('25/12/2009','dd/mm/yyyy'),'Y')+ROWNUM-1 THEDATE FROM ( SELECT 1 just_a_column FROM dual CONNECT BY LEVEL <= 366
Web page that retrives data from SQL database and display it to the user in well formatted manner. Data retrieved depend upon criterias selected by the user. But sometimes data retrieved is very large. I want to display records to the user page wise, i.e. 100 records on first page and next 100 records displayed when user clicks next button. This means only 100 records should be retrieved when user first select search criteria, next 100 records retrived when he clicks next button and so on, as to reduce data transferred from server to client. how to achieve this by using single sql query as soon as possible.
Report have one parameter para name depatwhen i go to generate pdf it will ask me which dept if i pick 10 then they generate one pdf if i pick All Dept then they generate again one pdf i need seperate pdf like 10,20,30,40 generate four pdf files
how can i compute row wise multiplication for each unique value of id. I am trying to get the output as showing id and their respective results after multiplying the corresponding values.
CREATE TABLE mult_tbl( id NUMBER, val number ); insert all into mult_tbl values (1,2) into mult_tbl values (1,3)
Is there any way to capture the version wise objects (Packages) information from the oracle data base.
Ex : I have package P1 which was created on 01-NOV-2012 with version 1 . After 10 days same package has been updated version 2 with some enhancements.Like that the package will be updated according to the latest requirement.
Now I need to capture the total audit trail history of the package with version wise specific changes and when changes has been occurred hoe can I achieve this?
according to me, v$datafile can be use to know growth in database in terms of datafiles added in past months as per creation_time. but hows about those existing datafiles whose size has been re size more .
how to tune qurey for coulumn wise data saved.because we have to join same table n number of times.for reference go through the following scnarios.
Suppose one table T1 is there and it has two column KEY and VALUE.if we are writing qurey for retriving desire result in row manner we have to join samae table no of times.
KEY Value agreesWith true id 1 assessment False basisForDateOfProgression 1 bestOverallResponse 2 bestOverallUnknownComments data is ok
Qurey:
select * from ( select t.agreesWith from t1 t )a
[Code]...
In this manner we can join upto bestOverallUnknownComments .so which method we follow to reduce the execution time and performance should be good.
AREA (area_code, area_name) MONTHLY_SALES (area_code, isbn, book_name, qty, sales_amount)
I want to display the output of top 3 sales columnwise as below.
AREA_NAME Top 1st (ISBN) Top 1st (BOOK_NAME) Top 1st (QTY) Top 2nd (ISBN) Top 2nd (BOOK_NAME) Top 2nd (QTY) Top 3rd (ISBN) Top 3rd (BOOK_NAME) Top 3rd (QTY)
I have a payment table that has the ids of cds that has being sold in the past month. From there I want to make a demand wise report. I am aware of the report wizard in the oracle forms but I dont want to use it. Here are the tables in a bit more details.