Re: OUTPUT ... and File Layout
Posted in 2003
Great !!!! Unload just work like any thing ... No fuss of sed , awk ...
"Jonathan Leffler" <jleffler@earthlink.net> wrote in message
news:3ECCF458.9050606@earthlink.net...
> John Carlson wrote:
> > On Thu, 22 May 2003 14:27:24 +0200, "Dirk Moolman"
> > <DirkM@mxgroup.co.za> wrote:
> >
> > OUTPUT seems to dump data so that the column width is no more than 80
> > characters. I was able to change OUTPUT TO to UNLOAD TO. Only
> > cleanup required would be to cleanup the "pipe" delimiters.
>
>
> UNLOAD TO FILE DELIMITER ';' SELECT ...>
> and omit the semi-colon from the string literal.
>
> No sed needed.
>
> Alternatively, try SQLCMD -- it behaves itself the way you want
> anyway. And you could do:
>
> output '/tmp/my.file';
> delim ';';
> select ....;
> output '/dev/stdout';
> input '/tmp/my.file';
> !rm /tmp/my.file
>
>
> >>I am generating a script using an unload - actually an output statement:
> >>
> >>output to med_h.sql without headings
> >>select unique "update statistics high for table"||trim(tabname)||"("||trim(coln
> >>ame)||") distributions only;"
> >
> >>from systables a, syscolumns b, sysindexes c
> >
> >>where a.tabid = b.tabid
> >>and b.tabid = c.tabid
> >>and b.colno = c.part1
> >>and a.tabid > 99
> >>and tabtype = "T"
> >>
> >>
> >>
> >>The problem is that, the lines are too long and get cut in half, for
example
> >>
> >>update statistics high for table zzz_cont_contrib(serial_no) dist
> >> ributions only;> >>(2 separate lines)
> >>
> >>
> >>
> >>and this gives me syntax errors. Is there an easy way to generate these
lines so that they are actually one line inside the output file ?
>
>
>
>
> --
> Jonathan Leffler #include <disclaimer.h>
> Email: jleffler@earthlink.net, jleffler@us.ibm.com
> Guardian of DBD::Informix v2003.04 -- http://dbi.perl.org/
>