- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- Re: SQL Select on ORACLE
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-09-2009 04:13 AM
тАО11-09-2009 04:13 AM
Hello all,
Hope I can ask in this room.
I'm driving crazy with the following SQL problem.
I would like to perform a simple select with many fields like:
SQL> select field1,field2,field3,field4, from table;
Since this is only an example (normally I need at least 20 fields), I would like to separate the result with a symbol like .,- (not matter witch symbol).
This because for me will be much simple to export on excell.
Is there a way to separate the result with a symbol?
This is what I have on OpenVMS 8.3.1H1
SQL> sho ver
Current version of SQL is: Oracle Rdb SQL V7.2-100
Underlying versions are:
Database with filename DB_log
Oracle Rdb V7.2-100
Rdb/Dispatch V7.2-100 (OpenVMS IA64)
Regards
Luca
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-09-2009 04:50 AM
тАО11-09-2009 04:50 AM
Re: SQL Select on ORACLE
have you tried
select field1 || ',' || field2 || ',' || field3 from table;
Regards,
Duncan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-09-2009 06:54 AM
тАО11-09-2009 06:54 AM
Re: SQL Select on ORACLE
And while using for example "SET COLSEP ," is a convenient way to quickly generate a CSV file, it is rarely adequate. Notably folks typically want trimmed spaces and double quoted strings to protect against commas within the columns.
So the typical solution often becomes the manual concatenation with a seperator as Duncan outlines.
You may need a PRINT to get a proper header line.
I suppose you could also play with the EDIT_STRING clause on columns in a view to use ',XXXX'. That'd be tedious.
Personally I'd look into postprocessing the standard fixed-column output with a tool like TPU or PERL for format it just the way I'd like it. It is tedious again and worse, it spreads the knowledge of the query and columns across multiple files, so they could get out of sync.
Perl has several module to help read/write CSV files. For example:
http://search.cpan.org/~tilly/Text-xSV-0.21/lib/Text/xSV.pm
fwiw,
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-10-2009 01:53 AM
тАО11-10-2009 01:53 AM
Re: SQL Select on ORACLE
Thanks all,
but if I use:
select field1 || ',' || field2 || ',' || field3 from table;
I got as error:
%SQL-F-UNSNUMXPR, Unsupported numeric expression
What does it mean??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-10-2009 01:59 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-10-2009 03:43 AM
тАО11-10-2009 03:43 AM
Re: SQL Select on ORACLE
select field1, "||" , field2 , "||" ...
Is the solution.... Thanks to all!!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-10-2009 03:44 AM
тАО11-10-2009 03:44 AM
Re: SQL Select on ORACLE
Closing Thread and assign points!