SQL & PL/SQL :: Data In Column-wise?
Jul 22, 2013
For one of our requirement, we are asked to provided data in below manner.
Deptno Deptname emp_name_1 hire_date_1 emp_name_2 hire_date_2
10 Sales Raghu 25-Jan-2007 Abbhilash 29-Mar-2009
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
[code]...
View 21 Replies
ADVERTISEMENT
Feb 18, 2013
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.
View 1 Replies
View Related
Mar 1, 2012
I have a table which have three column.
1) empid
2) date
3) status
I want to show the value empid intime outime.
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.
View 1 Replies
View Related
Dec 21, 2012
I have two tables as below
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)
View 5 Replies
View Related
Sep 11, 2012
I have data something like this.
Employee_id date_loggedin
123 09/10/2012
134 09/03/2012
111 09/02/2012
123 08/27/2012
134 08/01/2012
123 07/06/2012
111 05/11/2012
123 07/04/2012
123 07/03/2012
123 03/15/2012
123 01/11/2012
The desired output for input of employee_id=123 and dates between 01/01/2012 and 09/30/2012
Month login_count
JAN_2012 1
FEB_2012 0
MAR_2012 1
APR_2012 0
MAY_2012 0
JUN_2012 0
JUL_2012 3
AUG_2012 1
SEP_2012 1
View 2 Replies
View Related
Nov 15, 2011
i am getting the data like bellow i need the data with out null values
date col1col2col3col4
16-Nov-1123
17-Nov-1112
18-Nov-11321
19-Nov-1123
20-Nov-11132
16-Nov-112321
17-Nov-11112
18-Nov-11211
19-Nov-11132
20-Nov-1112
16-Nov-1145
17-Nov-11465
18-Nov-112123
19-Nov-11132
20-Nov-1165
16-Nov-11456
17-Nov-11546
18-Nov-114656
19-Nov-11566
20-Nov-11564
need out like below
date col1col2col3col4
16-Nov-1123232145456
17-Nov-1112112465546
18-Nov-1132121121234656
19-Nov-1123132132566
20-Nov-111321265564
View 3 Replies
View Related
Nov 11, 2010
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.
View 10 Replies
View Related
Apr 24, 2010
i want displaying the query data page wise.
i want place 4 buttons
1 for 1st page, 2nd for next page, 3rd nxt page and 4th for last page.
how can i do this through programming in oracle forms 10g.
give me the entire process of doing this.
i am waiting for your response.
View 9 Replies
View Related
Jun 4, 2013
I have a requirement to list the data month wise dynamically where month data is also in the same table, hopefully the below posts should bring more clarity to my requirements.
1. Table creation:
Create table T1 (account_no varchar2(15), area_code varchar2(2), bill_month date, consumption number);
2. List table content:
select * from T1;
account_no area_code bill_month consumption
Q00001Q31-Jan-12125
Q00002Q31-Jan-1265
Q00003Q28-Feb-12219
Q00004Q28-Feb-12805
Q00005Q28-Feb-1254
Q00001Q31-Mar-12234
Q00002Q31-Mar-12454
Q00003Q31-Mar-12232
Q00004Q30-Apr-1221
Q00005Q30-Apr-12218
Q00001Q30-Apr-1254
Q00002Q31-May-1219
Q00003Q31-May-1287
Q00004Q30-Jun-12187
Q00005Q30-Jun-1278
so on......so on......so on......so on......
3. Expected output:
account_no area_code Jan-12 Feb-12 Mar-12 Apr-12 May-12Jun-12Jul-12Aug-12Sep-12Oct-12Nov-12Dec-12
Q00001 Q 125 548 2345487423154821518738721512
Q00002 Q 65 127 45487819357831585683152878
Q00003 Q 545 219 2328738735188745897313
Q00004 Q 78 805 1221218187885718387389787138
Q00005 Q 541 54 2621878778386538698182
With the conventional query I hope this is impossible,
View 2 Replies
View Related
Mar 21, 2013
I have a table where i have description column which free text column, the data in description column is seperated and i want to corvert 1 row data in multiple rows dependeing on the number of words.
eg
id description
78664 Pumps Alarm from CAMS RTU154
In the above example this column has 5 word so i want data in 5 rows like below
78664 Pumps
78664 Alarm
78664 from
78664 CAMS
78664 RTU154
This column data can be varied from 1 to any number of words.
View 11 Replies
View Related
Jul 31, 2013
I have a INSERT query which is happening with a SELECT query.
===================================================
INSERT INTO tbl_fact_effort_lvl_data ( ............... )
SELECT ria.report_id,report_status: :,
((SELECT lov_num_val
FROM tbl_reference_data
WHERE lov_type = 'FREQUENCY' ) * (SELECT SUM(pph_task)
FROM tbl_ri_process
WHERE report_id = ria.report_id )) TOT_YEARLY_PROD_HOURS ,TOT_YEARLY_PROD_HOURS * tf.fac_value TOT_FACT_DATA,location_id
FROM tbl_fact tf LEFT JOIN ......... ;
====================================================
So, here I want to use column alias TOT_YEARLY_PROD_HOURS as another column to derive another column value TOT_FACT_DATA.
View 8 Replies
View Related
Jul 2, 2011
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.
View 3 Replies
View Related
Jul 26, 2013
I want output like given below. Using EMp table . if sal is <1000 means count of Emp's who are having lessthan 1000 like that.
Deptno sal sal sal sal
<=1000 <=2000 <=3000 <= 5000
10 2 4
20 2.
View 2 Replies
View Related
Jul 1, 2011
I want to get the current month day wise count. I dont want Procedure. I need SQL Query only.For example:
July 2011.
Sunday - 5
Monday - 4
Tuesday - 4
Wednesday- 4
Thursday - 4
Friday - 5
Saturday- 5
View 3 Replies
View Related
Nov 2, 2010
i want create a report like this
location sysdate refdate No_of_days SL1(0-90) SL2(91-180) SL3(>180)
So when no. of days between (0-90) data put in SL1
And when no. of days between (91-180) data put in sl2
I want to achieve this only in single query.
View 11 Replies
View Related
Jul 1, 2013
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..
View 4 Replies
View Related
May 26, 2013
how could i display india as i n d i a in rowize in oracle query
output
-----------
i
n
d
i
a
(i am newbiee to this forum ,i dont know on which category i should post this question is there any general category for orcle questions?)
View 5 Replies
View Related
May 4, 2013
I have a requirement as follows :-
The user will submit the start date and end date. Based on the date parameters, the customized procedure should do some calculations month-wise.
For eg : start date - 01-Dec-2012 to end date - 31-Mar-2013
I want the break up as
Start date End date
01-dec-2012 31-dec-2012
01-jan-2013 31-jan-2013
01-feb-2013 28-feb-2013
01-mar-2013 31-mar-2013
How can i achieve this month-wise break ?
View 6 Replies
View Related
Dec 28, 2010
I was wondering how can I do below statement in oracle
update table1 t1 set t1.column1 = t2.column2
from table2 t2 inner join table3 t3 on t3.column3=t2.column4
where t3.column5 is null
I tried read up merge and update, but not really understand how the syntax works in oracle.
View 2 Replies
View Related
Apr 20, 2012
I would like to have column data as column headers.
Tables:
skill_table
SKILL_ID | NAME
3431060 | Stomach
3431064 | Hand
3437806 | Finger
localnode_table (which actually has the order/alignment (like what is next and what is previous) of the name from skill table.
NODE_ID | PREVIOUS_ID | NEXT_ID
3431060 | | 3431064
3431064 | 3431060 | 3437806
3437806 | 3431064
How to make it appear like:
Stomach | Hand | Finger
3431060 | 3431064 | 3437806
View 3 Replies
View Related
Apr 28, 2010
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
[code].....
View 3 Replies
View Related
Feb 20, 2012
I need to query by fiscal year wise.
For example
1-Apr-2010 to 31-Mar-2011
View 11 Replies
View Related
Aug 11, 2010
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
View 8 Replies
View Related
Sep 18, 2012
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)
[code]....
View 11 Replies
View Related
Dec 11, 2012
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?
View 2 Replies
View Related
Oct 26, 2013
1) First Table
Id , Name , Eff_date
10 I1 15-APR-2013
20 I2 30-APR-2013
30 I3 26-May-2013
20 I4 10-SEP-2013
40 I5 10-sep-2013
40 I6 10-Oct-2013
2) Second Table
Eff date Rate
15-APR-2013 900
30-APR-2013 500
16-Sep-2013 400
05-Oct-2013 200
Q. How to get department wise effective rate?
View 3 Replies
View Related
Feb 24, 2013
how to find out growth of database month wise?
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 .
Whats your inputs on this ??
View 21 Replies
View Related
May 26, 2013
I am trying to add a new column in a table and insert data from another column of same table.
alter table POSITION add INT_MK_DATA_ID number(10,0) null;
update POSITION set INT_MK_DATA_ID = INST_MARKET_DATA_ID;
commit
As there are huge number of records in the POSITION table ...its taking for ever to execute this query.
View 1 Replies
View Related
Oct 7, 2011
I have come one requirement where i need to extract data from a LONG RAW data type column.
View 7 Replies
View Related
Oct 3, 2010
I ve a data in table as follows
code status seqnce Length
B1 AVL 1 10
B2 AVL 2 10
B3 ASG 3 10
B4 AVL 4 10
B5 AVL 5 10
B6 AVL 6 10
B4 ASG 7 10
B4 ASG 8 10
I need to group the AVL status codes with the sum of lengths Ex) B1 to B2 - 20 B4 to B6 - 30 like that.
View 5 Replies
View Related