473,385 Members | 1,769 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Suppressing newline during a SELECT returning multiple rows

Is there any way for Oracle (using standard SQL rather than PL/SQL) to
suppress the newline character when returning a list of rows.

For example, if I have a table EMP with several records. When I issue
the statement:

SELECT name FROM emp

I would like to get a single row output back comprising the following:

"john, james, jenny, jill, benny"

in other words, all names separated by the a comma followed by space.

Many thanks in advance for you help.

Shuaib
Jul 19 '05 #1
3 10745
sr******@yahoo.com (Shuaib) wrote in message news:<12**************************@posting.google. com>...
Is there any way for Oracle (using standard SQL rather than PL/SQL) to
by that I assume you mean using SQL*Plus versus some other ORACLE
client program (such as an ODBC client like ACCESS)?
suppress the newline character when returning a list of rows.
I do not think you can totally suppress it. In SQL*Plus there is a
option to set the line size. Look up the options in the SET command.
There is also an option to define the record separator character,
IIRC. If so, it too is an option to the SET command.
I would like to get a single row output back comprising the following:

"john, james, jenny, jill, benny"

in other words, all names separated by the a comma followed by space.

Many thanks in advance for you help.

Shuaib


The manual is your friend. (You likely just needed the right words to
look it up in the index, right?)

HTH,
ed
Jul 19 '05 #2
ed********@magicinterface.com (Ed prochak) wrote in message news:<4b**************************@posting.google. com>...
sr******@yahoo.com (Shuaib) wrote in message news:<12**************************@posting.google. com>...
Is there any way for Oracle (using standard SQL rather than PL/SQL) to


by that I assume you mean using SQL*Plus versus some other ORACLE
client program (such as an ODBC client like ACCESS)?
suppress the newline character when returning a list of rows.


I do not think you can totally suppress it. In SQL*Plus there is a
option to set the line size. Look up the options in the SET command.
There is also an option to define the record separator character,
IIRC. If so, it too is an option to the SET command.
I would like to get a single row output back comprising the following:

"john, james, jenny, jill, benny"

in other words, all names separated by the a comma followed by space.

Many thanks in advance for you help.

Shuaib


The manual is your friend. (You likely just needed the right words to
look it up in the index, right?)

HTH,
ed


Shuaib, what you really asking to do is to convert rows into columns.
Check the group archives looking for "pivot tables". There was a
couple of posts under the comp.databases.oracle.misc or server board
just yesterday on this subject. You can search the group archives via
http://groups.google.com if your normal newreader does not provide
access.

You can also check the asktom site: http://asktom.oracle.com. It has
writeup for performing this task using object types.

HTH -- Mark D Powell --
Jul 19 '05 #3
jdray
1
When I issue the statement:

SELECT name FROM emp

I would like to get a single row output back comprising the following:

"john, james, jenny, jill, benny"

in other words, all names separated by the a comma followed by space.
I've been searching all over the net trying to find a resolution to this very issue and can't find one that doesn't involve modifying the database with custom types or stored procedures. I'm running Oracle 9i, which is supposed to have a bunch of new string handling functions in it, but I can't find anything that tells me how to do something just like this using built-in functions.

T/SQL has this handy thing called "LIST" that evidently does exactly this. Oracle doesn't seem to have anything similar, at least not that I can find. Ideas?

thx

JD
Jul 21 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Monisha | last post by:
Hi, I need to get a list of columns and corresponding datatypes for the given table name. I am using the query: select a.name, b.type_name from syscolumns a,
9
by: Rowland Hills | last post by:
I have a table which is returning inconsistent results when I query it! In query analyzer: If I do "SELECT * FROM TABLE_NAME" I get no rows returned. If I do "SELECT COL1, COL2 FROM...
22
by: Christopher Murtagh | last post by:
Greetings, I'm trying to write a pl/perl function that will return multiple rows. I've looked all over the web and only found vague references as to how to do this (some said it was possible,...
6
by: ronchese | last post by:
Hi. I'm trying to make a criteria string to use in Select() method of a datatable, searching for a date, but it is apparently not working! In one of my tests, I have a datatable with 1 row and...
2
by: John Salerno | last post by:
If I read a string that contains a newline character(s) into a variable, then write that variable to a file, how can I retain those newline characters so that the string remains on one line rather...
4
by: Aryan | last post by:
Hi, I am having problem with DataTable.Select() method. I am using ASP.NET 2.0. I have DataSet which reads data from XML file using DataSet.ReadXML(). Now this dataset has various datatable,...
0
by: =?Utf-8?B?U3RldmU=?= | last post by:
C# I have a datagrid, and the users are able to select multiple rows and perform an action. This works fine, as I get the rows selected using something like this: CurrencyManager xCM =...
3
by: weird0 | last post by:
The given should return A,B that is two rows because both accountnames A and B have the same user_Id=1 but it is only returning A when I performed the op. MessageBox.Show("AccountNames:" +...
2
by: Shuaib | last post by:
Is there any way for Oracle (using standard SQL rather than PL/SQL) to suppress the newline character when returning a list of rows. For example, if I have a table EMP with several records. When...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.