Getting output in a single line
hi to alll
i want to get output of a column in single line seprated by comma
like in emp table i have ename column . i need out put like
scott,king,....,..
thanx in advance
In 10g you could use the COLLECT aggegrator to get close:
select deptno
, cast(collect(ename) as string_table) staff
from emp
group
by deptno
where string_table has been defined as
create type string_table as table of varchar2(40)
Alternative, you can use Data Cartridge to define a new Aggregator that allows queries like:
select d.dname
, count(d.dname)
, Amisvarchar2Sum(e.ename)
from dept d , emp e
where e.deptno = d.deptno
group by d.dname
where Amisvarchar2Sum is the user defined aggreation operator. The results are like:
RESEARCH 4 ALLEN,SCOTT,BLAKE
SALES 3 KING,BRUCE
etc.
See here: Oracle Data Cartridge - Extending the Database at http://technology.amis.nl/blog/index.php?p=34 for a description.
I hope this will help you.
Lucas
Similar Messages
-
Dear All
I have a form which shows the output for only one line for a give parameter. But when the same query is copied from the form it shows all 36 rows in backend. i think the issue is becuse of property palette.
Kindly update it.
regards
Arifuddin
Edited by: user11309801 on Feb 13, 2011 3:17 AMAsk your question at the Forms Forum @ Forms
-
How to display output in a single line?
Hi
im getting the out put in the following way
100006 1120 01
02
03
100007 1410 01
02
03
but i want the output as follows
100006 1120 01,02,03
100007 1410 01,02,03
Can any body tell me the code for this?Hi Dilip
this is my full code
im not getting the proper out put..
eg : i have material 1000002 for this 3 inspection types are there 01,02,03
1000003 for this 1 inspection types are there 05
following program giving me the out put as
1000002 1410 03
1000003 2140 05
01
02
03
05
but i want the output as follows
1000002 1410 01
02
03
1000003 2140 05
can u help me on this also?
TABLES:MARC.
TYPE-POOLS: SLIS.
SELECTION-SCREEN:BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-T01.
SELECT-OPTIONS:S_MATNR FOR MARC-MATNR.
PARAMETERS:P_WERKS TYPE MARC-WERKS.
SELECTION-SCREEN:END OF BLOCK B1.
TYPES:BEGIN OF TYPE_FINAL,
ART TYPE QMAT-ART,
MATNR TYPE MARC-MATNR,
WERKS TYPE MARC-WERKS,
END OF TYPE_FINAL,
BEGIN OF TYPE_QMAT,
ART TYPE QMAT-ART,
MATNR TYPE QMAT-MATNR,
END OF TYPE_QMAT.
DATA:IT_FINAL TYPE TABLE OF TYPE_FINAL,
WA_FINAL LIKE LINE OF IT_FINAL,
I_FINAL TYPE TABLE OF TYPE_FINAL,
IT_QMAT TYPE TABLE OF TYPE_QMAT,
WA_QMAT LIKE LINE OF IT_QMAT.
DATA: i_FCAT TYPE TABLE OF SLIS_FIELDCAT_ALV,
W_FCAT TYPE SLIS_FIELDCAT_ALV.
field-symbols: <fs_fin> TYPE TYPE_FINAL.
START-OF-SELECTION.
PERFORM GET_DATA.
PERFORM PROCESS_DATA.
PERFORM DISPLAY_DATA.
form GET_DATA .
SELECT MATNR
WERKS
FROM MARC
INTO CORRESPONDING FIELDS OF TABLE IT_FINAL
WHERE MATNR IN S_MATNR.
IF IT_FINAL[] IS NOT INITIAL.
SELECT ART
MATNR
WERKS
FROM QMAT
INTO CORRESPONDING FIELDS OF TABLE IT_QMAT
FOR ALL ENTRIES IN IT_FINAL
WHERE MATNR = IT_FINAL-MATNR
AND WERKS = IT_FINAL-WERKS.
ENDIF.
SORT IT_FINAL BY
MATNR
WERKS
ART.
DELETE ADJACENT DUPLICATES FROM IT_FINAL COMPARING
MATNR
WERKS
ART.
endform. " GET_DATA
form PROCESS_DATA .
move it_final to i_final.
REFRESH IT_FINAL.
LOOP AT I_FINAL assigning <fs_fin>.
LOOP AT IT_QMAT INTO WA_QMAT where MATNR = <fs_fin>-MATNR.
P_werks = <fs_fin>-werks.
*REFRESH i_final.
IF sy-subrc eq 0.
<fs_fin>-ART = WA_QMAT-ART.
APPEND <fs_fin>-ART TO i_final.
ENDIF.
ENDLOOP.
ENDLOOP.
form DISPLAY_DATA .
W_FCAT-FIELDNAME = 'MATNR '.
W_FCAT-SELTEXT_M = 'MATERIAL NUMBER'.
W_FCAT-OUTPUTLEN = '18'.
APPEND W_FCAT TO I_FCAT.
W_FCAT-FIELDNAME = 'WERKS'.
W_FCAT-SELTEXT_M = 'PLANT'.
W_FCAT-OUTPUTLEN = '04'.
APPEND W_FCAT TO I_FCAT.
W_FCAT-FIELDNAME = 'ART'.
W_FCAT-SELTEXT_M = 'INSPECTION TYPE'.
W_FCAT-OUTPUTLEN = '08'.
APPEND W_FCAT TO I_FCAT.
" DISPLAY_DATA
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IT_FIELDCAT = I_FCAT[]
I_DEFAULT = 'X'
I_SAVE = 'A'
TABLES
t_outtab = i_final[].
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
input = WA_FINAL-MATNR.
endform.
FORM BUILD_FCAT USING FIELD TYPE SLIS_FIELDNAME
TEXT TYPE dd03p-scrtext_m
LENGTH TYPE dd03p-outputlen.
W_FCAT-FIELDNAME = FIELD.
W_FCAT-SELTEXT_M = TEXT.
W_FCAT-OUTPUTLEN = LENGTH.
APPEND W_FCAT TO i_FCAT.
CLEAR W_FCAT.
ENDFORM.
thanks & Regards
Smitha -
More than one output for a single line in an sql
Hi There,
I have a table like the following ,
A B
1 5
2 4
I want to output the following,
1-1
1-2
1-3
1-4
1-5
2-2
2-3
2-4
Is it possible to write a single sql statement to do this?
Thanks,
--JJSomething like this ->
satyaki>
satyaki>select * from v$version;
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Prod
PL/SQL Release 10.2.0.3.0 - Production
CORE 10.2.0.3.0 Production
TNS for 32-bit Windows: Version 10.2.0.3.0 - Production
NLSRTL Version 10.2.0.3.0 - Production
Elapsed: 00:00:00.20
satyaki>
satyaki>
satyaki>with jose
2 as
3 (
4 select 1 A, 5 B from dual
5 union all
6 select 2, 4 from dual
7 )
8 select j2.A, j1.B
9 from (
10 select rownum B
11 from jose
12 connect by rownum < B
13 ) j1,
14 jose j2
15 where j1.B <= j2.B
16 order by j2.A,
17 j1.B;
A B
1 1
1 2
1 3
1 4
1 5
2 1
2 2
2 3
2 4
9 rows selected.
Elapsed: 00:00:01.06
satyaki>Regards.
Satyaki De. -
Single Line $45. plan--gone as of March 13th
Looks like it was too good to be true. A smartphone line that had unlimited talk&text plus 250mb of data for very light users. Its been taken off the website,
as of 3/13. Now, you can only get the $60 1gb single line or new $75. 2gb single line. Both have unlimited talk&text. Low use customers have just lost that
option, unless the company brings it back. I hope they do. I missed it by one day.Typical of Verizon. A Byzantine price structure so complicated that even Verizon reps don't understand it, then Verizon refuses to honor misstatements made by their reps. I had three different issues trying to upgrade my lines and convert from a grandfathered family plan. Each time I got a different story, each time the next rep refused (or was unable) to honor the offer/information provided by the previous rep. Was told VZW would honor a sale on the Note 3 if I waited until a number port was complete, then they wouldn't (ironically I went to Best Buy and got the same deal, then Verizon reoffered the deal after I purchased from BB- too little too late), was told my employer discount would apply to the $45 250 MB plan, then after I selected that plan was told it wouldn't, was told I could switch between 250mb and 1 gb plan as needed when I traveled, well, the 250mb plan is already gone so that was wrong too.
I've been with Verizon for over 10 years as a customer and actually sold Verizon cell phones in my electronics store before that. VZW is rapidly overtaking Xfinity for worst customer service in the tech industry for the same reason- pricing and policies so confusing and misleading they couldn't honor them if they wanted to. And they obviously don't want to. -
DBMS_Output.put_line doesn't print in one single line
Hi People,
I am using 'DBMS_Output.put_line' in my procedure for the output. Here's the code:
DBMS_OUTPUT.put_line('LOGIT_T. Detail records for act:'||v_count_act||',Detail records for Bal:'||v_count_bal||',Updated records for act:'||v_updat_act||',Updated records for bal:'||v_updat_bal||',Total records for act:'||v_count_act||',Total records for Bal:'||v_count_bal);
When the procedure runs, it prints the output as shown below:
LOGIT_T. Detail records for act:619,Detail records for Bal:324,Updated records
for act:0,Updated records for bal:0,Total records for act:693,Total records for
Bal:410
As a result, when inserting this whole line into table, it only inserts the following text. Hence, ignores the rest of the text (table field width is 2000 bytes):
LOGIT_T. Detail records for act:619,Detail records for Bal:324,Updated records
Looks like, it is automatically wrapping the text to the next line. While I want the above output in a single line as shown below and to be inserted into my table the whole text:
LOGIT_T. Detail records for act:619,Detail records for Bal:324,Updated records for act:0,Updated records for bal:0,Total records for act:693,Total records for Bal:410
Any idea how to achieve this? Any parameter or setting I am missing here?
Hope I made sense above and clearly described my situation.
Thanks in advance guys!in sqlplus, you can use set linesize:
SQL> set serverout on
SQL> set linesize 10
SQL> exec dbms_output.put_line('This is a line of text that exceeds 10 characters');
This is a
line of
text that
exceeds 10
characters
PL/SQL procedure successfully completed.
SQL> set linesize 132
SQL> exec dbms_output.put_line('This is a line of text that exceeds 10 characters');
This is a line of text that exceeds 10 characters
PL/SQL procedure successfully completed. -
s
Hello Gurus, I have to read the attached text in which TDID and TDLINE need to read.Here i need to write logic like that in ALV output text of TDLINE related to TDID Htxt come in single line if there is more than 1 line used , same for NOTE and Itxt. Please help me out with some ogic to show data in alv output. I have used FM 'BBP_PD_CONF_GETDETAIL'. Thanks Sankil
TDID TDLINE HTXT Supplier Text HTXT Supplier Text NOTE Note NOTE Note ITXT Supplier Text ITXT Supplier Text NOTE Note NOTE NoteHello Sankil
This can be achieved by using event AFTER_LINE_OUTPUT and also search with keyword AFTER_LINE_OUTPUT to get more examples
Please go through the below tutorial.
http://www.****************/Tutorials/ALV/Wordwrap/Index.htm
Thanks -
How to print long raw text data in report output in single line?
Hi All,
I have a requirement where I need to print raw comma separated text data in the report output which end user will open in excel and can sort as required. I can not directly generate excel output.
Now there is huge set of data and each row from the report query should be get printed on single line, It should not get printed on the next line.
I tried to extending the report with 240 characters but still there are some text data which is getting printed on the next line.
Please share your view if someone has any solution on this issue.
Thanks in Advance.
ArunMake the report even wider. By default a report layout can be 10 pages wide. If you need more, change the "Max. Horizontal Body Pages" property, and extend your layout too.
IMHO, I wouldn't even use Reports to create a csv file. Utl_file or an sqlplus script that spools to a file are better options I think. -
HELLO...
I hope you experts out there can help me. Consider the following (2) Tables in MSSQL:
1. TENDERED --> Primary Key = DATE / DOC_NO / PAYMENT_SEQ_NO
DATE
DOC_NO
PMNT_SEQ_NO
PAYCODE_TYPE
AMOUNT
2. TENDERED_CR_CARD -->Primary Key = DATE / DOC_NO / PAYMENT_SEQ_NO
DATE
DOC_NO
PMNT_SEQ_NO
CR_CARD_NO_MASKED
CR_CARD_NAME
CR_CARD_EXP_DATE
These two tables are certainly related, based on their Primary Key values.
Now, consider the following data in those two tables:
DATE
DOC_NO PMNT_SEQ_NO
PAYCODE_TYPE
AMOUNT
03/10/2014 100001
1
CASH
100.00
03/10/2014 100001
2
CASH
-9.75
03/10/2014 100002
1
CASH
50.00
03/10/2014 100002
2
VISA
100.00
03/10/2014 100002
3
VISA
250.00
03/10/2014 100003
1
MC
125.00
03/10/2014 100003
2
AMEX
75.00
DATE
DOC_NO PMNT_SEQ_NO CR_CARD_MASKED
NAME
CR_CARD_EXP
03/10/2014 100002 2 4225******801289
MARY JONES 2016/08/31
03/10/2014 100002 3 4121******637442
JOHN DOE 2015/04/30
03/10/2014 100003 1 5428******971134
MIKE BAKER 2018/09/30
03/10/2014 100003 2 3732*****344756
LINDA LIU 2017/07/31
OK...so what we NEED...is a Combined, SINGLE RECORD Audit Report type query.
The resulting query should show, based on the Data from above, the SINGLE LINE represented in the Attached Spreadsheet.
NOTE...what's important to point out here..is that ONLY the 'CASH' Tender gets "summed"...EACH INDIVIDUAL Credit Card record MUST have its own Field...as represented in the corresponding Columns of the Spreadsheet (i.e. PMT_TYP_1, AMT_1, PMT_TYP_2,
AMT_2, and so forth).
PLEASE HELP! Any suggestions/advice would be most appreciated!
Thank You!...MarkI would not do this in SQL if I could possibly avoid it. Instead do it in the front end.
If you must do it in SQL, this is a dynamic pivot on multiple columns. Naomi Nosonovsky has a blog at
http://blogs.lessthandot.com/index.php/DataMgmt/DataDesign/dynamic-pivot-on-multiple-columns/ on how to do that. Look especially at her second example using the claims table. Of course, you must do some manipulation even before you do the multi-column
pivot, since you must first combine all the cash entries.
So one way to do it would be to build a temp table with all the entries you have except the cash entries combined into one payment sequence number. To do that you may need specifications that are not clear to me from what you have given us. For
example, if PMT SEQ 1 is VISA, PMT SEQ 2 is CASH, PMT SEQ 3 is VISA, PMT SEQ 4 is CASH, and PMT SEQ 5 is VISA, you want to combine the two cash payments. So they become PMT SEQ 2? If so, what happens to PMT SEQ 4 - is it left N/A or does
PMT SEQ 5 become PMT SEQ 4?
But once you have this temp table with the cash payments combined in the algorithm you need, then you can use Naomi's method to do the multi-column pivot. Note that Naomi uses the code
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_Name = 'Claims'
to get the column names from the permanent table Claims. To get the column names from a temp table use code like the following. To find the column names in a temp table named #MyTempTable, do
From tempdb.sys.columns
Where object_id = OBJECT_ID('#MyTempTable')
But as I say, if feasible, I would do this in the front end, not in SQL. T-SQL is a very good language for storing and retrieving data, not so good at formatting it.
Tom -
Query - Get data from the same table and field two times on a single line
I have prepared a query showing the bill of material. At each line each component will be a new line and I want to have the description of the material at the top (the master material composed of the component ones) and also the description of the component materials on the same line. This means that I should be able to use MAKT table 2 times on a single line of the query. I have used the query tool with SQ01 and SQ02 tcodes. How can I get the the description of the material at the top and also the description of the component material on a single line?
Thanks in advance for the answers.Yasar,
Any time you wish to use a table twice in an SQ01 query, you have to create an alias.
SQ02 > select the infoset, 'change' > go to Join definitions.
Select 'Alias' button. Create. Select your table name (such as MAKT) and define an alias, such as 'COMP_MAKT' for component descriptions.
Now you can insert the Alias table into your infoset just like it was a regular table, and use standard join method to join COMP_MAKT to your component material number.
Best regards,
DB49 -
Output the element in a single line
Hi all,
I encontered a problem when using castor xml tool to gengerate an xml file.
The parser that I an using is org.exolab.castor.parser=org.apache.xerces.parsers.SAXParser.
And I set org.exolab.castor.indent=true in the castor.properties
I got the following ouput:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE subscribers PUBLIC "...
"subscriber.dtd">
<subscribers provider="..."/>
<user name="..."
pass="..."/>
</subscribers>
What I expect is that the user element should be in a single line like following:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE subscribers PUBLIC "..." "subscriber.dtd">
<subscribers provider="..."/>
<user name="..." pass="..."/>
</subscribers>
What should I do to achieve this goal?
I found there is a property which might be useful, but I don't know exactely how to use it:
org.exolab.castor.features=
thanks in advanceHello,
I've found a solution:
We can use our own Serializer to control the output format:
In the castor.properities,
by default org.exolab.castor.serializer=org.apache.xml.serialize.XMLSerializer
I deprived this class and overrided all the constructors and the setOutputFormat method:
public void setOutputFormat(OutputFormat arg0) {
arg0.setIndenting(true);
arg0.setLineWidth(0);
super.setOutputFormat(arg0);
and it works fine
Thanks anyway
Message was edited by:
laseine -
hi I am having problem in formatting XML file which I generated with xmlelement() when I execute it gives me putput in a single line
is there any way that I got my output as a XML file HAS......That is expected behavior. PRETTY print(ing) is only needed for humans. XML Parsers don't need the XML to be pretty printed. If you open the XML file in a browser like Windows Explorer or Firefox, the browser will pretty print the output for you.
In all, the "single line" output is done because of PERFORMANCE reasons (lack of unneeded end of line and CTRL line breaks etc)
SELECT xmlelement("Employee Name", dummy) as "XML RESULT"
FROM DUAL;
<Employee Name>X</Employee Name>
SELECT xmlelement("Employee Name", xmlelement("SurName", dummy)
, xmlelement("LastName", dummy)
) as "XML RESULT"
FROM DUAL;
<Employee Name><SurName>X</SurName><LastName>X</LastName></Employee Name>
XMLSERIALIZE can pretty print the output if needed via INDENTation
SELECT XMLSERIALIZE(CONTENT xmlelement("Employee Name", xmlelement("SurName", dummy), xmlelement("LastName", dummy)) as CLOB indent SIZE=1 )
FROM DUAL;
<Employee Name>
<SurName>X</SurName>
<LastName>X</LastName>
</Employee Name> -
XML output - all tags in Single line?
Hi,
Scenario: HTTP----> XI --- > File(XML)/Proxy(abap).
Output XML file has the data in single line(all XML tags).
Now, issue with abap proxy which reads this XML file for sending attachment in email has length constraint(can not read if line length exceeds 255 chars).
Is there any option in XI, to print each pair of tags in each line(using carriage return or line feed?)
Please help.Mallik,
I do not think that this can be achieved in XML to XML (unless you can create a specific module and add to the module tab)
But if you create say a CSV or TXT file and use the <b>Content Conversion Parameters</b> option
Here you can specify the fieldSeparator to be 'nl'
<b>Input</b>
<?xml version="1.0" encoding="UTF-8"?>
<record>
<field1>f1</field1>
<field2>f2</field2>
<field3>f3</field3>
</record>
<b>Output</b>
f1
f2
f3
Here you have retained your data and each field is separated by a new line. Unfortunatley with this method you lose your XML tags
Regards,
Mike -
Output of select query in a single line
hi,
I want to know how to get the each row in a table to be printed in a single line.. Each row in the table will be of 1500 characters length..
ThanksIs there any limit to the value that we can specify
for linesize.. I read somewhere that the max value is
dependent on systemIn [url http://download.oracle.com/docs/cd/B19306_01/server.102/b14357/ch12040.htm#SQPUG085]the documentation, they don't talk about a maximum, but I saw there is one:
SQL> set linesize 1500
SQL> set linesize 32767
SQL> set linesize 32768
SP2-0267: linesize optie 32768 ligt buiten toegestane bereik (1 t/m 32767).Regards,
Rob. -
Trouble outputting digital waveform to single line
i want to output to a single digital line a digital pulse. my current attempt is to generate a digital waveform and then provide this as data to a digital line output. the vi runs, and the waveform appears as i want, but the digital line doesn't output anything? any help would be greatly appreciated!
Attachments:
digital pulse out.vi 32 KBHi
In reference to my previous post, you can just leave the inner for-loop, but you have to extract the 4 channels.
Just have a look at the picture.
Hope this helps.
Thomas
Using LV8.0
Don't be afraid to rate a good answer...
Attachments:
DigitalWaveform.png 6 KB
Maybe you are looking for
-
About a week ago I went to go online and my computer said I had no internet connection. Around that same time I noticed that my background on my desk top was back to the factory set background it came with, but I did not change it. That is the only
-
HT3702 How do I remove My credit card from this account?
How do I remove My credit card from this account?
-
IPhoto '08: library-sharing woes, library size = zero
Greetings everyone, Just got a new Aluminum iMac, running 10.5 and iPhoto 08, and I am trying to share a 5GB iPhoto library among several users. I have placed the library in a shared folder that all users have access to. I launched iPhoto and accesse
-
I can't open a PDF, make changes and save/save as in AAXIPro. It gives me a standard"...file is read only or may be in use by another...please save using a differnet name..." Very frustrating.
-
Accessing Discoverer...
Could anyone tell me how to connect to Discoverer via Oracle9iAS??