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 10775 sr******@yahoo. com (Shuaib) wrote in message news:<12******* *************** ****@posting.go ogle.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********@magi cinterface.com (Ed prochak) wrote in message news:<4b******* *************** ****@posting.go ogle.com>... sr******@yahoo. com (Shuaib) wrote in message news:<12******* *************** ****@posting.go ogle.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 TABLE_NAME" I get 4 rows returned.
In Enterprise manager:
|
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, and some said it wasn't but it
was for older versions of Postgres).
Basically I would *love* to be able to do something like this:
SELECT some_id
|
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 a field containing the following value (extracted from Immediate Window):
?dtbSample.Rows(0).Item("COM_STARTDATE")
#5/8/2006 9:00:00 AM# {Date}
Date: #5/8/2006 9:00:00 AM#
(for better understand, consider this date as '2006/05/08')
|
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 than spans
multiple lines?
Example: In a CGI script, I'm reading the address field from an HTML
form. Almost always the person will press ENTER so they can enter a
second or third line. If I then want to write all the field values of
this form...
| |
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, created by XML file. I am taking one of
the datatable
from this dataset and want to filter on that datatable using Select()
method.
Now here the problem start, like when I pass multiple "And" clause in
|
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 =
(CurrencyManager)dgWork.BindingContext;
DataView xDV = (DataView)xCM.List;
|
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:" +
Object.ToString() );
public Object GetAccountNames(string User_Id)
{
//string AccountNames;
Object 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 I issue
the statement:
SELECT name FROM emp
I would like to get a single row output back comprising the following:
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |