cancel
Showing results for 
Search instead for 
Did you mean: 

Using union in Execute SQL snap

clarrivey
New Contributor

I have an Execute SQL where I wan to add column names to my output file before adding the data. For example:
select ‘Last_Name’||chr(09)||‘First_Name’ from sys.dual
union
select rtrim(spriden_last_name) from spriden||chr(09)||select rtrim(spriden_first_name) from spriden
If I do this, I get an output of:
Alastname Afirstname
Blastname Bfirstname
.
.
.
Last_Name First_Name
.
.
.
Zlastname Zfirstname
when in fact, what I want is
Last_Name First_Name
Alastname Afirstname
Blastname Bfirstname
.
.
.
Zlastname Zfirstname

Anyone have a clue as to how to get this???

5 REPLIES 5

koryknick
Employee
Employee

@clarrivey - perhaps I’m missing the goal you are trying to achieve here. From your original post, it appears that you are trying to create a header record for your output with the data coming from the second query. If you are trying to write those results to a tab-delimited file, then the example I provided will work - just copy the query from the SQL Server Execute snap in my example to an Oracle Execute snap. This works because SnapLogic’s CSV Formatter can use the field names of the input document as the header record in your file, which is how I configured the example pipeline. Also notice that the CSV Formatter snap is setup to use the tab character (\t or \u009) as the Delimiter.