I am typing in SQL queries (SELECT …) in a software tool which is based on an Oracle database.
Now, I would like to have in the first row of the resulting data the names of the columns. Otherwise, on exporting they are not included and I haven’t found any option which would allow the latter.
Does anyone have an idea how to include column names in the results of an SQL query?
I understand that there would be some problems if the column has values of type, say, Integer, but then I would probably transform everything simply (how?) to strings.
This would be a quick and dirty method for doing what you want. If a column was a non-varchar2 type then you’d need to cast the second
SELECTresult toVARCHAR2.See TO_CHAR for the conversion syntax.
If you really don’t want to see the “ordering” column then you could wrap the whole statement in another select that just selects the columns you want to see.
I’d have to agree with the comments though, you should ideally be able to export metadata through your IDE tool rather than a workaround.
Hope it helps…