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 3 10747 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 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 --
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
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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,
|
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...
|
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,...
|
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...
|
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...
|
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,...
|
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 =...
|
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:" +...
|
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...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
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,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
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: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |