Concatenate multiple lines into 1
I am trying to pull a list of journal entries that meet a certain criteria. What I would like to know is if I can take that list of multiple lines and combine them into one? This way I can use the results and run another report with those parameters. I don't know of any other way to pull in all the lines in a journal entry with certain GL accounts. I know I can do this if I export a query as an .iqy file and run it in excel, but nobody in my company knows, or wants to know, how to do this other than me. Or if you know of a better way, I would surely appreciate it.
Thanks.
Oracle BI Discoverer 11g (11.1.1.6.0)
Oracle Business Intelligence Discoverer Plus 11g (11.1.1.6.0)
Discoverer Model - 11.1.1.6.0
Discoverer Server - 11.1.1.6.0
End User Layer - 5.1.1.0.0.0
End User Layer Library - 11.1.1.6.0
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
Copyright © 1999, 2009, Oracle. All rights reserved.
Post Author: Charliy
CA Forum: General
Take the initialize formula out of the Group Header.
Place it an the Report Header, and create a second (print suppressed) Group Footer and place it there
Similar Messages
-
Concatenate multiple lines into one
Post Author: [email protected]
CA Forum: General
Hi,I'm trying to pull data out of one table that could have multiple lines (indicated by a line count field for each row). The user wants to see all lines in one field only. I tried the following but am running into issues if there's only one row (one line count). With this, the single row is concatenated with itself. //@groupheader-initilizewhileprintingrecords;stringvar x:=""//@detailwhileprintingrecords;stringvar x:=x+ //@groupfooterwhileprintingrecords;stringvar x Any ideas appreciated. Thanks!Post Author: Charliy
CA Forum: General
Take the initialize formula out of the Group Header.
Place it an the Report Header, and create a second (print suppressed) Group Footer and place it there -
Concatenate multiple records into one single record
Hello everyone,
Can anyone guide me how to merge multiple records into one single record
like......... I am getting the data in the file like
aaaaa/bbbbbbb/ccccccccccc/dddddddddddd/eee
ffffff/gggg/hhhhhhhhhhhhhh
/123/4567/55555/99999999/kaoabfa/eee
fffff/kkkkkkkk/llllllllllllllllllllllll
when i use gui_upload I am getting the data into the internal table in the above format.
My main intension is to split the record at / to multiple lines and dowload it into another file.
What i am planning to do is... if the line does not start with / then i want to concatenate the multiple lines into single line and then split it into multiple records. Can anyone guide me how to achieve this.Yes, it should work.
In my example
Loop at itab.
concatenate i_text itab into i_text.
endloop.
You change that loop for the loop of your internal table with the file records
So if you have this three records
'aaaa/bbb/ccc'
'/dddd/efg'
'hijk/lmn'
i_text will look like this at the end
'aaaa/bbb/ccc/dddd/efghijk/lmn'
then in this part of the code
split i_text at '/' into table itab2.
itab2 will have the records looking like this
aaaa
bbb
ccc
dddd
efghijk
lmn' -
How to concatenate multiple records into one
Hi everybody:
I want to know if exist some way to concat multiple records into one without using cursors. For example, I have a table named "Authors" like this:
Lan|Author
English|Ernest Hemingway
Spanish|Octavio Paz
Spanish|Mario Vargas Llosa
English|Sinclair Lewis
Spanish|Gabriel García Márquez
And I want to get this:
Author
Octavio Paz, Mario Vargas Llosa, Gabriel García Márquez
I have worked with SQL Server and I can do something like this:
CREATE FUNCTION dbo.MyConcat (@lan varchar(10))
RETURNS varchar(5000) AS
BEGIN
declare @retvalue varchar(5000)
set @retvalue=''
select @retvalue = @retvalue + Author +',' from Authors where lan = @lan
return substring(@retvalue,1,len(@retvalue)-1)
END
ie, do not use cursors to concatenate records. However, with ORACLE, I have to do someting like this.
FUNCTION MyConcat(P_Lan IN VARCHAR2) RETURN VARCHAR2 IS
v_ret VARCHAR2(4000);
v_element VARCHAR2(4000);
v_cursor sys_refcursor;
BEGIN
OPEN v_cursor FOR SELECT Author FROM Authors where Lan = P_Lan
LOOP
FETCH v_cursor INTO v_elemento;
EXIT WHEN v_cursor%NOTFOUND;
IF v_ret IS NULL THEN
v_ret := v_element;
ELSE
v_ret := v_ret || ', ' || v_element;
END IF;
END LOOP;
RETURN v_ret;
END;
Exist some other way to do this?
Best Regards
JackTks both for answer... I forgot to mention that I am using Oracle 10g. I read about LISTAGG() but this function is available for Oracle 11g release 2.
I wil read about the other techniques than Hoek mention
Best Regards.
Jack -
Add Internal Table Multiple Lines into Single Line
Hi Gurus,
Before post this thread, i hav searched SDN but i could not find the exact solution.
I hav an internal table, i want to add the records of this internal table into single line (string variable), separated by tab operator.
can any one give me suggestions to solve this?
Thanks
MeherHi,
Program should be some thing like below:
REPORT ZTEST36.
*-- test program to concatenate internal table to string.
DATA:STRING TYPE STRING.
TYPES:BEGIN OF TY_ITAB,
WEEK(15),
END OF TY_ITAB.
DATA:GT_ITAB TYPE STANDARD TABLE OF TY_ITAB WITH HEADER LINE.
CLEAR GT_ITAB.
GT_ITAB-WEEK = 'SUNDAY'.
APPEND GT_ITAB.
CLEAR GT_ITAB.
GT_ITAB-WEEK = 'MONDAY'.
APPEND GT_ITAB.
CLEAR GT_ITAB.
GT_ITAB-WEEK = 'TUESDAY'.
APPEND GT_ITAB.
CLEAR GT_ITAB.
GT_ITAB-WEEK = 'WEDNESDAY'.
APPEND GT_ITAB.
CLEAR GT_ITAB.
GT_ITAB-WEEK = 'THURSDAY'.
APPEND GT_ITAB.
CLEAR GT_ITAB.
GT_ITAB-WEEK = 'FRIDAY'.
APPEND GT_ITAB.
CLEAR GT_ITAB.
GT_ITAB-WEEK = 'SATURDAY'.
APPEND GT_ITAB.
CLEAR:GT_ITAB, STRING.
LOOP AT GT_ITAB.
CONCATENATE STRING '/' GT_ITAB INTO STRING.
ENDLOOP.
WRITE: / STRING.
Regards
Ramesh.
Moderator message - Ramesh - please use code tags
Edited by: Rob Burbank on Jul 3, 2009 12:26 PM -
Concatenate multiple columns into one string
Hello,
I am using Oracle 11.2, how can I concatenate the value of multiple columns into one string with one SQL:
create table testTb(classId number(5), classRoom varchar2(32));
insert into testTb value(101, 'room101');
insert into testTb value(101, 'room201');
insert into testTb value(101, 'room301');
insert into testTb value(202, 'room444');
insert into testTb value(202, 'room555');
I would like to generate the result as followings:
Class 101 is in room101, room201, room301
Class 202 is in room444, room555
Thanks,Hi,
Since you're using Oracle 11.2, you can use the aggregate LISTAGG function:
SELECT 'Class ' || classid
|| ' is in '
|| LISTAGG ( classroom
) WITHIN GROUP (ORDER BY classroom)
AS txt
FROM testtb
GROUP BY classid
;The generic name for concatenating all the strings in a group is String Aggregation . This page shows several ways to do it, suitable for different versions of Oracle. -
Concatenate multiple rows into single row
Hi I need to concatenate multiple rows,
these are the rows I have
Name
Rnk
Northshore
1
F3
2
Borderline
3
Mattoon
3
Vinemane
5
Arizona
5
WestShore
5
Schumburg
5
Wilson
5
This is how I would like it to look
Name
Rnk
Northshore
1
F3
2
Borderline, Mattoon
3
Vinemane, Arizona, WestShore, Schumburg, Wilson
5
Thanks
LISA86I meant is there a way to do it without using a table?
LISA86
We have not used any extra table. Ok, Try the below:
Select distinct
names= REPLACE(
Select a.Name as [data()]
From YOURTABLENAME A
Where A.Rnk = b.Rnk
Order by a.Name
FOR XML PATH ('') ), ' ', ',') ,Rnk
From YOURTABLENAME B Order by Rnk -
Concatenate multiple tables into one table
Dear all,
I am doing migration between two database structures, that's why I need also to know if we want to concatenate the data in tables A,B and C into one table in the destination schema, what is the strategy to do this knowing that I have a lot of data and I need the fastest solution.
regardsSince the details of your requirements are unclear, will this approach not work ?
SQL> INSERT into target_table
SQL> (SELECT * from tableA UNION
SQL> SELECT * from tableB UNION
SQL> SELECT * from tableC);HTH
Srini -
Copy and Paste Multiple lines into a single cell
Folks:
I need to copy some plain text data into a single cell that has been merged with other cells to provider a larger unit; however, every time I copy and paste my data it gives me an error. In addition, if I paste the data into a single cell, the next line
of data inserts into the next row.
I understand that Alt+enter is a quick way to do what I want, but I already have the data typed out, and I do not want to type the data again.
Example: (If possible I want in one single cell)
Disks=32
Total space=1.74TB
Used space=1.20TB
Free space=0.54TB
Thank you!!!Is there any way to do this but keep the source formatting? I don't see any "Paste Special" options when you do it this way.
That is not possible - when you copy/paste this way, you only copy the plain text, not the formatting. You'll have to apply formatting to the cell with pasted lines from scratch.
Regards, Hans Vogelaar (http://www.eileenslounge.com) -
Concatenate Multiple Columns into Single
Hi All,
I am developing a report and there is a field called FUNDING_SOURCE.
This field is being picked from class_code of PA_PROJECT_CLASSES table as shown below:
(select distinct(class_code)
from pa_project_classes ppc,
pa_projects_all ppa
where class_category = 'FUNDING SOURCE'
and ppc.project_id = :project_id)
But, the requirement is to have all values of Funding Source for a particular project ID concatenated into a single column.
Eg: If I run the above code, the output would be in 3 rows,
Intenal
External
Other
I want the output concatenated and displayed as Internal, External, Other.
Please help me ASAP. Need to finish this soon.
Thanks!SELECT substr(MAX(sys_connect_by_path(a,
'~')),
2) --first character wil be ~ max is used because the query will return 3 rows and u need only one row with all values appended
FROM (SELECT a,
row_number() over(ORDER BY t.b) AS curr, --order in which appending happens
row_number() over(ORDER BY t.b) - 1 AS prev --order in which appending happens
FROM (SELECT 'Internal' a,
1 b
FROM dual
UNION ALL
SELECT 'External' a,
2 b
FROM dual
UNION ALL
SELECT 'Other' a,
3 b
FROM dual) t --creating dummy table
CONNECT BY prev = PRIOR curr
START WITH curr = 1; -
Merging multiple lines into only one separeted by \n
Hello,
I have a query that returns some lines as result, instead of return lines, I want to return just one line separated by \n...
For example:
select 'name 1' as name from dual
union
select 'name 2' as name from dual
union
select 'name 3' as name from dual
The query above returns:
name1
name2
name3
What I need is:
name1\nname2\nname3
How could I solve this?
Thanksin 10g,
SQL> WITH T
2 AS (SELECT 'name 1' AS NAME FROM DUAL
3 UNION
4 SELECT 'name 2' AS NAME FROM DUAL
5 UNION
6 SELECT 'name 3' AS NAME FROM DUAL)
7 SELECT REGEXP_REPLACE ( SYS_CONNECT_BY_PATH ( NAME, '\n'), '^\\n') AS new_name
8 FROM (SELECT NAME, ROW_NUMBER () OVER (ORDER BY NAME) rn FROM T)
9 WHERE CONNECT_BY_ISLEAF = 1
10 START WITH rn = 1
11 CONNECT BY rn = PRIOR rn + 1;
NEW_NAME
name 1\nname 2\nname 3
SQL> in 11g,
SQL> WITH T
2 AS (SELECT 'name 1' AS NAME FROM DUAL
3 UNION
4 SELECT 'name 2' AS NAME FROM DUAL
5 UNION
6 SELECT 'name 3' AS NAME FROM DUAL)
7 SELECT listagg ( NAME, '\n') WITHIN GROUP (ORDER BY NAME) as new_name
8 FROM T;
NEW_NAME
name 1\nname 2\nname 3
SQL> -
Uploading multiple lines in a table control using ECATT
Hi,
I want to upload muliple lines in a table control using ECATT. When I tried to upload only the first line is getting filled.What I have to do for that. Please reply at the earliest.
With warm regards,
Biju K.GeorgeHello ,
To insert multiple lines into the table you have to record the transaction for one entry and loop the same step multiple times to create multiple entries in the table.
Thanks,
Ajay -
Concatenate multiple row values into single column value
Hello,
Can anyone please refresh my memory on how to concatenate multiple row values into a single column value.
In the following query, I will get multiple denial reasons per application and I would rather return all denial reasons on one line.
SELECT a.application_id, a.membership_number,
r.reason_text AS denial_reason,
a.appl_receipt_date AS application_receipt_date,
a.plan_request_1 AS application_plan_code,
a.adjudication_date AS application_denial_date
FROM application a, PLAN p, application_reason ar, reason r
WHERE a.plan_request_1 = p.plan_cd
AND a.application_id = ar.application_id
AND ar.reason_id = r.reason_id
AND a.adjudication_cd = 'D'
AND a.appl_receipt_date BETWEEN '01-jan-2006' AND '31-dec-2006'
AND p.plan_type_id = 12 and a.application_id = :appId
ORDER BY application_id
Any help is greatly appreciated.
Thanks,
-Christinefound the following
SELECT deptno,
LTRIM(MAX(SYS_CONNECT_BY_PATH(ename,','))
KEEP (DENSE_RANK LAST ORDER BY curr),',') AS employees
FROM (SELECT deptno,
ename,
ROW_NUMBER() OVER (PARTITION BY deptno ORDER BY ename) AS curr,
ROW_NUMBER() OVER (PARTITION BY deptno ORDER BY ename) -1 AS prev
FROM emp)
GROUP BY deptno
CONNECT BY prev = PRIOR curr AND deptno = PRIOR deptno
START WITH curr = 1;
DEPTNO EMPLOYEES
10 CLARK,KING,MILLER
20 ADAMS,FORD,JONES,SCOTT,SMITH
30 ALLEN,BLAKE,JAMES,MARTIN,TURNER,WARD
3 rows selected.at http://www.oracle-base.com/articles/10g/StringAggregationTechniques.php -
Concatenate multiple word documents into 1 long document in APEX
I have a requirement to concatenate multiple word documents into 1 long document in APEX but I'm not sure if it can be done
or where to begin.
I've been able to upload/download files in APEX and generate Word docs using BI Publisher, but I can't seem to find anyway to carryout the above.
Any feedback greatly received.
Thanks in advance.
KeithThanks for your reply Jari.
The files are never actually stored in the database as a BLOB or CLOB.
I'm basically trying to do the following:-
I have a third party Document Management System that stores a number of templates (.doc and .dot).
The files are stored in a directory on a file sever.
I have been tasked with the job of creating a Document Generator type app in APEX that will allow the users to select a number of these files and concatenate them together into 1 large 'Master' Document.
I was hoping to be able to do this without having to go down the line of using external software functions like Java but I'll check out your suggestion.
Cheers
Keith -
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
Maybe you are looking for
-
BOM, Routing and production order
Hello Guru, we notice something, our material 1256 has maintain four alternative bom as of this date: Alt BOM MRP4 Prod version BOM stat PV lot size Routing Grp Route Lot 1 ACA 02
-
How to call C++ Program in Abap
Hi Friends, How can i call a C/C++ Program or a Function in an Abap Program.or an Abap Module or Bapi in a C/C++ Program. Regards, Gowtham Kuchipudi.
-
ReadString problem!! could anyone help me take a look
hi... i am doing a music Cd list program. there are two operation i need to do 1) insertion and 2) deletion. i have implemented my own sortList to do it... i work fine when i do the insertion to the list but it can`t perform well on deletion.. Howeve
-
Using Photoshop layers in InDesign?
Hi all, I'm having much more difficulty finding a solution than I thought I would. Any help is greatly appreciated! I have a designer that has put a magazine spread together in Photoshop. It has the background, graphics, and text. I'm looking to
-
Obiee11g-orcle process manager
hi, when i am trying to start oracle process manager services i am getting error message that error 1053 the service did not respond to start or control request in timely fashion thanks chinu