PAscal - 2015-08-25

-- get help
help ;

-- define output file in override mode with header
output csv C:\temp\outputfile.csv replace;
format csv delimiter ; header true quote false;

-- connect to first datasource and run SQL statement
connect HSQLDB - Embedded.TEST1@<null>;
select 'ENV1' as env,owner,type,name from tt;

-- change output file in append mode without header
output csv C:\temp\outputfile.csv append;
format csv delimiter ; header false quote false;

-- connect to second datasource and run SQL statement
connect HSQLDB - Embedded.TEST2@<null>;
select 'ENV2' as env,owner,type,name from tt;

-- connect to third datasource and run SQL statement
connect HSQLDB - Embedded.TEST3@<null>;
select 'ENV3' as env,owner,type,name from tt;

-- create a datasource "temp" using csvjdbc given in the lib directory
-- driver: org.relique.jdbc.csv.CsvDriver
-- url: jdbc:relique:csv:C:\temp?separator=;
-- display in grid format the result of the pivot table
connect CsvJdbc.temp@<null>;
output grid ;
SELECT
OWNER, TYPE,
SQLeoPivot(outputfile,ENV,count,NAME)
FROM
outputfile
GROUP BY
OWNER, TYPE;

-- all this can be run by typing
CTRL-A
CTRL-Enter

 

Last edit: PAscal 2015-11-03