Convert rows into a single column
create table suresh
id number,
ch char(1)
insert into suresh values(1,'i');
insert into suresh values(1,'a');
insert into suresh values(1,'m');
insert into suresh values(1,'b');
insert into suresh values(1,'o');
insert into suresh values(1,'y');
select * from suresh
id ch
1 i
1 a
1 m
1 b
1 o
1 y
I am looking for output somethign like this
id ch
1 iamboy
..
Not for that data, no. You have a set of characters with no information about 'order', so they could appear in any order.
If you had some numbering against them, you could pivot the data and concatenate them, but in truth even the concatenation symbol "||" is a built in function, as well as the functions needed to pivot it...
SQL> ed
Wrote file afiedt.buf
1 with t as (select 1 as id, 'i' as ch from dual union all
2 select 2, 'a' from dual union all
3 select 3, 'm' from dual union all
4 select 4, 'b' from dual union all
5 select 5, 'o' from dual union all
6 select 6, 'y' from dual)
7 --
8 select max(decode(id,1,ch))||max(decode(id,2,ch))||max(decode(id,3,ch))||max(decode(id,4,ch))||max(decode(id,5,ch))||max(decode(id,6,ch))
9* from t
SQL> /
MAX(DE
iamboy
SQL>Whatever you do, there's going to be some built in functions somewhere.
Unless.... you do something horrendous like...
SQL> ed
Wrote file afiedt.buf
1 with t as (select 1 as id, 'i' as ch from dual union all
2 select 2, 'a' from dual union all
3 select 3, 'm' from dual union all
4 select 4, 'b' from dual union all
5 select 5, 'o' from dual union all
6 select 6, 'y' from dual)
7 --
8 select (select ch from t where id = 1)||
9 (select ch from t where id = 2)||
10 (select ch from t where id = 3)||
11 (select ch from t where id = 4)||
12 (select ch from t where id = 5)||
13 (select ch from t where id = 6)
14* from dual
SQL> /
(SELEC
iamboy
Similar Messages
-
How To Concatenate Column Values from Multiple Rows into a Single Column?
How do I create a SQL query that will concatenate column values from multiple rows into a single column?
Last First Code
Lesand Danny 1
Lesand Danny 2
Lesand Danny 3
Benedi Eric 7
Benedi Eric 14
Result should look like:
Last First Codes
Lesand Danny 1,2,3
Benedi Eric 7,14
Thanks,
David JohnsonStarting with Oracle 9i
select last, first, substr(max(sys_connect_by_path(code,',')),2) codes
from
(select last, first, code, row_number() over(partition by last, first order by code) rn
from a)
connect by last = prior last and first = prior first and prior rn = rn -1
start with rn = 1
group by last, first
LAST FIRST CODES
Lesand Danny 1,2,3
Benedi Eric 7,14Regards
Dmytro -
Merging 2 rows data into a single column in OBIEE
Hi All,
Requirement is "Merging 2 rows into a single column"
Scenario: data from table called "transactions_table"
Id
transaction no
transaction name -------------------------------quantity
100
1
abc
1000
100
2
def
2000
Required out put:
Id
Transactions & Quantity
100
abc(1000),def(2000)
Please provide me solution, and let me know if any additional information is required.
Thanks in advance to all of you.can you please share your data like below
column1, column2 .....
and where are you trying to do this? at answer or bi admin tool?
there are a few ways to do this. -
Merging 2 rows data into a single column in OBIEE 11g
Hi All,
Requirement is "Merging 2 rows into a single column"
Scenario: data from table called *"transactions_table"*
Id ------------- transaction no ----------------------- transaction name -------------------------------quantity
100 ----------- 1 ----------------------- abc ------------------------------ 1000
100 ----------- 2 ------------------------ def ------------------------------ 2000
Required out put:
Id ----------------- Transactions & Quantity
100 -------------- abc(1000),def(2000)
Please provide me solution, and let me know if any additional information is required.
Thanks in advance to all of you.
Regards,
chrscheck the below link, that may help you.
Re: Horizontal value display
If it is helpful, please mark as correct or helpful -
Converting Rows into Column in Oracle 10g
Hi All,
I m using Oracle Version 10.1.0.2.0 - Production
I have requirement to convert rows into column wise as per the following:
My Query is:
WITH t
AS ( SELECT 'A' AS x, 100 AS y FROM DUAL
UNION ALL
SELECT 'B',200 FROM DUAL
SELECT X, Y
FROM t;
X Y
A 100
B 200
My Requirement is
A B
100 200
So any one could help me that how I resolve this.
Regards,
PrasantaDear frank,
Thanks for your support,.
It's working fine for static cases.If the first column is dynamic then how come i will resolve it.
Example:
Create table mytab (ID_C Varchar2(15),Value_N Number);
Records Population into MyTab table is dynamic.
Insert into mytab values('HO',5000);
Insert Into mytab values('PG1',2400);
Insert Into mytab values('PG2',3000);
Insert Into mytab values('PG3',800);
Commit;
SQL> Select * From MyTab;
IDC_ ValueN_
HO 5000
PG1 2400
PG2 3000
PG3 800
Then My expected result will be as follows
HO PG1 PG2 PG3
5000 2400 3000 800
Thanks and Regards,
Prasanta -
How to convert row into column
Hi All,
My oracle apps version is r12 and db is 10 and i am using Bi publisher version 10g.
Is it possible to convert row into column in Rtf template,
My Query is
SELECT distinct pvs.vendor_site_code,sum(aia.invoice_amount)
FROM ap_invoices_all aia, po_vendors po, po_vendor_sites_all pvs
WHERE aia.org_id = pvs.org_id
AND aia.vendor_id = po.vendor_id
AND aia.vendor_site_id = pvs.vendor_site_id
AND aia.org_id=204
group by pvs.vendor_site_code
And output is like this
Vendor sitecode Invoiceamt
EAM-ERS 79240
STAR GATE - PAY 3245902.31
UPS - HQ 10792040.9
Like this
So in template i need the output like this
Vendor sitecode EAM-ERS STAR GATE - PAY UPS - HQ
Invoiceamt 79240 3245902.31 10792040.9
I tried to achieve the output using sql query but by hardcoding only i have achieved it, so i have tried to convert directly in RTF template.
can any one tell me is it possible.
And if new project is added from the front end ie(now the query will produce 4 rows but now in template i have created only three columns)
Is it possible to add a new column dynamically.
Can any one please guide me and tell me is there any example.
Thanks & regards
SrikkanthTake a look at this post: http://blogs.oracle.com/roller-ui/bsc/spider.jsp?entry=MT%3aENTRY%3a5001
Thanks,
Bipuser -
How to convert rows into columns with decode function
Hi,
How to convert rows into columns with the help of decode function in oracle.
thanks and regards
P Prakashsay
col1 col2
1 10
2 20
3 30
then use
select col1,
sum(decode(col2,10,10)) "new1"
sum(decode(col2,20,20))"new2"
sum(decode(col2,30,30))"new3"
from table_name
group by col1;
we used sum u can use ny function if wont u have to give the column name i.e col2 name also
so i think u got it nw
regards -
CONVERT ROWS INTO COLUMNS IN INTERNAL TABLE
Hi Experts,
I want to convert rows into coloumns in final internal table.
How to do that one. Can any one help me its very urgent.
Regards,
PBS.hi,
Find the below code for changing rows into colums.
data: begin of itab1 occurs 0,
fld,
end of itab1.
data: begin of itab2 occurs 0,
fld1,
fld2,
fld3,
end of itab2.
itab1-fld = 1.
append itab1.
itab1-fld = 2.
append itab1.
itab1-fld = 3.
append itab1.
read table itab1 index 1.
if sy-subrc eq 0.
itab2-fld1 = itab1-fld.
endif.
read table itab1 index 2.
if sy-subrc eq 0.
itab2-fld2 = itab1-fld.
endif.
read table itab1 index 3.
if sy-subrc eq 0.
itab2-fld3 = itab1-fld.
endif.
append itab2.
loop at itab1.
write:/ itab1.
endloop.
loop at itab2.
write:/ itab2.
endloop.
refer the below link for further information
internal table rows to columns
in the final display list how can i change rows to columns and vice versa -
Convert rows into columns nad vice versa in 10g
how to convert rows into columns in 10g??
Qwerty wrote:
see below for rows to column case
SQL> WITH t as
2 (
3 SELECT 'US' test_string FROM DUAL UNION
4 SELECT 'AMERICA' FROM DUAL UNION
5 SELECT'HOLLYWOOD' FROM DUAL UNION
6 SELECT 'WASHINGTON' FROM DUAL
7 )
8 select ltrim (sys_connect_by_path(test_string,','),',') test_string
9 from (
10 SELECT row_number() over(order by test_string) rno, test_string
11 FROM t)
12 WHERE connect_by_isleaf = 1 and rownum=1
13 connect by rno = prior rno+1;
TEST_STRING
AMERICA,HOLLYWOOD,US,WASHINGTONI hope you can do it for column to rows now.That's not really rows to columns. That's rows to a column, which is more commonly called string aggregation.
Rows to columns (or pivot) is more like:
SQL> ed
Wrote file afiedt.buf
1 WITH t as
2 (
3 SELECT 'US' test_string FROM DUAL UNION
4 SELECT 'AMERICA' FROM DUAL UNION
5 SELECT'HOLLYWOOD' FROM DUAL UNION
6 SELECT 'WASHINGTON' FROM DUAL
7 )
8 --
9 select max(decode(rn,1,test_string)) as col_1
10 ,max(decode(rn,2,test_string)) as col_2
11 ,max(decode(rn,3,test_string)) as col_3
12 ,max(decode(rn,4,test_string)) as col_4
13* from (select test_string, row_number() over (order by test_string) as rn from t)
SQL> /
COL_1 COL_2 COL_3 COL_4
AMERICA HOLLYWOOD US WASHINGTON
SQL>And columns to rows (or unpivot) is like:
SQL> ed
Wrote file afiedt.buf
1 WITH t as
2 (
3 SELECT 'US' col_1, 'AMERICA' col_2, 'HOLLYWOOD' col_3, 'WASHINGTON' col_4 FROM DUAL
4 )
5 --
6 select col_1 as col from t union all
7 select col_2 from t union all
8 select col_3 from t union all
9* select col_4 from t
SQL> /
COL
US
AMERICA
HOLLYWOOD
WASHINGTONor...
SQL> ed
Wrote file afiedt.buf
1 WITH t as
2 (
3 SELECT 'US' col_1, 'AMERICA' col_2, 'HOLLYWOOD' col_3, 'WASHINGTON' col_4 FROM DUAL
4 )
5 --
6 select decode(rownum,1,col_1,2,col_2,3,col_3,4,col_4) as col
7* from t, (select * from dual connect by rownum <= 4)
SQL> /
COL
US
AMERICA
HOLLYWOOD
WASHINGTON
SQL> -
How to convert rows into column
Hi,
can any one help me how to convert rows into column by pl/sql procedure.
Thanks and Regardshttp://www.oracle.com/technology/oramag/code/tips2004/050304.html
-- dropping the sample table if exists
drop table rowstocol
-- create sample table
create table rowstocol ( name varchar2(20));
-- Inserting rows into sample table
insert into rowstocol values('Amit Zhankar');
insert into rowstocol values('Piyu Yawalkar');
insert into rowstocol values('Piyu Yawalkar');
insert into rowstocol values('Ashish Ghelani');
insert into rowstocol values('Aditi Zhankar');
insert into rowstocol values('Tom Kyte');
insert into rowstocol values('Oracle');
-- Following query should be run to create a sql. This result sql should be run to convert rows to column.
-- The following query uses just the tablename (whose data is to be converted) and name of the column (which is to be converted).
-- Example taken here is table rowstocol, column name.
SELECT cc
FROM (select decode(rn ,1 ,'Select ',null) ||' MAX (CASE WHEN dr = '|| rownum||' THEN DECODE (rn,1, col1) END) '||
decode(rn,maxr,' col1 from ','||'||chr(39)||','||chr(39)||'|| ') cc,rn,maxr
from (SELECT ROWNUM rn,count(0) over() maxr FROM rowstocol) order by rn) trows
union all
select '(SELECT tabs.col1, DENSE_RANK () OVER (ORDER BY col1,rowid) dr,dense_rank() OVER (order by 1) rn
FROM (SELECT NAME col1 FROM rowstocol) tabs ) group by rn' cc from dual;
-- The result of this query will do the reqd conversion from row to column.
-- Replace table rowstocol by your table, column name by your column.
CC
Select MAX (CASE WHEN dr = 1 THEN DECODE (rn,1, col1) END) ||','||
MAX (CASE WHEN dr = 2 THEN DECODE (rn,1, col1) END) ||','||
MAX (CASE WHEN dr = 3 THEN DECODE (rn,1, col1) END) ||','||
MAX (CASE WHEN dr = 4 THEN DECODE (rn,1, col1) END) ||','||
MAX (CASE WHEN dr = 5 THEN DECODE (rn,1, col1) END) ||','||
MAX (CASE WHEN dr = 6 THEN DECODE (rn,1, col1) END) ||','||
MAX (CASE WHEN dr = 7 THEN DECODE (rn,1, col1) END) ||','||
MAX (CASE WHEN dr = 8 THEN DECODE (rn,1, col1) END) col1 from
(SELECT tabs.col1, DENSE_RANK () OVER (ORDER BY col1,rowid) dr,dense_rank() OVER (order by 1) rn
FROM (SELECT NAME col1 FROM rowstocol) tabs ) group by rn
Select MAX (CASE WHEN dr = 1 THEN DECODE (rn,1, col1) END) ||','||
MAX (CASE WHEN dr = 2 THEN DECODE (rn,1, col1) END) ||','||
MAX (CASE WHEN dr = 3 THEN DECODE (rn,1, col1) END) ||','||
MAX (CASE WHEN dr = 4 THEN DECODE (rn,1, col1) END) ||','||
MAX (CASE WHEN dr = 5 THEN DECODE (rn,1, col1) END) ||','||
MAX (CASE WHEN dr = 6 THEN DECODE (rn,1, col1) END) ||','||
MAX (CASE WHEN dr = 7 THEN DECODE (rn,1, col1) END) ||','||
MAX (CASE WHEN dr = 8 THEN DECODE (rn,1, col1) END) col1 from
(SELECT tabs.col1, DENSE_RANK () OVER (ORDER BY col1,rowid) dr,dense_rank() OVER (order by 1) rn
FROM (SELECT NAME col1 FROM rowstocol) tabs ) group by rn;
COL1
Aditi Zhankar,Amit Zhankar,Ashish Ghelani,Oracle,Oracle,Piyu Yawalkar,Piyu Yawalkar,Tom Kyte
Edited by: bhooma on Jan 20, 2009 2:44 AM -
How to convert rows into columns
Hi,
How to convert rows into columns of two different tables.
These two tables have two common columns namely (shipline,pos).
Let me know if we have any built in functions to do this.
thank you very much .
Edited by: 808542 on Dec 7, 2010 8:35 PM
Edited by: 808542 on Dec 7, 2010 8:37 PMHave you tried this first?
http://forums.oracle.com/forums/search.jspa?threadID=&q=row+to+column&objID=f75&dateRange=last90days&userID=&numResults=15&rankBy=10001 -
Convert row of fields to column of fields?
Hi All,
I have a fairly sizeable SQL query that I've written to return a single row of results.
I.e.
Organisation : RateA: RateB: RateC: RateD: RateE
College X: 0.05: 0.15: 0.14: 0.11: 0.02
(note, the ":" indicates separate fields)
Is there a simple way of 'pivoting' this data into a single column? I need to convert it to a column so I can put the results into a chart in MS SSRS. I'm trying to avoid a union query because of the size of the original query which uses several sub queries. I've read about several solutions - xmlagg, listagg, cross join, but I'm not sure how to apply them? I'm not sure if these can be used though as we're on Ora 9x.
Sorry for the vagueness of this. Any help appreciated. :) :) :)Hi,
user9363122 wrote:
... As I'm looking to include this in SSRS 2005, can I use WITH, LEVEL and CONNECT BY in the SSRS SQL text editor?Sorry, I don't know anything about SSRS. Try it and see.
If WITH doesn't work, use an in-line view for cntr.
If LEVEL and CONNECT BY don't work, then don't generate a counter table at all; use any existing real table (or view) that you know will have at least as many rows as you need. Fpr example:
SELECT CASE ROWNUM
WHEN 1 THEN TO_CHAR (d.deptno)
WHEN 2 THEN d.dname
WHEN 3 THEN d.loc
END AS single_column
FROM scott.dept d
CROSS JOIN all_objects c
WHERE deptno = 10
AND ROWNUM <= 3
ORDER BY ROWNUM
;I've never seen an all_objects view with less than 5000 rows.
Generating the numbers using CONNECT BY is actually more efficient, but you'd probably have to generate thousands of numbers before you noticed a difference. -
Merging two rows into a single row
Hi ,
I wish to merge few columns of tow rows into a single row.
if i use union it gives two rows as o/p.
What is the exact sql statement for that?
ThanksHi Sridhar,
This is my code for merging and i used union.
Suggest me good solution.
CREATE OR REPLACE VIEW INSPECTINT.INSPECT_LOC_TRACKING_RPT_VIEW AS
SELECT
VEN_COMPANY_NAME VEN_COMPANY_NAME,
VEN_COMPANY_NAME_2 VEN_COMPANY_NAME_2,
VEN_CONTACT_FIRST_NAME VEN_CONTACT_FIRST_NAME,
VEN_CONTACT_MIDDLE_NAME VEN_CONTACT_MIDDLE_NAME,
VEN_CONTACT_LAST_NAME VEN_CONTACT_LAST_NAME,
VEN_ADDRESS_LINE_1 VEN_ADDRESS_LINE_1,
VEN_ADDRESS_LINE_2 VEN_ADDRESS_LINE_2,
VEN_CITY VEN_CITY,
VEN_CNT_COUNTY_CODE VEN_CNT_COUNTY_CODE,
VEN_STC_STATE_CODE VEN_STC_STATE_CODE,
VEN_ZIP_CODE VEN_ZIP_CODE,
VEN_PHONE_NO_1 VEN_PHONE_NO_1,
VEN_PHONE_EXTN_1 VEN_PHONE_EXTN_1,
VEN_PHONE_NO_2 VEN_PHONE_NO_2,
VEN_PHONE_EXTN_2 VEN_PHONE_EXTN_2,
VEN_FAX_NO_1 VEN_FAX_NO_1,
VEN_VENDOR_NO VEN_VENDOR_NO,
VEN_APV_AP_VENDOR_ID VEN_APV_AP_VENDOR_ID,
VEN_EMAIL_ADDRESS VEN_EMAIL_ADDRESS,
--all these should be null
to_number(NULL) PHY_LCN_PARAMETER_ID,
to_char(NULL) PHY_LCN_CURRENT_ADDRESS_IND,
to_char(NULL) PHY_LCN_STATUS_CODE,
to_char(NULL) PHY_LCN_LTY_LOCATION_TYPE,
to_char(NULL) PHY_LCN_ADT_ADDRESS_TYPE,
to_char(NULL) PHY_LCN_HOUSE_NO,
to_char(NULL) PHY_LCN_ADDRESS_LINE_1,
to_char(NULL) PHY_LCN_ADDRESS_LINE_2,
to_char(NULL) PHY_LCN_CITY,
to_char(NULL) PHY_LCN_STC_STATE_CODE,
to_char(NULL) PHY_LCN_ZIP_CODE,
to_char(NULL) PHY_LCN_CNT_COUNTY_CODE,
to_date(NULL) PHY_END_DATE,
to_number(NULL) PHY_LCN_VEN_VENDOR_ID_GTA,
to_char(NULL) PHY_LCN_SUB_LOCATION_GTA,
to_char(NULL) PHY_LCN_DIRECTION_GTA,
---all these should be null
to_char(NULL) LOW_LCN_PARAMETER_ID,
to_char(NULL) LOW_LCN_CURRENT_ADDRESS_IND,
to_char(NULL) LOW_LCN_STATUS_CODE,
to_char(NULL) LOW_LCN_LTY_LOCATION_TYPE,
to_char(NULL) LOW_LCN_ADT_ADDRESS_TYPE,
to_char(NULL) LOW_LCN_HOUSE_NO,
to_char(NULL) LOW_LCN_ADDRESS_LINE_1,
to_char(NULL) LOW_LCN_ADDRESS_LINE_2,
to_char(NULL) LOW_LCN_CITY,
to_char(NULL) LOW_LCN_STC_STATE_CODE,
to_char(NULL) LOW_LCN_ZIP_CODE,
to_char(NULL) LOW_LCN_CNT_COUNTY_CODE,
to_char(NULL) LOW_LCN_LANDLORD,
to_number(NULL) LOW_LCN_LANDLORD_PHONE,
to_date(NULL) LOW_END_DATE,
to_char(NULL) LOW_LCN_SUB_LOCATION_GTA,
to_char(NULL) LOW_LCN_DIRECTION_GTA
FROM LOCATIONS LOC , VENDORS VEN
WHERE LOC.LCN_VEN_VENDOR_ID_GTA IS NOT NULL
AND LOC.LCN_VEN_VENDOR_ID_GTA = VEN_VENDOR_ID
AND LOC.LCN_LTY_LOCATION_TYPE ='AS'
UNION ALL
SELECT
to_char(NULL) VEN_COMPANY_NAME,
to_char(NULL) VEN_COMPANY_NAME_2,
to_char(NULL) VEN_CONTACT_FIRST_NAME,
to_char(NULL) VEN_CONTACT_MIDDLE_NAME,
to_char(NULL) VEN_CONTACT_LAST_NAME,
to_char(NULL) VEN_ADDRESS_LINE_1,
to_char(NULL) VEN_ADDRESS_LINE_2,
to_char(NULL) VEN_CITY,
to_char(NULL) VEN_CNT_COUNTY_CODE,
to_char(NULL) VEN_STC_STATE_CODE,
to_char(NULL) VEN_ZIP_CODE,
to_number(NULL) VEN_PHONE_NO_1,
to_number(NULL) VEN_PHONE_EXTN_1,
to_number(NULL) VEN_PHONE_NO_2,
to_number(NULL) VEN_PHONE_EXTN_2,
to_number(NULL) VEN_FAX_NO_1,
to_char(NULL) VEN_VENDOR_NO,
to_char(NULL) VEN_APV_AP_VENDOR_ID,
to_char(NULL) VEN_EMAIL_ADDRESS,
decode(lcn_adt_address_type,'P',to_number(LCN_PARAMETER_ID),to_number(NULL)) PHY_LCN_PARAMETER_ID,
decode(lcn_adt_address_type,'P',LCN_CURRENT_ADDRESS_IND,to_char(NULL)) PHY_LCN_CURRENT_ADDRESS_IND,
decode(lcn_adt_address_type,'P',LCN_STATUS_CODE,to_char(NULL)) PHY_LCN_STATUS_CODE,
decode(lcn_adt_address_type,'P',LCN_STATUS_CODE,to_char(NULL)) PHY_LCN_LTY_LOCATION_TYPE,
decode(lcn_adt_address_type,'P',LCN_ADT_ADDRESS_TYPE,to_char(NULL)) PHY_LCN_ADT_ADDRESS_TYPE,
decode(lcn_adt_address_type,'P',LCN_HOUSE_NO,to_char(NULL)) PHY_LCN_HOUSE_NO,
decode(lcn_adt_address_type,'P',LCN_ADDRESS_LINE_1,to_char(NULL)) PHY_LCN_ADDRESS_LINE_1,
decode(lcn_adt_address_type,'P',LCN_ADDRESS_LINE_2,to_char(NULL)) PHY_LCN_ADDRESS_LINE_2,
decode(lcn_adt_address_type,'P',LCN_CITY,to_char(NULL)) PHY_LCN_CITY,
decode(lcn_adt_address_type,'P',LCN_STC_STATE_CODE,to_char(NULL)) PHY_LCN_STC_STATE_CODE,
decode(lcn_adt_address_type,'P',LCN_ZIP_CODE,to_char(NULL)) PHY_LCN_ZIP_CODE,
decode(lcn_adt_address_type,'P',LCN_CNT_COUNTY_CODE,to_char(NULL)) PHY_LCN_CNT_COUNTY_CODE,
decode(lcn_adt_address_type,'P',END_DATE,to_char(NULL)) PHY_END_DATE,
decode(lcn_adt_address_type,'P',LCN_VEN_VENDOR_ID_GTA,to_char(NULL)) PHY_LCN_VEN_VENDOR_ID_GTA,
decode(lcn_adt_address_type,'P',LCN_SUB_LOCATION_GTA,to_char(NULL)) PHY_LCN_SUB_LOCATION_GTA,
decode(lcn_adt_address_type,'P',LCN_DIRECTION_GTA,to_char(NULL)) PHY_LCN_DIRECTION_GTA,
decode(LCN_ADT_ADDRESS_TYPE,'D',LCN_PARAMETER_ID,to_char(NULL)) LOW_LCN_PARAMETER_ID,
decode(LCN_ADT_ADDRESS_TYPE,'D',LCN_CURRENT_ADDRESS_IND,to_char(NULL)) LOW_LCN_CURRENT_ADDRESS_IND,
decode(LCN_ADT_ADDRESS_TYPE,'D',LCN_STATUS_CODE,to_char(NULL)) LOW_LCN_STATUS_CODE,
decode(LCN_ADT_ADDRESS_TYPE,'D',LCN_LTY_LOCATION_TYPE,to_char(NULL)) LOW_LCN_LTY_LOCATION_TYPE,
decode(LCN_ADT_ADDRESS_TYPE,'D',LCN_ADT_ADDRESS_TYPE,to_char(NULL)) LOW_LCN_ADT_ADDRESS_TYPE,
decode(LCN_ADT_ADDRESS_TYPE,'D',LCN_HOUSE_NO,to_char(NULL)) LOW_LCN_HOUSE_NO,
decode(LCN_ADT_ADDRESS_TYPE,'D',LCN_ADDRESS_LINE_1,to_char(NULL)) LOW_LCN_ADDRESS_LINE_1,
decode(LCN_ADT_ADDRESS_TYPE,'D',LCN_ADDRESS_LINE_2,to_char(NULL)) LOW_LCN_ADDRESS_LINE_2,
decode(LCN_ADT_ADDRESS_TYPE,'D',LCN_CITY,to_char(NULL)) LOW_LCN_CITY,
decode(LCN_ADT_ADDRESS_TYPE,'D',LCN_STC_STATE_CODE,to_char(NULL)) LOW_LCN_STC_STATE_CODE,
decode(LCN_ADT_ADDRESS_TYPE,'D',LCN_ZIP_CODE,to_char(NULL)) LOW_LCN_ZIP_CODE,
decode(LCN_ADT_ADDRESS_TYPE,'D',LCN_CNT_COUNTY_CODE,to_char(NULL)) LOW_LCN_CNT_COUNTY_CODE,
decode(LCN_ADT_ADDRESS_TYPE,'D',LCN_LANDLORD,to_char(NULL)) LOW_LCN_LANDLORD,
decode(LCN_ADT_ADDRESS_TYPE,'D',LCN_LANDLORD_PHONE,to_char(NULL)) LOW_LCN_LANDLORD_PHONE,
decode(LCN_ADT_ADDRESS_TYPE,'D',END_DATE,to_char(NULL)) LOW_END_DATE,
decode(LCN_ADT_ADDRESS_TYPE,'D',LCN_SUB_LOCATION_GTA,to_char(NULL)) LOW_LCN_SUB_LOCATION_GTA,
decode(LCN_ADT_ADDRESS_TYPE,'D',LCN_DIRECTION_GTA,to_char(NULL)) LOW_LCN_DIRECTION_GTA
FROM LOCATIONS LOC
WHERE (LCN_LTY_LOCATION_TYPE ='AS' OR LCN_ADT_ADDRESS_TYPE='D')
AND LCN_CURRENT_ADDRESS_IND ='Y'
thanks -
SQL*Loader - How to combine Flat File 3 columns and put into one single column
Receive a flat file delimited by comma. Want to combine Flat File last 3 columns and put into one single column(Table).
e.g.
Flat File
100,239,30,20,30
While inserting into table want to combine last 3 columns and insert into invoice number column.
302030It is not possible to combine the last 3 columns as those columns are seperated by commas and in the SQL Loader control file you must ve specified COMMA as an delimiter. So u better have all the columns in the table plus add one more column which holds the concatenation of the 3 columns.
Vijay -
How to concatenate two colums into one single column
I need some ideas to concatenate two different columns into one single column using a set of distinct values.
For Example,
Customer Product Number
xyz A 1
xyz B 2
xyz B 1
AAA C 7
AAA A 1
The result should look like this,
Customer Value
xyz A1 B2 B1
AAA C7 A1
How would I group this into once value ?
Thanks in advance ...Tom's discussion of writing your own aggregate routines
http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:2196162600402
starts off with a link to the 8i alternatives
"see
http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:229614022562
for 8i methods (not aggregates)"
Unforutnately, it's a lot more work in 8i.
Justin
Maybe you are looking for
-
Problem: Creating Charts in RTF Templates
I am using BI Publisher Template Builder for Word. I am using Word 2007 and the patch 9821068 of the Template Builder. I am attempting to create a chart in an rtf template using the chart wizard. I can go through the wizard fine and preview my chart
-
Oracle-xe-universal / debian lenny / ORA-12514
Hi, I have the following situation here: listener.ora: SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (SID_NAME = PLSExtProc) (ORACLE_HOME = /usr/lib/oracle/xe/app/oracle/product/10.2.0/server) (PROGRAM = extproc) LISTENER = (DESCRIPTION_LIST = (DESCRIP
-
How to get data from rich:dataGrid variable to backing bean
Hi, I have a problem in the following code. I have a dataGrid and I display data in the data grid by calling an array (bean.list). The array is displayed as pictures in JSF and the user clicks on one of those images. (more like a shopping card) My qu
-
No columns in default template
I just installed Pages '09 on a new system, and somehow the default template blank doesn't have any columns and won't allow me to create one. It's blanked out. So the only way I can actually type is by making a text box. Anyone have this problem? Sol
-
Adobe flash player stopped working properly
I just purchased a new laptop with windows 7, 9 days ago, and I keep getting a notice that adobe flash player has stopped working properly. My laptop has windows 7 and I use ie8 and of course is a 64bit. I play Farmville alot and have had constant n