Link to home
Start Free TrialLog in
Avatar of rayskelton
rayskelton

asked on

Oracle sqlplus select, how do I wrap double quotes around each selected column?

In a select statement of Oracle sqlplus, how do I wrap double quotes around each selected column? Is there a set command to use here?
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

don't use double quotes for the columns, but brackets:
also, you don't need the double quotes except for columns that have special characters or spaces in it...

Avatar of rayskelton
rayskelton

ASKER

Double quotes is a specification for output that I am spooling. I must wrap double quotes around each output field.
ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
alternatively, you might try SET COLSEP command from SQL*plus:
http://www.ss64.com/orasyntax/plus_set.html

I removed my set colsep command and added the following that works well. With the colsep, I was getting extra spaces after each column.

select '"' || column_name || '",',

I originally had this without the preceeding append but was hoping there was some type of set command to use. You are using coalesce(to_char() , so what does this do?
select chr(34)||column_name||chr(34) from ...
I obviously wasn't quick enough :-)