Many of you either donot know or perhaps you are not aware of these since there is very less documentation available in google search for these
In general I use:
isql -U<user> -P<passsword> -D<dbname>
There are two ioptions in isql.
which are
-s Column separator.This wil separate columns with what ever character is followed by this option another option is (and probably very important): -w This will set the row width.By default is set to 80 characters and if the row length exceeds 80 characters, a new line is added in the console output.
for eg:
isql -U<user> -P<passsword> -D<dbname> -s ',' -w 65535
Below is the example. Here we can execute a sql query or a sybase query in a perl script. Please also note that I am not utilizing the DBI module provided by perl.
#!/usr/bin/perl use strict; use warnings; my $result = qx { isql -Uxx -Pxxxxxxx -Dxxxx <<EOF set nocount on select count(*) from XXX go exit EOF }; print $result; Above example show connecting to the sybase database. If you are using Oracle DB, then you can change the connection string: isql -Uxx -Pxxxxxxx -Dxxxx
to
sqlplus....
Note:
One strange thing over here never add spaces at the begining of the line after the statement isql.....<<EOF
the query will not be executed in such case you will go nuts trying to figure out why!