Forms :: Convert Rows Into Columns As Tabular?

Mar 8, 2010

how i can convert rows into columns as tabular form.

I have two table : om_supplier
supp_code
supp_name

om_supplier_term
st_supp_code
terms

like if i want to make query form from supp_code to supp_code the output is comming

[code]
select supp_code,terms from om_supplier,om_supplier_term
where supp_Code = st_supp_code
[code]

supp_code terms
1 90days
1 180days
1 120days

i want the output like

supp_code
1 90days-180days-120days

how i can achieve this in form.

View 8 Replies


ADVERTISEMENT

SQL & PL/SQL :: Convert Column To Rows Tabular Format

Jun 8, 2011

I have job, working hours, employee id, employee name in test_emp table. The job name and employees are not fixed in this table and it varies from project to project. We don't know how many employees are there and needs to be fetching on runtime.

I have the data like below

JOB---------WRKHR---EMPID-----EMPNM
ANALYST-----10------5478------RAMESH
MANAGER-----10------4258------SACHIN
LEAD---------10------4789------VIVEK
DEVELOPER---20------5632------ROHIT
ANALYST-----20------5843------VIRAT
MANAGER-----20------4789------VIVEK
PROGRAMMER-30------5479------SURESH
LEAD---------30------4258------SACHIN
DEVELOPER---30------5231------PRAVEEN

I need the output like below format.

JOB---------RAMESH--SACHIN--VIVEK--ROHIT--VIRAT--SURESH--PRAVEEN--TOTAL
MANAGER-----0--------10-------20-----0-------0------0---------0---------30
LEAD---------0--------30-------10-----0-------0------0---------0---------40
ANALYST-----10-------0---------0-----0------20------0---------0---------30
DEVELOPER---0--------0---------0-----20------0------0---------30--------50
PROGRAMMER-0--------0---------0------0------0------30--------0---------30
--TOTAL-----10-------40--------30-----20-----20-----30--------30--------180

View 6 Replies View Related

How To Convert Rows To Columns

Jun 18, 2011

how to convert rows to columns ?

View 1 Replies View Related

Convert Rows Into Columns

May 30, 2007

Below is the schema of a table:

TableName : PropertyValue

Columns: PropertyID Number
Value varchar
ValueID Number
Phone Number

Requirement: Create a view based on the table"PropertValue'. There could be 4 different PropertyIDs for each phone.

e.g.
PropertyID Value ValueID Phone
1 'xyz' null 1234
2 null 11 1234
3 null 12 1234
4 null 13 1234
1 'pqr' null 5678
2 null 14 5678
3 null 15 5678
4 null 16 5678

Required View:

Phone Attrib1 Attrib2 Attrib3 Attrib4
1234 'xyz' 11 12 13
5678 'pqr' 14 15 16

I tried creating the required view using 'CASE' statement and group by but its returning multiple rows.

select case when PropertyID=1 then VALUE end as Attrib1,
case when PropertyID=2 then ValueID end as Attrib2,
case when PropertyID=3 then ValueID end as Attrib3
case when PropertyID=4 then ValueID end as Attrib4
from (
select Phone, PropertyID, ValueID,Value
from PropertyValue
group by Phone, PropertyID, ValueID,Value
)

View 1 Replies View Related

Convert Columns Into Rows?

Aug 3, 2009

i have a table with this data :

id name
1 a
2 b
3 c
4 d

and i want the o/p like this,

col1 col2 col3 col4 col5
id 1 2 3 4
name a b c d

means i want to convert my columns into rows.

View 1 Replies View Related

SQL & PL/SQL :: Convert Rows As Columns

Jun 7, 2010

Need to convert columns into rows like expected

service_key consumer_key the_key fin_score_type granu rno

20100201 1 p_1 100MONTH1
20100201 1 p_0 100MONTH1
20100201 1 d_6 100MONTH1
20100201 1 t_2 200MONTH1
20100201 1 d_5 100MONTH1

But it should display like below,All the the_key types as differnet colmns instead of rows,Since need to insert those values in different tables.

