One column concat...urgent
Hello All,
I have a table with one column, which has the values are follows as 12 records.
Out of that I want to create only three records
discard all 'value' records and
concatenate all the remaining records as one with respective of each 'value' record: Assume the 'value' will be default value and it'll never get changed at all
column
value
val1
val2
val3
value
val11
val22
val33
val44
value
val10
val30
So in the output will be
column
val1,val2,val3
val11,val22,val33,val44
val10,val30
Any help would be appreciated
Ok see this:
SELECT rank, MAX(TRIM(LEADING ',' FROM SYS_CONNECT_BY_PATH(col1,','))) AS result
FROM (
SELECT col1, rank, ROW_NUMBER() OVER (PARTITION BY RANK ORDER BY RANK) AS rn
FROM (
SELECT col1, len, DECODE(SUBSTR(col1,-1,1),0,0,len) as rank
FROM (
SELECT col1, LENGTH(TRIM(BOTH '*' FROM TRANSLATE(col1,'abcdefghijklmnoprstuvwxyz','*************************'))) AS len
FROM test_table
WHERE col1 <> 'value'
START WITH rn = 1
CONNECT BY PRIOR rn = rn - 1 AND PRIOR rank = rank
GROUP BY rank;Hope this help you ;)
Peter D.
Forgot about result. Here it is:
RANK RESULT
0 val10,val30
1 val1,val2,val3
2 val11,val22,val33,val44Message was edited by:
Peter D.
Similar Messages
-
Concate 3 column data in to one column.
I would like to concate 3 columns in to one column. all three column has datatype as LONG. Is any one knows how to concate long datatype column into one column?
Thanks in Advance812294 wrote:
Is there any way to not use CLOB datatype? I am fetching data from three different tables.And what fetching from three different tables has to do with CLOB?
SQL> set serveroutput on
SQL> declare
2 concat_result clob;
3 tmp long;
4 begin
5 select text
6 into tmp
7 from dba_views
8 where rownum = 1;
9 concat_result := tmp;
10 select data_default
11 into tmp
12 from dba_tab_columns
13 where data_default is not null
14 and rownum = 1;
15 concat_result := concat_result || tmp;
16 select search_condition
17 into tmp
18 from dba_constraints
19 where search_condition is not null
20 and rownum = 1;
21 concat_result := concat_result || tmp;
22 dbms_output.put_line(concat_result);
23 end;
24 /
select
"LIB_IDX","LIB_NAME","VENDOR_NAME","PROTOCOL_NUM","VERSION_NUM","PATH_NAME","MAP
_FILE","FILE_CFGID","MAP_ELEM","ELEM_CFGID","MAP_SYNC" from v$map_library0 OBJ#
IS NOT NULL
PL/SQL procedure successfully completed.
SQL> SY. -
SQL*Loader concat into one column
Hi
I want to import an ASCII File with fixed positions to a table. One column in database needs 3 different position strings to import. is there a way to do it?
i test this sample, but it doesn't work:
into table t1
ORDER position(1:10),
NAME position(28:35)||' '||position(100:116)||', '||position(129:140)
ralfok forget it. I've just see the answer in forum. SORRY
-
Download file format(different length data on one column)
Hi all,
i am just writing a report to download the delivery data to a file.the file have 3 columns.the length of the column data in every row varies.
let my file structure is like
first line of my file contains,
delivery no(22),delivery date(8),delivery type(5)
2nd line of the file contains,
shipper num(48),customer PO num(20),material num(15)
In the first column of this file contains delivery number(length-22)& shipper number(length-48).but the length of both the data will be different i.e i have to assign the length of delivery num as 22 & length of shipper num as 48.but they will appear in one column. how it will be possible.
is there any command to make the file format like this?
ur help is highly appreaciated.it's urgent.
Regards
pabitrawhatever record you will populate(i mean it may be either delivery no or shipment no etc..)define your internal table with the highest length(in this case 48).
as both values are CHARacters, there is no problem even if you populate Delivery no(of 10 chars) to 48 char field.
spaces will be truncated.
data:begin of itab,
col1<b>(48) type c</b>,
col2,
col3,
end of itab.
*--when you are populating Delivery no:
ITAB-COL1+0(10) = V_DELIVERYNO.
CONDENSE ITAB-COL1+0(10) NO-GAPS.
*--when you are populating SHIPMENT no:
ITAB-COL1+0(48) = V_shipment.
CONDENSE ITAB-COL1+0(48) NO-GAPS.
i guess,there wont be any problems,if you use this logic.
Regards
srikanth -
How to create Tree format in Table Rn in one Column having data?
Hi Gurus,
i got the new requirement it's very interesting pl z help me...
My Requirement is i have one Table Rn in Table Rn having 5 columns There here one column name is 'Competencies ' That Competencies column having the more rows liki
FUNC.ADMIN.Achievement Orientation
FUNC.ADMIN.Administrative Assistance and Support
FUNC.ADMIN.Administrative(ADMIN)
This is one column data my Requirement is now
FUNC
+ADMIN
+Achievement Orientation
like clients are expecting pl z tell me how to approach in this requirement and what are prerequisites are needed ...plz help me it's urgent requirement.
Regards,
SriniHi Gyan,
Thank's for valuable suggestions
My Requirement is This ...
"Competencies" Table Layout: (InstTableLayout)
COMPETENCIES (COLUMN NAME)
BEHV.Generic.Communication(BEHV)
BEHV.Generic.Planning, Organizing & Time Management
BEHV.Generic.Problem Solving Ability
BEHV.Generic.Productivity
BEHV.Generic.Punctuality
like number of rows are there now Tree format is row data
like each column divided each one
ex:
+ BEHV
*|*
+Generic
*|*
+Communication(BEHV)
like he expected client in tree format pl z tell me how to approach in this requirement and what are the prerequisites are required .....
Regards,
Srini
Edited by: 876628 on Dec 1, 2011 8:37 PM
Edited by: 876628 on Dec 1, 2011 8:37 PM -
Adding one column in RFITEMAR. tr-code FBL5N
hi experts.
AFTER CONVERTING TO Y OR Z PROGRAM.
I want to add one WBS Element(projk) field in the output report ie i want one column in rfitemar(yrfitemar).
how to add the coulme i am not getting how to add that column in the report output.
table bseg-projk.
can u plz help me it is very urgent.Hi,
Once you copy the rfitemar to ZXXXXXXXX. All the field will displayed. In this program RFPOSXEXT strcuture is used. WBS element is also included in the strcuture. But this field (WBS Element PROJK) is visible in the change layout. If you want this field to appear in the default output list.
You need to modify the fieldcatalog as below :
loop at it_max_fieldcat.
if it_max_fieldcat-fieldname = projk.
it_max_fieldcat-no_out = ' '.
endif.
modify.
endloop.
Thanks,
Sri.
Message was edited by:
Sriram Ponna -
Getting data of two columns in one column
Hi,
I need to show data of two columns in one column, I also want to insert space between the data of both the columns in the output
can i use something like this ?
(IMPORTER_NAME+' '+IMPORTER_ADDRESS) as "Location"872435 wrote:
Hi,
I need to show data of two columns in one column, I also want to insert space between the data of both the columns in the output
can i use something like this ?
(IMPORTER_NAME+' '+IMPORTER_ADDRESS) as "Location"You can either use the CONCAT function or || -
SQL> select 'Hello'||' '||'World', CONCAT(CONCAT('Hello',' '),'World') from dual;
'HELLO'||'' CONCAT(CONC
Hello World Hello WorldHTH
David -
Mobilink syncronization mapping one column of SQLA to two of HANA columns
Hi,
In SQLA I have a column(say col_a) which I want to divide and put in two columns in HANA(say col_a and col_b). My string lengths are fixed so I know where exactly to divide.
With this in mind, I could write the upload script to upload data into hana which goes into two tables.
Here it is :
INSERT INTO <MY_TABLE>
( pkey,
col_a,
col_b )
VALUES ( {ml r.pkey},
SUBSTRING ({ml r.col_a}, 0, 26),
SUBSTRING ({ml r.col_a}, 28, 6) )' );
Now I am confused about how to write the Download script. Usually I should concatenate them and put in the one column of SQLA I tried with this :
SELECT <MY_TABLE>.pkey,
CONCAT ( CONCAT ( <MY_TABLE>.col_a, " "),
<MY_TABLE>.col_b)
FROM TEST_CHAR_TYPES_TABLE
INNER JOIN <MY_TABLE>_upserted
ON <MY_TABLE>_upserted.pkey
= <MY_TABLE>.pkey
WHERE <MY_TABLE>_upserted.upserted_timestamp
>= {ml s.last_table_download}
This does not work. Any pointer on this would be of huge help.
Regards,
SubhankarHi Subhankar,
This does not work. Any pointer on this would be of huge help.
Your download_cursor SQL looks okay in this instance - can you clarify what the error is that you receive with MobiLink?
Feel free to post a simple log snippet (dbmlsync -o remote.txt or mlsrv16 -o mlsrv.txt) with the details.
Thanks,
Jeff Albion
SAP Active Global Support -
Report column (concat column) color
I have report with one column which have concat value of NAME and SUBJECT. I want to display NAME and SUBJECT in different color so that it is clearly distinguished. Name and Subject are column of a table.
My query is 'SELECT kmc.id ID,
kmc.NAME || '' -- ''||substr(KMC.SUBJECT,1,100) subject ,
kmc.ENTRY_TYPE Content_Type FROM CONTENT KMC'
How could I do this?
Thanks
N GargHi Navdeep,
Try:
SELECT kmc.id ID,
'<span style="color:red">'||kmc.NAME ||'</span>--<span style="color:blue">'||substr(KMC.SUBJECT,1,100)||'</span>' subject,
kmc.ENTRY_TYPE Content_Type FROM CONTENT KMC
Regards
Andy
Message was edited by:
ATD -
Concacenate Many Columns text into one Column
Hi,
I have many columns with text in it. I would like to ideally concatenate these column content into just ONE column.
Please help work out how to do this as I have no idea.
I am somewhat familiar with CMD so if you can help with this urgently that would be SO awesome.
Thanks
:)890635 wrote:
Thanks again...
So I want to display this data eventually on forms. So I think I do need to create a blank column.
so let's say I want the concatenated data to end up in "Final_Delivery".
How to do that?
Thank youI dont have any idea about Forms...But just a guess that for form as well you must be writing some SQL, and you can use the sql there directly. Otherwise if you want to get it inserted into new column in existing table....First you have to add a new column to your table and then run update Statement to populate that data..similar to this
SQL> select * from emp;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO TEST INFO
7369 SMITH CLERK 7902 17-DEC-80 800 20
7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30
7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30
7566 JONES MANAGER 7839 02-APR-81 2975 20
7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30
7698 BLAKE MANAGER 7839 01-MAY-81 2850 30
7782 CLARK MANAGER 7839 09-JUN-81 2450 10
7788 SCOTT ANALYST 7566 19-APR-87 3000 20
7839 KING PRESIDENT 17-NOV-81 5000 10
7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30
7876 ADAMS CLERK 7788 23-MAY-87 1100 20
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO TEST INFO
7900 JAMES CLERK 7698 03-DEC-81 950 30
7902 FORD ANALYST 7566 03-DEC-81 3000 20
7934 MILLER CLERK 7782 23-JAN-82 1300 10
14 rows selected.
SQL> update emp set info=to_char(empno)||' '||ename||' '||job;
14 rows updated.
SQL> select * from emp;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO TEST INFO
7369 SMITH CLERK 7902 17-DEC-80 800 20 7369 SMITH CLERK
7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30 7499 ALLEN SALESMAN
7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30 7521 WARD SALESMAN
7566 JONES MANAGER 7839 02-APR-81 2975 20 7566 JONES MANAGER
7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30 7654 MARTIN SALESMAN
7698 BLAKE MANAGER 7839 01-MAY-81 2850 30 7698 BLAKE MANAGER
7782 CLARK MANAGER 7839 09-JUN-81 2450 10 7782 CLARK MANAGER
7788 SCOTT ANALYST 7566 19-APR-87 3000 20 7788 SCOTT ANALYST
7839 KING PRESIDENT 17-NOV-81 5000 10 7839 KING PRESIDENT
7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30 7844 TURNER SALESMAN
7876 ADAMS CLERK 7788 23-MAY-87 1100 20 7876 ADAMS CLERK
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO TEST INFO
7900 JAMES CLERK 7698 03-DEC-81 950 30 7900 JAMES CLERK
7902 FORD ANALYST 7566 03-DEC-81 3000 20 7902 FORD ANALYST
7934 MILLER CLERK 7782 23-JAN-82 1300 10 7934 MILLER CLERK
14 rows selected.
SQL>Regards,
Navneet -
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 -
Formating the Row Based on one column value
Hi Friends
I am trying to format the Entire row based on the value of the first column in my Answers.
Example if first column value in 'F' now i want the Entire row to be colored
I can do conditional formating on one column but i want to do it on the entire row
F 8.1 % 12.0 %
E 5.2 % 3.5 %
M 2.3 % 3.3 %
If any one has done this or any suggestions please respond
Thanks
SangIts a Pivot View
F 8.1 % 12.0 %
E 5.2 % 3.5 %
M 2.3 % 3.3 %
the column 1 --> F,E,M are the Product
the column 2 --> 8.1% , 5.2% , 2.3% are the sales in year 2008
the column 3 --> 12.0 % , 3.5 %, 3.3 % are the sales in year 2009
So will i be able to apply the formating in pivot view based on one column to other column If yes please let me know how or
suggest if this can be done using the BI Office , or BI publisher
sing the BI Office i can do the formating in Excel but once i refresh the data all the formating is gone ... :(
I am donno BI Publisher if we have to use BIP please suggest any solution its very very very urgent and important report formating they need here ....
Thanks in advance David
sango -
How can I Move data from one column to another in my access table?
I have two columns, one that stores current month’s data and one that stores last month’s data. Every month data from column 2 (this month’s data) needs to be moved to column 1 that holds last month’s data. I then null out column 2 so I can accumulates this month’s data.
I understand how to drop a column or add a column, how do I transfer data from one column to another.
Here is my trial code:
<cfquery name="qQueryChangeColumnName" datasource="#dsn#">
ALTER TABLE leaderboard
UPDATE leaderboard SET points2 = points3
</cfquery>
Unfortunately, I get the following error:
Error Executing Database Query.
[Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver] Syntax error in ALTER TABLE statement.
How can I transfer my data with the alter table method?I looked up the Access SQL reference (which is probably a
good place to start when having issues with Access SQL), and
it suggests you probably need a WHERE clause in there.
I agree the documentation is a good place to start. But you should not need a WHERE clause here.
Too few parameters. Expected 1.
If you run the SQL directly in Access, what are the results? At the very least, it should provide a more informative error message.. -
OAF Export button fetching data in one column - view object using union all
Dear All,
Export button showing data in one column from view object,
View object is based on mulitple queries with union all ,
Please let me know the solution for this issue.
Thanks
Maheswara RajuMaheswara Raju,
As per my understanding you are not able to export all the View Attribute using export Button. Only the attribute which is used with the item/region will get exported.
There are few work around in case if you want to export the column without showing on OAF Page. Let me know.
Cheers
Gyan -
How to retrieve value of one column to other in Apex using Javascript
Hi all,
Can any one help me in solving this problem.
How to send a value from one column to another column using javascript in Apex. I heard that we can use onChange().
My requirement is,
I have a column(Varchar2) in form where i need to enter a value and the data need to be sent to another column(Number) when i press apply changes.
ex: if i enter a value say 1/3 or 1/4 or 1/3*1/6
the result should be entered in the other column.
Message was edited by:
RamanTry something like
html_GetElement('P1_ITEM2').value = eval(html_GetElement('P1_ITEM1').value);
Maybe you are looking for
-
How do I have a CR report based of Reconciled / UnReconciled
Hi How do I get to add the Reconciled or Unreconciled option for my Crystal Report; I have created a Statement that shows all transactions for the BP and the current Ageing Values but I am wanting to add an option under my parameters where I can sele
-
Doubt on servlet architecture, URGENT
Hello Java experts!! Please claurify my small doubt In servlet architecture, if i write one servlet, multi threading concept of servlets will be implemented in Servlet level or doPost(doGet) level. Because I wrote all functions out side the dopost me
-
Hi, I have used below code & get error like AdApiError Code: 105 Error Code: InvalidCredentials Message: Authentication failed. Either supplied credentials are invalid or the account is inactive. But i have all credentials correctly... <?php // Incl
-
LSMW - No batch input data for screen SAPLMGMM 0060
Hi, I'm using LSMW to extend the MRP 4view of material master, but when I execute the batch input session, I got the error message: "No batch input data for screen SAPLMGMM 0060" What happened? Kindly please advise. Thanks.
-
Install Mountain Lion on a second computer
I purchased mountain lion a few months ago and now want to install it on a second computer. The app store will not let me install it however, saying that it is not available in the US store. Aren't I supposed to be able to download and install soft