Home » Other » Client Tools » Delimited output from sqlplus (merged by CM) (pl/sql)
Delimited output from sqlplus (merged by CM) [message #445731] |
Wed, 03 March 2010 11:26 |
devi_vi
Messages: 10 Registered: March 2010 Location: bangalore
|
Junior Member |
|
|
hi all.,
i have a requirement to get a delimited output file by executing a select query.
For e.g, select id, name, age from customers;
i need the output as,
id,name,age
123,devi,23
34,abi,20
4900,infy,23
i tried select id||','||name||','||age from customers;
but am getting the following output....
id||','||name||','||age
123,devi,23
34,abi,20
4900,infy,23
But i want to remove those pipes inbetween the column name.... can some one help me in this....
i tried colsep also... but there am getting the output as.,
id,name,age
123, devi, 23
34, abi, 20
4900, infy, 23
some unwanted spaces in between...
but i want the output as this...
id,name,age
123,devi,23
34,abi,20
4900,infy,23
the query which am using is stored in a .sql file....
can someone help me in this....
|
|
|
|
|
|
|
Re: Delimited output from sqlplus (merged by CM) [message #445743 is a reply to message #445731] |
Wed, 03 March 2010 14:58 |
ora_baby
Messages: 89 Registered: May 2008
|
Member |
|
|
WITH tmp AS
(SELECT '123' ID, 'devi' NAME, '23' age
FROM DUAL
UNION ALL
SELECT '34' ID, 'abi' NAME, '20' age
FROM DUAL
UNION ALL
SELECT '4900' ID, 'infy' NAME, '23' age
FROM DUAL)
SELECT 'id' || ',' || 'name' || ',' || 'age' AS col1
FROM DUAL
UNION ALL
SELECT ID || ',' || NAME || ',' || age col1
FROM tmp
[Updated on: Wed, 03 March 2010 14:58] Report message to a moderator
|
|
|
|
|
|
|
|
Goto Forum:
Current Time: Sun Dec 22 06:19:42 CST 2024
|