expected o/p consumer_key p_code p_val d_code d_val t_code t_values granula

service_key
20100201 1 p_0 100 d_6 100 t_2 200 MONTH1
20100201 1 p_1 d_5 100 MONTH1

View 5 Replies View Related

SQL & PL/SQL :: Convert Rows To Columns?

Aug 2, 2010

consider the following tables

WITH table1 AS -- this table contain a list of column names
(
SELECT 11 cid, 'TEK' group_nm, 'TYPE DESC' column_nm FROM dual
UNION ALL

[Code].....

i have 3 tables, one that contains name of columns(table1), another one contain number of rows (table2) and the last table contain

the values for columns in table1 for each row in table2.

what i want to do is join all 3 tables and display the output as follow

TYPE DESC NAME P DATE TYPE_PCT
====================================================
Good John 8/21/2010 0.009
BAD Ken 4/11/2010 10.009
Medium Rob 8/1/2010 0.001

as you can see the columns names comes from table1, and the values comes from table3. i want to join these tables so that it display the output above

View 2 Replies View Related

Convert Rows To Columns In A Table?

Apr 24, 2012

How do I convert rows in oracle table to columns by writing a query?

Here is my table.

EID QNo Qual YOP
101 1 B.Tech 2004
101 2 M.Tech 2006
102 1 B.Tech 2003
102 2 M.Tech 2005
102 3 MBA 2007

Now I want the above table in the following format......

EID Qual1 YOP1 Qual2 Yop2 Qual3 Yop3
101 B. Tech 2004 M.Tech 2006
102 B. Tech 2003 M.Tech 2005 MBA 2007

I have maximum of 8 Qualifications, how to achieve this in oracle.

View 3 Replies View Related

Convert Rows To Multiple Columns

Aug 30, 2004

I have a table called N1

N1_no Srvarea_type_cd
1 P
1 P
2 C
2 C
2 C
3 I

Another table N2

N1_no srvarea_txt
1 ABCD
2 DEFG
3 XYZA

Can i get a query so that the data can be displayed in the following way ..

P C I
ABCD DEFG XYZA

View 3 Replies View Related

SQL & PL/SQL :: How To Convert Query Columns Into Rows

Jun 19, 2013

the query used is

SELECT LOC_CD,
TO_CHAR(DT,'fmMon RRRR'),
SUM(QTY) ,
GROUPING_ID(LOC_CD)
FROM WIP
WHERE LOC_CD IN (1,2,3,4)
GROUP BY ROLLUP(LOC_CD),
TO_CHAR(DT,'fmMon RRRR'),TRUNC(DT,'MM')
ORDER BY TRUNC(DT,'MM'),LOC_CD

This query result attached

The red coln is the total I want to place it in row-wise

Date loc_1 loc_2 loc_3 loc_4 Total
May 2012 4,554 6,644 11,198
June 2012 4,986 5,838 777 11,601
22,799

View 1 Replies View Related

PL/SQL :: Convert Columns Into Rows In Oracle 10g?

Sep 26, 2012

I have Table like

ID     |A     |B     |C
---------------------------------------------------
4     |0000     |ALL     |6
7     |0000     |ALL     |3
8     |TEST     |ALL     |3

and my expected should be like this

ID |ColumnName |Value
-------------------------------
4 |A |0000
4 |B |ALL
4 |C |6
7 |A |0000
7 |B |ALL
7 |C |3
8 |A |TEST
8 |B |ALL
8 |C |3

in oracle 11g we have the option call pivot and unpivot but i dont know how achive this in 10g.

View 1 Replies View Related

PL/SQL :: Sql Query To Convert Rows To Columns

Feb 19, 2013

Im using oracle 11g.

I have data in a table as below: Column names are type,month,percentage

TYPE      MONTH   PERCENTAGE

A1         JAN-2013     100
A2         JAN-2013     100
A3         JAN-2013     95
A4         JAN-2013     98

[Code]...

The desired output using a sql query is as below

TYPE     JAN-2013     FEB-2013
A1         100             100
A2         100             99
A3         95               88
A4         98               67
A5         99               98
A6         90               95
A7         92               84

View 7 Replies View Related

How To Convert Table Data From Rows To Columns

Mar 11, 2013

I have a Employee table of the following format:

Emp_id | Emp_name | Salary
101 | James | 1000
102 | Julia     | 200

I have to convert or transpose the table data as follows using a SQL statement/function -

Emp_id | 101     |     102
Emp_name | James |     Julia
Salary     | 1000 |     2000
     
How do I achieve this?

View 4 Replies View Related

SQL & PL/SQL :: Convert Rows To Columns Using Pivot Method

Mar 16, 2010

I tried to convert rows to columns using the pivot method.But i am not able to do that.This is what i tried:

SQL> desc pt
Name Null? Type
----------------- -------- ------------
NAME VARCHAR2(10)
YEAR NUMBER(4)
VALUE NUMBER(4)
[code]....

As you can see from the above output i am not getting as expected.

Expected output:
YEAR JOHN JACK MARY
---------- ---------- ---------- ----------
1993 3000 1340 8700
1991 1000 1500 1250
1992 2000 1200 2323

View 7 Replies View Related

PL/SQL :: How To Convert Rows To Columns Data In A Table

Dec 5, 2012

I have the situation like i want display the data from table which is storing in rows into a columns....

My table structure will be like this(Here i am taking only one part but have N no. of parts in my system)

Partno Purchase date Qty
111 02-DEC-2012 15
111 03-DEC-2012 25
111 04-DEC-2012 20
*** **** ****
111 31-DEC-2012 28

So i am expecting my query out put should be in column wise, that should make columns dynamically based on dates.

like example

__Partno     01-Dec-12     02-Dec-12     03-Dec-12 04-Dec-12     ----     ----     ---     31-Dec-12__
111     0 15 25 20 28     

Here columns should be created based purchase dates dynamically with respect to quantity. Query out put will be like matrix format. So i feel that PIVOT & SYS_CONNECT_BY_PATH will not serve my requirement.

My system comparability is

oracle 10g database.
oracle 6i forms.                         

View 4 Replies View Related

JDeveloper, Java & XML :: Convert Some Of The Rows Into Columns Query

Oct 5, 2012

CREATE TABLE CFL (q_id Number(18),per_id number(18),PERIOD VARCHAR2(15 CHAR), AMOUNT NUMBER);

INSERT INTO CFL VALUES (11, 1, 'JAN-10', 10);
INSERT INTO CFL VALUES (21, 1, 'FEB-10', 20);
INSERT INTO CFL VALUES (31, 1, 'MAR-10', 10);
and so on (12 records for a year with same quota_id, e.g. here it is 1)
[code].......

Also this column values period is dynamic.. it can be for any year.

The select will return values like

Select per_id, PERIOD, amount from cfl
where quota_id = 1

Basically 12 rows will be the output:
per_id period amount
1 JAN-10 10
1 FEB-10 20
1 MAR-10 10
..............and so on

1 DEC-10 10

The result output should be:

Per_id JAN-10 FEB-10 MAR-10.............DEC-10
1 10 20 10................10

View 14 Replies View Related

SQL & PL/SQL :: Convert Columns To Rows With Extra Hard Coded Column

Mar 30, 2012

I've a query that sum up data from one table. But I've to convert them into rows.

Summary query result.

COL1 COL2 COL3 COL4
1000 2000 3000 4000

Test Table creation script.

CREATE TABLE TEST_TBL
(
COL1 NUMBER(14,2),
COL2 NUMBER(14,2),
COL3 NUMBER(14,2),
COL4 NUMBER(14,2)
) ;

INSERT INTO TEST_TBL VALUES( 1000, 2000, 3000, 4000 ) ;

Expected result

A1 1000
A2 2000
A3 3000
A4 4000

A1, A2, A3, A4 are hard coded fixed values.

I could have done this but not a good idea in case table TEST_TBL is not a single row table but an inline query on 1,00,00,000 records with summary functions. In my table I've a summary query instead of single row table.

SELECT 'A1', COL1 FROM TEST_TBL
UNION ALL
SELECT 'A2', COL2 FROM TEST_TBL
UNION ALL
SELECT 'A3', COL3 FROM TEST_TBL
UNION ALL
SELECT 'A4', COL4 FROM TEST_TBL

View 12 Replies View Related

Forms :: Tabular Form - Restrict User To Enter Only 10 Rows

Dec 18, 2012

i have master and detail form. In detail(tabular form) i want to restrict user to enter only 10 rows.if he tries to go for 11th row he shud get a message (Only 10 records can be created at a time).

View 3 Replies View Related

PL/SQL :: How To Transpose A Table From Rows To Columns Or Columns Into Rows

Aug 22, 2012

what are the collections available in Oracle Plsql, what are concepts of collection.

How to Transpose a Table from rows to columns or columns into rows.

DDL and DML concepts.

What is the concepts of statistics in Oracle Plsql.

View 4 Replies View Related

Application Express :: Disable Columns Tabular View

Feb 14, 2013

i had an issue last week with enabling and disabling a column in a tabular view. and i have it working now.... when the page loads i disable the column in the 25 rows being displayed.

the problem i now have is when i use the pagination to move through the rows the columns are all now enabled.

so what i am trying to do is this:

i have a tabular view showing 25 rows at a time. there is one column with a code and one with a description. when the code is changed, via a popup LOV, the description is changed based on the valus in a lookup table in the database.

i need the description column disabled, so the user cannot simply just type in the column. but when the page is submitted, the column needs to be enabled so i have modified the sumbit button to respond to a dynamic action which runs some enabling code then submits the page.

SO....
this all seems to be working except for when you use the pagination, the description column is all enabled.

is there a way of running some javascript when the pagination is refreshed? some better way of doing it?

View 3 Replies View Related

Application Express :: Tabular Form - Let End User Hide / Show Columns?

Aug 6, 2012

I have been requested to create a tabular form, but end user should have ability to hide/show columns, also they should rename the column headers. So I have created a table with column name called "attribute1", attribute2", etc. Based on that table, create a tabular form, which has column header as "attrbute1", "attrbute2", etc.

Now end user wants to rename attrbute1 as he wants. And he/she also wants to have a link called "hide/show" next to the column header, so end user can control which column they want to hide/show. It is so easy to do that control from developer side, however, shift that function to end user from front end seems very difficult to me

View 0 Replies View Related

SQL & PL/SQL :: Transpose Rows-to-columns And Columns-to-rows

Oct 6, 2010

I need to transpose the following table columns to rows and rows to columns...Im not quite sure how to acheive this...I have the following table with fixed number of columns and dynamic number of rows based on date filter in query

MONTH_YEAR RMS RMS_OCC TTL_RMS
---------------------------------------
SEPTEMBER 200917790017790
OCTOBER 2009183831278818347
NOVEMBER 2009177901460517762

and I need to display this as

COL1 SEPTEMBER 2009 OCTOBER 2009 NOVEMBER 2009
--------------------------------------------------------------
RMS 17790 18383 17790
RMS_OCC 0 12788 14605
TTL_RMS 17790 18347 17762

View 3 Replies View Related

Application Express :: 4.2 Tabular Form Number Of Rows Bug?

Oct 25, 2012

When I build simple tabular form in APEX 4.2 it displayed 10 rows per page by default. When I changed that number in Number of Rows field to 15 nothing happens. Again only 10 rows per page were displayed. Next field on the right to Number of Rows is Number of Rows (Item). Tabular form works as expected when I use this field and define number of rows with hidden page item. So workaround issue (bug?) is easy. Is this some kind of bug or I miss something obvious?

View 1 Replies View Related

Application Express :: Maximum Rows On Tabular Form?

Sep 27, 2012

I have a tabular form (report) multi-record. It display only the records 1-15 with pagination to the other pages. When I set the field 'Number of Rows' to 100, it still displays record 1-15 only. I just want to see the complete dataset on one page, without pagination. (There is a filter on it so there will never be more than 100 records displayed)

View 4 Replies View Related

Application Express :: Showing New Rows Added To Tabular Form After Submit?

Jan 30, 2013

How i can show the new added rows to tabular form after submit? what I want is to show my customer new added rows that recently added. but according to how I sort the tabular form, the new added rows distributed in multi pagination in tabular form. I'm not good in English, excuse me for my mistakes. I use apex 4.2.0 On Oracle 11g r2 on windows Server 2008

View 2 Replies View Related

Application Express :: How To Create Validation Only For Created Rows In Tabular Form

Sep 19, 2012

Is it possible to create a validation for tabular form which will be fired only for created?

There is a possibility in APEX 4.1 to choose two types of "*Execution scope*" first is "*For created and Modified Rows*" and second is "*All Submitted Rows*".

View 3 Replies View Related

SQL & PL/SQL :: How To Convert Columns Values Into Row In Oracle

Feb 20, 2012

I have a normal table like step 1 and I want to get a output like step 2. get the output from Columns to row in simple sql.

Step 1)

Table Name: Rat_table
------------------------------------------
Column : year and rating_name
year rating_name
------ -----------
2011 'Sucessful'
2010 'Not Rated'

Step 2)

Table Name: Rat_table
------------------------------------------
rating_name 'Sucessful' 'Not Rated'
year 2011 2010

View 14 Replies View Related

SQL & PL/SQL :: Convert Object Return Type Columns

Mar 25, 2010

I have created a object type as

create type emp_obj_dtl as OBJECT (ename varchar2(50),mgr NUMBER)
create type emp_dtl_obj_typ as TABLE of emp_obj_dtl

Using the these object i have created on function as

CREATE OR REPLACE FUNCTION emp_test_func (peno NUMBER)
RETURN emp_dtl_obj_typ
AS
lv_emp_dtl emp_dtl_obj_typ := emp_dtl_obj_typ ();
BEGIN
SELECT emp_dtl_obj_typ(emp_obj_dtl (ename, mgr))
INTO lv_emp_dtl
FROM emp
WHERE empno = peno;

RETURN lv_emp_dtl;
END;

Now if i am executing query as

SELECT empno, emp_test_func (empno) emp_dtls
FROM emp

It is returning me the data as

EMPNO | EMP_DTLS
7500 | (DATASET)
7382 | (DATASET)
7569 | (DATASET)
7800 | (DATASET)

But I want the result set as

EMPNO | ENAME | MGR
7500 | SMITH | 7863
7382 | JAMES | 7896
7569 | KING | 7856
7800 | SANGR | 7456

How to get the resultset as above.

View 4 Replies View Related

SQL & PL/SQL :: Convert Many Rows To One

Sep 17, 2012

I use Oracle 11g and a Middleware which sends the SQL Statements to the database. That's why I can't send you loggings.

However, I' got this SQL:

With CTE
AS
(
select * from
data A2
WHERE
A2.ID ='536031'
AND
A2.AttrID = '6'
)

That code gives me the following result:

ID.........Version....AttrID.......group
536031......3.........6..............test5
536031......3.........6..............test6

What I try to do. I want to get all groups. The Groups should be in one column...the the result must be the following:

ID.........group
536031...test5, test6

In SQL server I always used

SELECT ID,
STUFF((SELECT ',' + [group] FROM CTE WHERE ID = c.ID ORDER BY [Version] FOR XML PATH('')),1,1,'')
FROM (SELECT DISTINCT ID FROM CTE)c

to achieve that. Is there a similar function in oracle like XML PATH? Or another way the get the result?

View 12 Replies View Related

SQL & PL/SQL :: Split Is A Pipe Line Function To Convert Row As Columns

Jan 31, 2013

In this query split is a pipe line function to convert row(rows stored with , delimited) as columns like below

for ex for below query
SELECT * from TABLE(SPLIT('bbb003,bb004'));

out put is
bbb003
bb004

now i have to apply same function on column,column is storing data with ',' separated.and i have tried like but it's throwing missing expression. how i can use this function on entire column from this table.

SELECT * from TABLE(SPLIT(select candidates FROM ibis.cw_uploads_inprogress ));

View 7 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved