flags to suppress column output, # of rows selected in db2 sql in UNIX
Hello,
I am new to db2 SQL in unix so bear with me while I try to explain the situation. I have a text file that has the contents of the where condition that I am using for a db2 SQL in UNIX ksh.
Here is the snippet.
When executed I get several output files for each record selected from the two tables. The general content of each of the output files include the following
The question: Is there any flags that can be set while using db2 sql commands from a script to suppress printing of the column names, number of records returned, fix the size of the output records written to the flat files and be able to set inidividual column size of for each column specified in the sql statement?
For instance in oracle you can use something like, set heading off, set feedback off, set linesize 200, COL column_name format format_specifier etc.
If there are flags that can be set, how can I incorporate it in a shell script or is there a ini file that needs to be used?
Any help provided is greatly appreciated. Many thanks.
Jerardfjay
Hi,
I new to Unix and scripting. Following is my requirement. Can someone tell me whether its possible or not. Also please let me know how to proceed further if this is possible.
List of queries are stored in a file. For example, I have to run a query like this:
Select * from &XYZ where... (0 Replies)
Hi there,
I am trying to write a shell script as root on AIX 5.3 where I change user to db2inst1, connect to our db2 database, run a sql select query and export the result of the query to a file.
The code I have so far is as follows:-
#!/usr/bin/ksh
su - db2inst1 -c "db2 connect to... (0 Replies)
hi,
i am a new user in unix..and we have unix db2. i want to capture the no. of rows updated by a update db2 sql statement and redirect into a log file.
I've seen db2 -m...but not sure how the syntax should be. The update sql that I'm going to run is from a file...
Can you please share... (1 Reply)
This is for an Oracle journal import. I was using a pl/sql package and oracle API's. Oracle added invoker rights to their API's and now my package won't run. I didn't want to use their API's anyway. The only reason i was using pl/sql and the API's (just a package) was to utilize a cursor. How... (2 Replies)
Hi All,
Please help me out in executing the following db2 querry in unix
db2 "select AP_RQ_ACQ_INST_ID || ',' || txn_classifier || ',' || AP_RS_RESP_CD || ',' || (count(*) AS COUNT1) || ',' || (SUM(AP_RQ_TXN_AMT) AS TOTAL_AMT) from TXN_RECORD where
CREATE_TS > '2010-11-22 11:00:00.008645' ... (1 Reply)
Dear All,
I have a data file input.csv like below. (Only five column shown here for example.)
Data1,StepNo,Data2,Data3,Data4
2,1,3,4,5
3,1,5,6,7
3,2,4,5,6
5,3,5,5,6
From this I want the below output
Data1,StepNo,Data2,Data3,Data4
2,1,3,4,5
3,1,5,6,7
where the second column... (4 Replies)
Hi,
This may not be the right forum but i am hoping someone knows an answer to this.
I have to capture rows for a column that was deleted. How can i do that without having to write a select query?
delete from myschema.mytable where currentdatetimestamp > columnDate
this should delete 5... (4 Replies)
Dear All,
I am trying to write a Unix Script which fires a sql query. The output of the sql query gives multiple rows. Each row should be saved in a separate Unix File.
The number of rows of sql output can be variable. I am able save all the rows in one file but in separate files.
Any... (14 Replies)
Hello
I want to collapse a file with multiple rows into consolidated lines of entries based on selected columns as the 'key'.
Example:
1 2 3 Abc def ghi
1 2 3 jkl mno p qrts
6 9 0 mno def Abc
7 8 4 Abc mno mno abc
7 8 9 mno mno abc
7 8 9 mno j k
So if columns 1, 2 and 3 are... (6 Replies)
Hi Team
I am using DB2 artisan tool and struck to handle multi values present in columns that are comma(,) separated. I want to convert those column values in separate rows .
For example :
Column 1 Column2
Jan,Feb Hold,Sell,Buy
Expected Result
Column1 ... (3 Replies)
Discussion started by: Perlbaby
3 Replies
LEARN ABOUT DEBIAN
parse::dia::sql
Parse::Dia::SQL(3pm) User Contributed Perl Documentation Parse::Dia::SQL(3pm)NAME
Parse::Dia::SQL - Convert Dia class diagrams into SQL.
SYNOPSIS
use Parse::Dia::SQL;
my $dia = Parse::Dia::SQL->new(
file => 't/data/TestERD.dia',
db => 'db2'
);
print $dia->get_sql();
# or command-line version
perl parsediasql --file t/data/TestERD.dia --db db2
DESCRIPTION
Dia is a diagram creation program for Linux, Unix and Windows released under the GNU General Public License.
Parse::Dia::SQL converts Dia class diagrams into SQL.
Parse::Dia::SQL is the parser that interprets the .dia file(s) into an internal datastructure.
Parse::Dia::SQL::Output (or one of its sub classes) can take the datastructure and generate the SQL statements it represents.
MODELLING HOWTO
See <http://tedia2sql.tigris.org/usingtedia2sql.html>
Modelling differences from tedia2sql
o Index options are supported. Text is taken from the comments field of the operation, i.e. the index. A database specific default
value is used if the comments field is left blank. Consult the Output sub class' constructor.
o Type mapping is supported. A type mapping is a user-defined column name replacement. Unlike tedia2sql the type mapping is non-
recursive. Consult "t/data/typemap.dia" for an example.
o Preliminary support for Dia's database shapes is added.
o Table comments are used as table postfix options. This means per-table options (e.g. partitioning options) are supported on a per-
database level.
o backticks notation is supported for MySQL-InnoDB.
DIA VERSIONS
Parse::Dia::SQL has been tested with Dia versions 0.93 - 0.97.
Parse::Dia::SQL uses the XML "version" tag information in the .dia input file to determine how each XML construct is formatted. Future
versions of Dia may change the internal format, and XML "version" tag is used to detect such changes.
DATABASE SUPPORT
The following databases are supported:
DB2
Informix
Ingres
Oracle
Postgres
Sas
SQLite3
Sybase
MySQL InnoDB
MySQL MyISAM
Adding support for additional databases means to create a subclass of Parse::Dia::SQL::Output.
Patches are welcome.
AUTHOR
Parse::Dia::SQL is based on tedia2sql by Tim Ellis and others. See the AUTHORS file for details.
Modified by Andreas Faafeng, "<aff at cpan.org>" for release on CPAN.
BUGS
Please report any bugs or feature requests to "bug-parse-dia-sql at rt.cpan.org", or through the web interface at
http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Parse-Dia-SQL <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Parse-Dia-SQL>. I will be
notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc Parse::Dia::SQL
You can also look for information at:
o Project home
Documentation and public source code repository:
<http://tedia2sql.tigris.org/>
o RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Parse-Dia-SQL <http://rt.cpan.org/NoAuth/Bugs.html?Dist=Parse-Dia-SQL>
o AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Parse-Dia-SQL <http://annocpan.org/dist/Parse-Dia-SQL>
o CPAN Ratings
http://cpanratings.perl.org/d/Parse-Dia-SQL <http://cpanratings.perl.org/d/Parse-Dia-SQL>
o Search CPAN
http://search.cpan.org/dist/Parse-Dia-SQL <http://search.cpan.org/dist/Parse-Dia-SQL>
SEE ALSO
o <http://tedia2sql.tigris.org/>
o <http://live.gnome.org/Dia>
ACKNOWLEDGEMENTS
See the AUTHORS file.
LICENSE
This program is released under the GNU General Public License.
TERMINOLOGY
By database we mean relational database managment system (RDBMS).
METHODS
new()
The constructor. Mandatory arguments:
file - The .dia file to parse
db - The target database type
Dies if target database is unknown or unsupported.
get_sql()
Return sql for given db. Calls underlying methods that performs parsing and sql generation.
perl v5.14.2 2012-02-01 Parse::Dia::SQL(3pm)