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'
Similar Messages
-
Grouping the Records Into One Single Record
Suggest me any function in sql or script which gives me following result.
I have a table in which there are few columns and the data looks like below. I am only concerned about 3 columns
C1 C2 C3
A B Parent
B A Child
My requirement is to club and make it as
C1 C2 C3 C4
A B Parent Child
I need to group in .. If we look into the first 2 records .. c1 of first record is equal to c2 of second record..Hi,
Here's one way to do it:
SELECT p.c1
, p.c2
, p.c3
, c.c3 AS c4
FROM table_x p
JOIN table_x c ON p.c2 = c.c1
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
Point out where the query above is producing the wrong results and explain, using specific examples, how you get those results from the given data in those places.
Always say which version of Oracle you're using.
See the forum FAQ {message:id=9360002} -
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. -
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 -
IDOC with Multiple Segment to One Single Record Mapping
Hello
I have a problem mapping the values of the segment <E1CSKTM>
which occurs two times in my source IDOC to a single record.
My requirement is to get one field (LTEXT) from the first E1CSKTM segment and map it to Name and take the same field (LTEXT) but from the second E1CSKTM segment and map it to OrgDescription
The source message:
<?xml version="1.0" encoding="UTF-8"?>
<COSMAS01>
<IDOC BEGIN="1">
<EDI_DC40 SEGMENT="1">
<TABNAM>EDI_DC40</TABNAM>
<MANDT>300</MANDT>
<DOCNUM>0000000000750131</DOCNUM>
<DOCREL>700</DOCREL>
<STATUS>30</STATUS>
<DIRECT>1</DIRECT>
<OUTMOD>2</OUTMOD>
<IDOCTYP>COSMAS01</IDOCTYP>
<MESTYP>COSMAS</MESTYP>
<STDMES>COSMAS</STDMES>
<SNDPOR>SAPQAE</SNDPOR>
<SNDPRT>LS</SNDPRT>
<SNDPRN>QAE300</SNDPRN>
<RCVPOR>SAPQAX</RCVPOR>
<RCVPRT>LS</RCVPRT>
<RCVPRN>QAX304</RCVPRN>
<CREDAT>20080308</CREDAT>
<CRETIM>090820</CRETIM>
<SERIAL>20080211134325</SERIAL>
</EDI_DC40>
<E1CSKSM SEGMENT="1">
<MSGFN>005</MSGFN>
<MANDT>300</MANDT>
<KOKRS>1000</KOKRS>
<KOSTL>0105012501</KOSTL>
<DATBI>99991231</DATBI>
<DATAB>19000101</DATAB>
<ERSDA>20060219</ERSDA>
<USNAM>HAMEED</USNAM>
<BKZER>X</BKZER>
<BKZOB>X</BKZOB>
<PKZER>X</PKZER>
<MGEFL>X</MGEFL>
<BUKRS>1000</BUKRS>
<GSBER>20</GSBER>
<KOSAR>N</KOSAR>
<VERAK>TBA</VERAK>
<WAERS>SAR</WAERS>
<KHINR>105012001</KHINR>
<KOMPL>X</KOMPL>
<OBJNR>KS10000105012501</OBJNR>
<PRCTR>0105012000</PRCTR>
<FUNC_AREA>Z240</FUNC_AREA>
<FUNC_AREA_LONG>Z240</FUNC_AREA_LONG>
<E1CSKTM SEGMENT="1">
<MSGFN>005</MSGFN>
<SPRAS>A</SPRAS>
<KTEXT>مدير الدائرة وموظفوه</KTEXT>
<LTEXT>م. د. وموظفوه/ حسابات منطقة المدينة</LTEXT>
<SPRAS_ISO>AR</SPRAS_ISO>
</E1CSKTM>
<E1CSKTM SEGMENT="1">
<MSGFN>005</MSGFN>
<SPRAS>E</SPRAS>
<KTEXT>DvM and Stff/AOD-Mad.</KTEXT>
<LTEXT>Div Mgr and Staff/AOD-Madinah</LTEXT>
<SPRAS_ISO>EN</SPRAS_ISO>
</E1CSKTM>
</E1CSKSM>
</IDOC>
</COSMAS01>
The Target Message:
<?xml version="1.0" encoding="UTF-8"?>
<ns0:CostElementMT xmlns:ns0="http://se.com.sa/materials">
<INSERT>
<COSTELEMENT_DATA action="INSERT">
<TABLE>usmuser.OrganizationCodes_test</TABLE>
<access>
<OrgCode>105012001</OrgCode>
<CostCenter>0105012501</CostCenter>
<OrgDescription> English Name<OrgDescription/>
<Name>Arabic Name</Name>
</access>
</COSTELEMENT_DATA>
</INSERT>
</ns0:CostElementMT>
is this possible using the graphical mapping?Hi Baheej,
If in your input "E1CSKTM" segment always occurs twice than u can go with the above UDF mentioned by Chirag and also u need to take care that field (LTEXT) also always occurs.If the field does not occur always than you need to check it using exists functions.
Andmoreover if the "E1CSKTM" segment does occur more than twice than u need to create a UDF where u need to pass the values alternatively.
Please check the above details and let us know if any furthur enhancements are to be made.
Thanks,
Bhargav
Note:Award Points if found useful. -
How can I map last of the repeating records into a single record?
I have a following input schema, I need to take only one of the <Student> records and map that to a single record in output. Doesn't matter if the first, second or last one of the records get mapped, I only need one in the output. Any idea how can
this be accomplished?
Input:
<Students>
<Student id="1">
<Name>
A
</Name>
<Roll>
1
</Roll>
</Student>
<Student id="2">
<Name>
A
</Name>
<Roll>
1
</Roll>
</Student>
<Student id="3">
<Name>
A
</Name>
<Roll>
1
</Roll>
</Student>
</Students>
Expected Output:
<Candidate>
<Student>
<Name>
A
</Name>
</Student>
</Candidate>Sounds rather complex for something that could be done very simple in custom XSLT like this:
<?xml version="1.0" encoding="utf-16"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="Students">
<Candidate>
<Student>
<Name>
<xsl:value-of select="Student/Name" />
</Name>
</Student>
</Candidate>
</xsl:template>
</xsl:stylesheet>
Morten la Cour -
Integrating number of records into a single record
Hi
I have a table where we store trainees with certifications, it stores trainees address, id, pass/fail flag, course codes, competetion date and certificate expiration date. WHat I need is to display a single record for each trainee in my query. In this case, what we have currently in the table is we might have 11 certificates for a trainee or 1 or maybe 5 etc. All I need is to display all his information, address, trainee id, courrse code..course code11 in a signle record. Is it possible and how? Please helpTry this one - it points to the same page and looks like it works:
Re: How to show the SELECT result in a certain form? -
Can you sort multiple albums into one single album....?
So my situation is like this...
I have multiple albums from one specific Band (in this case its music from Shin Megami Persona.) I have all 8 albums sorted separately in Itunes. When it is sync'd to my Iphone it will show all of them in order which is typical. What I am curious about is if I can put the Albums into one Album name and when I click it, it will then show the 8 albums. Basically, this is for the sake of not having a lengthy album list on the iphone.
If my question/explanation was unclear, maybe this might help.
My current Album list looks like this:
Albums- P
Paramore
Persona Reincarnation
Persona 3 OST
Persona 4 OST
Persona 3 FES OST
Persona 3 Portable OST
Persona Music Live 2008
Persona Music Live 2009
Persona Music Live Band
Pink Floyd Greatest Hits
ect... ect...
What I would like is for it to be like this:
Album-P
Paramore
Persona Sountracks <------ click on this
Pinkfloyd Greatest Hits
ect...ect...
Clicking leads to below
Persona Soundtracks:
Persona Reincarnation
Persona 3 OST
Persona 4 OST
Persona 3 FES OST
Persona 3 Portable OST
Persona Music Live 2008
Persona Music Live 2009
Persona Music Live Band
I've been able group them all together by changing them all to the same album name but it just leads to a extremely lengthy list of songs. So if there is anyway to sort by the way I explained above, I am open for suggestions. Thanks!!!1!1!1!1Thanks. That was very easy and works perfectly. Do you know if I can get my 08 edited footage back into 06 for some additional editing without exporting as a Quicktime movie that I can't edit? I want to add audio tracks that I can edit in synch with my video footage like I can in 06. Thanks!
-
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 -
Collating multiple tracks into one single track
I am trying to learn another language and have a CD with multiple tracks on it. When I load it onto my iPOD the tracks don't stay in order, which makes following the lessons difficult.
Does anyone know how I can collate all the tracks so they become one single track which I could then download onto my iPOD?I am trying to learn another language and have a CD
with multiple tracks on it. When I load it onto my
iPOD the tracks don't stay in order, which makes
following the lessons difficult.
Does anyone know how I can collate all the tracks so
they become one single track which I could then
download onto my iPOD?
Set the switch to the FIRST position to play tracks in order... -
Combining multiple records into a single record (View)
Okay so here is my scenerio:
There is a table I have made that details SQL jobs and the various details about them. What i wan't to do is make a view with specific logic implemented. Fields that will be taken across to this view will be: LastRunDate, LastRunTime and Step_Status.
JobName will also be used to define the logic but will not be a column in itself.
What i wan't is an additional column using this logic, called 'DataSet'. For each Dataset there are multiple jobs that are unique to it, so there are multiple records being brought over from the table to view for one particular dataset. For example,
for 'ExampleDataSet' there are three jobs, i wan't it so these jobs are combined and named as 'ExampleDataSet' under a calculated column called 'Dataset'. For the following fields i would like it so that LastRunDate and LastRunTime are the time in whichever
job was last to be intitiated is the date and time set. For Step_Status, there are three possible results, 'Running', 'Failed' or 'Succeeded'. If any of the three jobs are 'Running', then 'Running'. If neither are running yet one has failed then 'Failed'.
Only when all three have succeeded should it then be set to 'Succeeded'.
I hope i have made that clear enough, please feel free to ask any questions if not. I am relatively new to SQL but i thought to at least try least try (I knew it wouldn't work) and it didn't work. But it may give you a better idea of
what i wan't:
CREATE VIEW [dbo].[vw_DataAvailabilityAnalysts] AS
SELECT CASE
WHEN JobName in ('Job1','Job2','Job3') and step_status='Running' THEN 'Running'
WHEN JobName in ('Job1','Job2','Job3') and step_status='Failed' THEN 'Failed'
WHEN JobName in ('Job1','Job2','Job3) and step_status='Succeeded' THEN 'Succeeded'
END as StatusCheck,
CASE WHEN JobName in ('Job1','Job2','Job3') THEN 'ExampleDataSet'
END as DATASET,
LastRunDate,
lastruntime,
step_status,
FROM [CDS_Common].[dbo].[DataAvailability]
Many Thanks,
Plain_Clueless
Plain_CluelessOkay so here is what my table looks like (Simplified). There are four columns and the data within is extracted via a Stored Procedure.
JobName
LastRunDate
LastRunTime
Step_Status
Job1
11/06/2014
09:30:00
Succeeded
Job1
10/06/2014
09:37:20
Succeeded
Job2
11/06/2014
04:05:00
Succeeded
Job1
09/06/2014
02:17:41
Succeeded
As you can see there are 3 jobs which are all 'Job1'. This jobs are obviously different within the table however this represents that they are jobs which all update the same DataSet within our local warehouse. Whereas Job2 updates a different dataset alltogether.
I wan't to create a view which will alagmate the jobs that are of the same DataSet, which will disclude the column JobName but would create a whole new column that looks like this:
DataSet
LastRunDate
LastRunTime
Step_Status
DataSet2
11/06/2014
04:05:00
Succeeded
DataSet1
11/06/2014
09:30:00
Succeeded
Bascically what this shows you is all the Job 1's combined so they are one record, Amaglamated. The last time any of these jobs were run is the LastRunDate & LastRunTime, which was the first record in the first table provided. Again for Step_Status,
there are three possible results, 'Running', 'Failed' or 'Succeeded'. If any of the three jobs are 'Running', then 'Running' (Absolute). If none of the three jobs are running yet one has failed then 'Failed'. If one has failed yet another is also running then
'Running'.Only when all three have succeeded should it then be set to 'Succeeded'. (This last bit isn't as important).
Hope this clears it up a bit,
Plain_Clueless
Plain_Clueless -
Display multiple records into one deliminated record
If I have a table with two columns such as:
create table test(
id number(10),
name varchar2(30)
Say the example data in the table is:
id name
1 John
1 David
How can I select the data from sqlplus and return the record in the following format
1 John,David
instead of
1 John
1 David
What's the select statement looks like? Thanks.or you could put it this way...
SQL> SELECT a.id, a.name||','||b.name Name
2 FROM test a, test b
3 WHERE a.id = b.id
4 AND a.name <> b.name
5 AND a.ROWID = (SELECT MIN(ROWID) FROM test WHERE id = a.id);
ID NAME
1 John,David
2 Neil,Craig
SQL>
the position of how the names (i.e. John, David or David, John) are presented would depend on the sub-query for ROWID (either use MAX or MIN function). I think the later query would match with that of your requirement. -
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 -
Merging two records in a single record for the same matnr,werks and bwart.
Hi I have a requirement to merge two records into one single record using the quantity field from MSEG table.
I am selecting two records from the table MSEG. Now for these two records i have to add the quantity values into one variable.
Then there should be only one record for the same matnr,werks,bwart.
Any suggestion would be appreciated.
Regards,
Amithi,
You can COLLECT statement only if all non key fields are numeric.
This statement Adds all such fields and give us a single record.
Regards
Sumit Agarwal -
How to insert sales text (MM02) into a single record of a Ztable.
Hi,
I'm extracting data from different data base tables and populating a Ztable which has Matnr as primary key and sales text as a field.
I have already used READ_TEXT to display the text and it is displayed in multiple records which in turn leads to duplication of Material numbers.
Now I want to avoid duplication of records (Matnr) as this being a primary record, and display the sales text of a particular material number into one single record.
Can anyone tell me how to insert sales text (MM02) transaction into one single record.
Thanks,
Govindsorry i am not enough clear about your requirement...
as i can understand i am explaining to you.
suppose your itab contains repaeating matnr.
matnr
1
1
2
2
2
3
3
like this.
data : text(200),
matnr like mara-matnr.
loop at itab.
call READ_TEXT fnmodule.
loop at tline.
concatenate text tline-tdline into text.
endloop.
matnr = itab-matnr.
at end of matnr.
itab1-matnr = matnr.
itab1-text = text.
append itab1.
clear text.
endat.
endloop.
NB change the code as per your requirement
regards
shiba dutta
Maybe you are looking for
-
Get a 15" rMBP now or wait Broadwell?
Hey guys, I am a software engineering student from Brazil and I will spend the next year living and studying in US. As some of you know gadgets in Brazil are really expensive so this is a great opportunity to replace my late 2011 13" MacBook Pro with
-
We just purchased an ipod touch 4th gen 8 gb from Wal Mart. OUt of the box the right headphone is not working. Tried numerous pairs of headphones..tried the mono settings and nothing is working. Is there a setting we are missing or should we just ret
-
This is a problem for the experts around here
I really need help with this - I have been trying to get this to work for 2 weeks now and so far no one has been able to help. See http://www.kirupa.com/forum/showthread.php?t=248030 and http://www.kirupa.com/forum/showthread.php?t=249806 for my prev
-
TS1424 "Unable to Download Song" message in iTunes app on iPod Touch?
I did look to see if this question was posted anywhere else, but did not see it. So if it has already been answered, my apologies. I am hooked up to the wireless, logged into iTunes, credit card good to go. Every time I go to download a song, it stop
-
Display XML Document from CLOB Column on page
Hi, I have been reading all the CLOB postings that I can find, but I still cannot get my page to do what I want. I have a very simjple table: MF_XML_DOCS (DOC_ID NUMBER, DOC_XML CLOB) I can populate this table OK but I am having problems getting the