Merging different values into one column
Hi all,
If my report has two columns A and B. For one value of A, there are multiple values coming from database for B.
So, report displays them like this:
A B
1 x
1 y
1 z
Is it possible somehow that i can merge all possible values of B in one row instead of many. i.e. report should look like this:
A B
1 x,y,z
Please reply with your suggestions.
Hi,
It is possible that can merge all B column values in one row.
Steps:-
1. First you create an object for B using @aggregate_Aware() function like
@Aggregate_Aware(TableName.B,TableName.B)+', '
Object qualification should be measure. Here B is the column name.
2. In WebI report drag and drop A and B objects
3. Run the report
Now you will get the result.
Edited by: Swarna K on Mar 11, 2011 5:27 AM
Edited by: Swarna K on Mar 11, 2011 7:20 AM
Similar Messages
-
Sql loader - mutiple values into one column
Hi,
Is it possible to load multiple fields into one column. Eg, my table structure has two columns COL1, COL2 and my data file is comma delimted with 3 fields A,B,C.
How could i use sql loader to achieve (without the use of temp tables)
COL1 = A
COL2 = BC
ThanksI don't understand why you can't modify the input fille.
But anyway, i have 2 ways to help you
1. Make new inputfile online using pipe and awk(or something your are familiar with) and use it as new input file.
This is a traditional and powerful method in Unix environment.
For instance:
oracle> $ mknod pipe.dat p
oracle> cat input.dat | awk '{print ...}' > pipe.dat &
oracle> sqlldr ctl=.. data=pipe.dat
Using this method, you don't need to modify original input file physically, but by some magical trick you can modify it on the fly.
2. Use before trigger
For instance:
create table load(a int, b int, c int, d int);
create or replace trigger load_trigger
before insert on load
for each row
begin
:new.d := :new.b + :new.c;
:new.b := null;
:new.c := null;
end;
load data
infile *
append
into table load
fields terminated by "," optionally enclosed by '"'
(a, b, c)
begindata
1, 1, 1
2, 2, 2
3, 3, 3
4, 4, 4
sqlldr userid=... ctl=load.ctl
SQL> select * from load;
A B C D
1 2
2 4
3 6
4 8
You won't like the existence of unnecessary columns(B, C) but don't have choice. ^^;
I think there is another simple way provided by SQL*Loader. But i've never tried it myself. Read following doc and try it yourself:
http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96652/ch06.htm#1008153 -
Merge two resultsets into one column
Hi Guys,
I have two SQL statements. The first returns 12 columns and the second returns 2 columns but both return the same number of rows. I can't seem to merge both the queries into a common query as the WHERE clauses in both are different. I have to dump the output into a table i created. The table has 14 columns. One column in both queries act as primary key and they help form the relationship between the resultsets. The column name is SUBSCR_CODE. Below you will find my SQL queries and the CREATE TABLE statement. Please could someone tell me how to achieve this.
SELECT o.subscr_code,
SUM(NVL(m.remain_capital,0)),
SUM(NVL(m.remain_interest,0)),
SUM(NVL(m.remain_debtor_fee,0)),
SUM(NVL(s.remain_debtor_fee,0)),
SUM(NVL(m.remain_costs_to_client,0)),
SUM(NVL(m.remain_debtor_outlay,0)),
SUM(NVL(s.remain_debtor_outlay,0)),
SUM(NVL(m.debtor_exp_outlay,0)),
SUM(NVL(s.debtor_exp_outlay,0)),
SUM(NVL(m.vatbase_debtor_fee,0)),
SUM(NVL(s.vatbase_debtor_fee,0)),
NULL
FROM kkrpt1 o,
maincase m,
subcase s
WHERE o.maincase_id = m.maincase_id
AND m.maincase_id = s.mc_maincase_id
AND s.claim_type IN (6,7,8,9,10,11,13)
AND s.subcase_no = 0
AND m.closing_date IS NULL
AND s.closing_date IS NULL
GROUP BY subscr_code;
SELECT o.subscr_code,
SUM(NVL(a.remain_interest,0))
FROM kkrpt1 o,
amount a,
maincase m,
subcase s
WHERE o.maincase_id = a.mc_maincase_id
AND o.maincase_id = m.maincase_id
AND m.maincase_id = s.mc_maincase_id
AND s.claim_type IN (6,7,8,9,
10,11,13)
AND s.subcase_no = 0
AND m.closing_date IS NULL
AND s.closing_date IS NULL
AND a.amount_type = 41
GROUP BY subscr_code;
CREATE TABLE kk_ajot_14 (
subscr_code VARCHAR2(5),
remain_capital_sum NUMBER,
remain_inerest_sum_1 NUMBER,
remain_debtor_fee_sum_1 NUMBER,
remain_debtor_fee_sum_2 NUMBER,
remain_costs_to_client NUMBER,
remain_debtor_outlay_1 NUMBER,
remain_debtor_outlay_2 NUMBER,
remain_debtor_exp_outlay_1 NUMBER,
remain_debtor_exp_outlay_2 NUMBER,
vatbase_debtor_fee_1 NUMBER,
vatbase_debtor_fee_2 NUMBER,
remain_inerest_sum_2 NUMBER);No need to create table
with
sql_1 as
(<first sql here>
sql_2
(<second sql here>
select a.*,b.*
from sql_1 a,sql_2 b
where a.subscr_code = b.subscr_codeRegards
Etbin -
Combine 2 specific column values into one column
Is there an easy solution to combine column values that is in a group?
In my report I have 1 column group named Activity_Area which has 5 different values Activity 1, Activity2...Activity5.
Let's say I want to merge Activity 4 and Activity 5 and call it ActivityX and gives me the output as below
Activity 1 | Activity 2 | Activity 3 | ActivityXHi Jhonny86,
According to your description, you create a field in database and it contains five values. Then you want to only display four values in report column group, and the last two values should be replaced by “ActivityX”, right?
In your scenario, you can create an table like below:
create table Act(id int,activity varchar(99))
insert into Act select 1,'Activity 1'
insert into Act select 2,'Activity 2'
insert into Act select 3,'Activity 3'
insert into Act select 4,'Activity 4'
insert into Act select 5,'Activity 5'
Then query the table with code like below in query designer, then add the field [Act] into the column group.
If you have any question, please feel free to ask.
Best regards,
Qiuyun Yu
Qiuyun Yu
TechNet Community Support -
How to insert parameter value into multiple columns and rows
Hi All,
I have one procedure insert_tab and I am passing
100~101~102:103~104~105:106~107~108 as a parameter to that procedure. I wanted to insert each numeric value into one column. The output of the table should contain
Table:
Col1 Col2 Col3
100 101 102
103 104 105
106 107 108
Awaiting for your reply..That's not more clear for me...
Anyway, if you really want a procedure for that, try :
SQL> create table tblstr (col1 number,col2 number,col3 number);
Table created.
SQL>
SQL> create or replace procedure insert_fct (p_string IN varchar2)
2 as
3 v_string varchar2(4000):=p_string||':';
4 v_substring varchar2(4000);
5
6 begin
7 while instr(v_string,':') > 0 loop
8 v_substring := substr(v_string,1,instr(v_string,':')-1)||'~';
9 insert into tblstr(col1,col2,col3)
10 values (substr(v_substring,1,instr(v_substring,'~',1,1)-1),
11 substr(v_substring,instr(v_substring,'~',1,1)+1,instr(v_substring,'~',1,2)-instr(v_substring,'~',1,1)-1),
12 substr(v_substring,instr(v_substring,'~',1,2)+1,instr(v_substring,'~',1,3)-instr(v_substring,'~',1,2)-1));
13 v_string:=substr(v_string,instr(v_string,':')+1);
14 end loop;
15 end;
16 /
Procedure created.
SQL>
SQL> show err
No errors.
SQL>
SQL> select * from tblstr;
no rows selected
SQL> exec insert_fct('100~101~102:103~104~105:106~107~108')
PL/SQL procedure successfully completed.
SQL> select * from tblstr;
COL1 COL2 COL3
100 101 102
103 104 105
106 107 108
SQL> exec insert_fct('109~~')
PL/SQL procedure successfully completed.
SQL> exec insert_fct('~110~')
PL/SQL procedure successfully completed.
SQL> exec insert_fct('~~111')
PL/SQL procedure successfully completed.
SQL> select * from tblstr;
COL1 COL2 COL3
100 101 102
103 104 105
106 107 108
109
110
111
6 rows selected.
SQL> Nicolas. -
Multiple value in one column issue
Dear proffessionals,
i'm trying to put more than one value in one column, so i have next problem:
1. Query select cr_pjid from acc_users where username='ACCBTPS121' give result
CR_PJID
'26','63'2. Query select * from acc_accbtp_nova_view where ed_id=2 and to_char(pj_id) in ('26','63'); return 186 rows.
3. Query: select * from acc_accbtp_nova_view where ed_id=2 and
to_char(pj_id) in (select cr_pjid
from acc_users
where username='ACCBTPS121'); doesn't return any row... :(
Could anyone help me ?
Thx in advance,
AdnanAfter researching, I think that the best idea is to create another table with multiple rows and different values for one column...
[http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:210612357425|http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:210612357425] -
Data in two different coulmns merge into one column
I am using following script to create external table with data.
CREATE TABLE external_class(
item_no varchar2(255),
max_range varchar2(255)
ORGANIZATION EXTERNAL
TYPE ORACLE_LOADER
DEFAULT DIRECTORY DATALOAD
ACCESS PARAMETERS
RECORDS DELIMITED BY NEWLINE
FIELDS TERMINATED BY ','
MISSING FIELD VALUES ARE NULL
(item_no,max_range)
LOCATION ('class_newc.txt')
REJECT LIMIT UNLIMITED;
Problem is that its merge both columns into one column.
I want two seperate columns.
Data is in microsoft excel spread sheet.
I saved as txt(TAB DELIMITED) txt
Data appears in clas.txt file as below:
"400 " 4177.64
"404 " 5574.64
"406 " 5333
"408 "
"409 "
"450 " 10.83
"478 "
"482 " 4820
I ran the above script to create table.
Table Created
SQL> desc external_class;
Name Null? Type
ITEM_NO VARCHAR2(255)
MAX_RANGE VARCHAR2(255)
SQL> select count(*) from external_class;
COUNT(*)
3036
but with
select * from external_class;
ITEM_NO MAX_RANGE
"400"4177.64
"404"5574.64
"406"5333
"408"
"409"
"450"10.83
"478"
"482"4820thanks its work.
Actually I created other file as below
Item_no-----max_range
400 4177.64
404 5574.64
406 5333
408
409
450 10.83
and use creation script as below:
CREATE TABLE external_class(
item_no varchar2(255),
max_range varchar2(255)
ORGANIZATION EXTERNAL
TYPE ORACLE_LOADER
DEFAULT DIRECTORY DATALOAD
ACCESS PARAMETERS
RECORDS DELIMITED BY NEWLINE
fields terminated by whitespace
MISSING FIELD VALUES ARE NULL
(item_no,max_range)
LOCATION ('class_newa.txt')
REJECT LIMIT UNLIMITED; -
How to copy one column BLOB value into another column of another database.
How to copy one column BLOB value into another column of another database.
BLOB value contains word document.
I thought of copy the BLOB value into a text file and then update the new column value by the same text in textfile. Will this work?
Is there any other better way to do this?You're welcome
BLOB fields contains binary data. I don't think you can do this
Also if I view the BLOB as text. Can I copy it and insert into the new database.
I think your options are as I said. Datapump or CTAS
Best Regards -
Problem in Showing multiple values into one text box.
Hi all,
How can show i multiple row values into one text box. here text box is multi line type.
i have one table it has content column, it has number of rows. i need to show those data into one text box in form. how can i solve it?
my sample code here,
egin
--:block3.txt_to := :parameter.p_current_user||''||':'||:block3.txt_From;
-- go_item('txt_from');
insert into chat(fromid,toid,content)values(:block3.fromid,:block3.toid,:block3.txt_From);
:block3.txt_From:= null;
commit;
:block3.txt_to := :parameter.p_current_user||''||':'||:block3.txt_From;
go_item('txt_from');
declare
cursor c4 is select content from chat where toid = :block3.fromid;
rec1 c4%rowtype;
begin
open c4;
loop
fetch c4 into rec1;
exit when c4%notfound;
null;
end loop;
end;
--select content into :block3.txt_to from chat where toid= :block3.fromid;
end;
please give me some tips to solve it.
thanks
gurusHi,
Try giving CHR(10) for line feed.
DECLARE
CURSOR C4 IS SELECT CONTENT FROM CHAT WHERE TOID = :BLOCK3.FROMID;
Str_Temp VARCHAR2(20);
BEGIN
:BLOCK3.TXT_TO := '';
OPEN C4;
LOOP
FETCH C4 INTO Str_Temp;
EXIT WHEN C4%NOTFOUND;
:BLOCK3.TXT_TO := :BLOCK3.TXT_TO || CHR(10) || Str_Temp;
END LOOP;
CLOSE C4;
END;Regards,
Manu.
If this answer is helpful or correct, please mark it. Thanks. -
Merging Multiple Artists Into One Album
Ok so I donwloaded a CD called Buzz Cuts with alot of great artisits. Now my problem is there are 30 songs and Itunes is showing 30 different albums even though they are all from the same CD. Its messing up because of all the different artists. How can I merge them all into one album called Buzz Cuts. Or is there a way to sort them. Its a pain having 30 extra cds at the top screen. Please help.
All of this can be adjusted by simply right clicking a song and selecting "Get info." Under the info tab, you can customize things like crazy. For instance, you can insert into the "album" field the title of the compilation.
-
How to integrate existing value into one in hierarchy char.
I have a char. hierarchy call ZCOMP_CODE. ZLEADER is compounding with ZCOUNTRY.
The master data in ZCOMP_CODE looks like
ZLEADER;ZCOMP_CODE;
010;1000;
010;1001;
010;1002;
020;1000;
021;1000;
In query I have char. ZCOMP_CODE in row and one KF ZREVENUE in column. Previously we calculated ZLEADER 010,020,021 separately. But, now I want to calculated ZLEADER 020 and 021 together. Does anyone know how to integrate two existing value into one and display it in query? Do I need to create a new hierarchy node for including 020,021?
Thanks!
rajatina.don't know how you can achieve this in the query...
but in the workbench there's a solution. Just add a routine in the transformation to change 021 to 020.
if you need to have still the 021 info somewhere, create a ZCOMPANY_CODE2 where you store only the values needed (010, 020)... use this company code as hierarchy in the report, and use the other company code for displaying the 021...
hope it's clear,
M. -
Inserting multiple selection from checkbox into one column of the database
Hi,
How to insert multiple selection values from checkbox into one column of the database.
Anyone can u help me
Thanxhi
try to use request.getParameterValues("fieldname") -
Can we concatenate 2 columns of datafile into one column in sql loader
Hi,
Can we concatenate 2 columns of datafile into one column in sql loader?
like
Suppose there are two field in data file
column1 - lastname value tiger
column2 - firstname value scott
Required result
sould be concatenate of the two field into one database coulmn
like name and value should be scott tiger.
ThanksOr try this...
My input file
1,KARTHICK,PATTABIRAMAN,SOFTWARE
2,VIJAY,RENGANATHAN,FINANCE
3,VIMAL,KANTH,SALESAnd my control file.
LOAD DATA
INFILE 'EmpDetail.txt'
BADFILE 'EmpDetail.bad'
DISCARDFILE 'EmpDetail.dsc'
INTO TABLE "EMPDETAIL"
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' TRAILING NULLCOLS
(NO,
NAME1 BOUNDFILLER,
NAME ":NAME1||' '||:NAME",
DEPT) My table is.
SQL> create table empdetail(no integer, name varchar2(50), dept varchar2(50))
2 /
Table created.Then i loaded the data.
D:\karthick\Akiva\Look up\Akiva\Address Look Up>sqlldr sysadm/sysadm@akivanew empdetail.ctl
SQL*Loader: Release 9.2.0.1.0 - Production on Mon Sep 15 12:23:42 2008
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Commit point reached - logical record count 2
Commit point reached - logical record count 3And the output is
SQL> select * from empdetail
2 /
NO NAME DEPT
1 KARTHICK PATTABIRAMAN SOFTWARE
2 VIJAY RENGANATHAN FINANCE
3 VIMAL KANTH SALESThanks,
Karthick. -
Is it possible to merge two cubes into one , if so how ??
Hi
Can u please check how we merge two cubes with 1st with 8 dimension ,
and in other 7 dimensions, both has the same dimension.
but in these cube when they r doing the demand planning, they r doing on different levels.
We have one option of merging the cubes but planning across the two cubes
or
same cube with alternate hierarchy.
what all things i have take in to consider while doing this.
Please reply -
Currency & Amount Concatenated into One Column after SPS Upgrade
Hi BI Community
We have recently upgraded to SPS17 (BW SP19) for our production system and we have one issue where the currency and amount are concatenated into one column (Annual Salary). Previously the currency and amount are displayed in separate columns. An example below.
Before SPS Upgrade
Annual Salary
100000
723200
20122
After SPS Upgrade
Annual Salary
USD 100000
723200 TWD
20122 CNYHi Karthik,
Its working fine but if duplicate values found in column which we want to concat it should take its occurrence only once
for eg:
ID COMPLETED_BY RISK_EVALUATION
532 [email protected] Low/Low/Medium/High/Medium/Medium/High/Medium/High/High/Medium/Low/Medium
this should be like below
ID COMPLETED_BY RISK_EVALUATION
532 [email protected] Low/Medium/High
Thanks in advance
Maybe you are looking for
-
Importing text file (delimited, fixed width) with MDM Import Manager?
Hello all, According to the overview section of the import manager reference guide, it is possible to import from delimited text files (e.g. CSV). But when it comes to the details, text files are not mentioned anymore. I also found no option in the I
-
HT3702 how do i change the credit card on my apple account
hi I want to change my credit card but I cant cuz Im in thailand and I can not use thai card and i can not update any app right now Could u pls tell me how can I do that Thank
-
Photoshop CS6 upgrade from CS4 continually asks for serial number.
I purchased an upgrade from Photoshop CS 4 to Photoshop CS 6 directly from Adobe in December of 2012. (My version of CS4 was originally purchased by me as part of a CS4 Web Premium Suite.) My CS4 version has worked since 2009 with no licensing issues
-
Do not display down payment request on PO history (ME23N)
Dear All , I have created a down payment request linked to a PO . But , the down payment request does not display on PO history via ME23N . Is there any way to displat the down payment request on PO history ? Thanks, Best Regards Dash
-
Need comprehensive and step by step notes for PLD & QLD.
Dear Experts, As I have to design plenty of reports in my SAP B1, I need to study PLD & QLD from the scratch. Can you please suggest me where can I get detailed information on them? Thanks in adv. Regards Anand