11-18-2010
Shell script to query Oracle table
Hi, unix gurnis
I need help for following requirement for writing a shell scritp.
log in to oracle database, query one table total records (select count(*) from table1), pass the return value to a file.
Thanks in advance
9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I would like to know how to update a table in Oracle database, if a command in one shell script either successfully completes or it fails.(like Y if its success or N if its a failure)
While the command is running,I am able to view the log file created in the Unix machine.After the command... (2 Replies)
Discussion started by: ann_124
2 Replies
2. Shell Programming and Scripting
Hi friends,
I have to do the following things :
1) there should be a shell script returning the returning the return code of the script. and i have to add some more details like on which machine is has run , at what time and other details and then using plsql i have to add a row to Oracle... (3 Replies)
Discussion started by: sveera
3 Replies
3. Shell Programming and Scripting
Hi friends,
i am having a variable declared in .profile.i am changing its value in a shell script and then i am connecting to oracle and then from there i am calling a .sql called update.sql
STATUS is the variable declared in the .profile
===============================
if
sqlplus <<END... (3 Replies)
Discussion started by: sveera
3 Replies
4. Shell Programming and Scripting
Hi Guys,
I'm new to this forum as well as to UNIX shell scripting.
I'm looking for a shellscript to query an Oracle database table and populate the result set of the query in a text file.
Could you someone help me out with a sample code?
Thanks,
Bhagat (7 Replies)
Discussion started by: bhagat.singh-j
7 Replies
5. Shell Programming and Scripting
hello
how to run shell script to excute oracle queries on remote db ?
i have tried as following
sqlplus -s user/password@remote_server "select query;"
but not working
also this one
sqlplus -s user/password@remote_server `select query;`
not working :(
i add this line to run another... (4 Replies)
Discussion started by: mogabr
4 Replies
6. Shell Programming and Scripting
Hi,
I have a requirement as below which needs to be done viz UNIX shell script
(1) I have to connect to an Oracle database
(2) Exexute "SELECT field_status from table 1" query on one of the tables.
(3) Based on the result that I get from point (2), I have to update another table in the... (6 Replies)
Discussion started by: balaeswari
6 Replies
7. Shell Programming and Scripting
Hi,
I want to write a shell script which will export data from oracle table .
I don't want to save that data . I want the queries .
Right now i am right clicking on the table and clicking on export as to my desktop .
Please let me know if any one have any idea . (2 Replies)
Discussion started by: honey26
2 Replies
8. Shell Programming and Scripting
Hi,
I need to query Oracle database for 100 users. I have these 100 users in a file. I need a shell script which would read this User file (one user at a time) & query database.
For instance:
USER CITY
--------- ----------
A CITY_A
B CITY_B
C ... (2 Replies)
Discussion started by: DevendraG
2 Replies
9. Shell Programming and Scripting
I need to run a SQL select query in Oracle database and have to capture the list of retrieved records in shell script. Also i would like to modify the query for certain condition and need to fetch it again. How can i do this?
Is there a way to have a persistent connection to oracle database... (9 Replies)
Discussion started by: vel4ever
9 Replies
LEARN ABOUT DEBIAN
anydata::format::htmltable
AnyData::Format::HTMLtable(3pm) User Contributed Perl Documentation AnyData::Format::HTMLtable(3pm)
NAME
HTMLtable - tied hash and DBI/SQL access to HTML tables
SYNOPSIS
use AnyData;
my $table = adHash( 'HTMLtable', $filename );
while (my $row = each %$table) {
print $row->{name},"
" if $row->{country} =~ /us|mx|ca/;
}
# ... other tied hash operations
OR
use DBI
my $dbh = DBI->connect('dbi:AnyData:');
$dbh->func('table1','HTMLtable', $filename,'ad_catalog');
my $hits = $dbh->selectall_arrayref( qq{
SELECT name FROM table1 WHERE country = 'us'
});
# ... other DBI/SQL operations
DESCRIPTION
This module allows one to treat the data contained in an HTML table as a tied hash (using AnyData.pm) or as a DBI/SQL accessible database
(using DBD::AnyData.pm). Both the tiedhash and DBI interfaces allow one to read, modify, and create HTML tables from perl data or from
local or remote files.
The module requires that CGI, HTML::Parser and HTML::TableExtract are installed.
When reading the HTML table, this module is essentially just a pass through to Matt Sisk's excellent HTML::TableExtract module.
If no flags are specified in the adTie() or ad_catalog() calls, then TableExtract is called with depth=0 and count=0, in other words it
finds the first row of the first table and treats that as the column names for the entire table. If a flag for 'cols' (column names) is
specified in the adTie() or ad_catalog() calls, that list of column names is passed to TableExtract as a headers parameter. If the user
specifies flags for headers, depth, or count, those are passed directly to TableExtract.
When exporting to an HTMLtable, you may pass flags to specify properties
of the whole table (table_flags), the top row containing the column names
(top_row_flags), and the data rows (data_row_flags). These flags follow
the syntax of CGI.pm table constructors, e.g.:
print adExport( $table, 'HTMLtable', {
table_flags => {Border=>3,bgColor=>'blue'};
top_row_flags => {bgColor=>'red'};
data_row_flags => {valign='top'};
});
The table_flags will default to {Border=>1,bgColor=>'white'} if none
are specified.
The top_row_flags will default to {bgColor=>'#c0c0c0'} if none are
specified;
The data_row_flags will be empty if none are specified.
In other words, if no flags are specified the table will print out with
a border of 1, the column headings in gray, and the data rows in white.
CAUTION: This module will *not* preserve anything in the html file except
the selected table so if your file contains more than the selected table,
you will want to use adTie() or $dbh->func(...,'ad_import') to read the
table and then adExport() or $dbh->func(...,'ad_export') to write
the table to a different file. When using the HTMLtable format, this is the
only way to preserve changes to the data, the adTie() command will *not*
write to a file.
AUTHOR & COPYRIGHT
copyright 2000, Jeff Zucker <jeff@vpservices.com> all rights reserved
perl v5.10.1 2004-08-17 AnyData::Format::HTMLtable(3pm)