08-17-2006
orcle query ans
Hi Bhagat,
U can use the following query to make connection to a oracle database and spool the reults
to a text file:--
sqlplus -s username@databse_string/password << EOF
whenever sqlerror exit sql.sqlcode;
whenever oserror exit FAILURE
set define off
set head off
set feedback off
set echo off
set pagesize 0
set pages 0
set linesize 200
set timing off
spool appropriate path/dummy.txt
UR QUERY GOES HERE
spool off
EOF
If u want to make only manipulations to databse without spooling the results to a any fimle,
dont put it with in SPOOL command.
Hope it works for u......
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi all,
I have a data like,
0,R001,2,D
this wants to be loaded into a oracle database table.
Pl let me know how this has to be done.
Thanks in advance (2 Replies)
Discussion started by: raji35
2 Replies
2. Shell Programming and Scripting
i have a file a.txt and following is only one portion.
I want to search <branch value="/dev36/AREA/" include="yes"></branch> present in between
<template_file name="Approve External" path="core/approve/bin" and </template_file>
where the no of lines containing "<branch value= " is increasing ... (2 Replies)
Discussion started by: millan
2 Replies
3. Shell Programming and Scripting
I have many pdf's scattered across 4 machines. There is 1 location where I have other Pdf's maintained. But the issues it the 4 machines may have duplicate pdf's among themselves, but I want just 1 copy of each so that they can be transfered to that 1 location.
What I have thought is:
1) I have... (11 Replies)
Discussion started by: deaddevil
11 Replies
4. Shell Programming and Scripting
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 (2 Replies)
Discussion started by: ken002
2 Replies
5. 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
6. Shell Programming and Scripting
Hi,
I want to access mysql query from database , for that i have tried the below code
#! /bin/bash
TABLE_NAME=database1
USER_NAME=root
IP_ADDR=111.20.9.256
somevar=`echo "select altid from alert where altid='2724'"| mysql -h $IP_ADDR -u $USER_NAME $TABLE_NAME `
echo $somevar
... (1 Reply)
Discussion started by: aish11
1 Replies
7. Shell Programming and Scripting
Hi,
I want to run below query on shellscript but having one problm.
ADV=$( mysql -h "$IP_ADDR" -u "$USER_NAME" "$TABLE_NAME" -BNe" SELECT ADV FROM indata where inid='$INSTRUID' and Date='$latest Date';" )
here Date column contans different below dates
2011-12-01... (11 Replies)
Discussion started by: aish11
11 Replies
8. Shell Programming and Scripting
Hi all,
Help needed urgently.
I am currently writing a shellscript to read data/record from a flat file (.txt) file, and import/upload the data to oracle database. The script is working fine, but it takes too long time (for 18000 records, it takes around 90 mins).
I guess it takes so long... (1 Reply)
Discussion started by: robot_mas
1 Replies
9. UNIX for Advanced & Expert Users
LOG_DIR=/app/rpx/jobs/scripts/just/logs
sendEmail()
{
pzCType="$1"; pzTitle="$2"; pzMsg="$3"; pzFrom="$4"; pzTo="$5"; pzFiles="$6"; pzReplyTo="$7"
(
echo "From: $pzFrom\nTo: $pzTo\nSubject: $pzTitle${pzReplyTo:+\nReply-To: $pzReplyTo}"
] && echo... (1 Reply)
Discussion started by: ankit.mca.aaidu
1 Replies
10. Shell Programming and Scripting
I have a problem with my shell script. I want to insert data from file to table1(empty) and then, compare table1 with table2 and update some fields.
The first part is correct, but the second part does not work. The only way it works is if after the first part I truncate table1 and run the script... (1 Reply)
Discussion started by: nika_mill
1 Replies
LEARN ABOUT DEBIAN
sql::translator::parser::dbi
SQL::Translator::Parser::DBI(3pm) User Contributed Perl Documentation SQL::Translator::Parser::DBI(3pm)
NAME
SQL::Translator::Parser::DBI - "parser" for DBI handles
SYNOPSIS
use DBI;
use SQL::Translator;
my $dbh = DBI->connect('dsn', 'user', 'pass',
{
RaiseError => 1,
FetchHashKeyName => 'NAME_lc',
}
);
my $translator = SQL::Translator->new(
parser => 'DBI',
dbh => $dbh,
);
Or:
use SQL::Translator;
my $translator = SQL::Translator->new(
parser => 'DBI',
parser_args => {
dsn => 'dbi:mysql:FOO',
db_user => 'guest',
db_password => 'password',
}
);
DESCRIPTION
This parser accepts an open database handle (or the arguments to create one) and queries the database directly for the information.
The following are acceptable arguments:
o dbh
An open DBI database handle. NB: Be sure to create the database with the "FetchHashKeyName => 'NAME_lc'" option as all the DBI
parsers expect lowercased column names.
o dsn
The DSN to use for connecting to a database.
o db_user
The user name to use for connecting to a database.
o db_password
The password to use for connecting to a database.
There is no need to specify which type of database you are querying as this is determined automatically by inspecting
$dbh->{'Driver'}{'Name'}. If a parser exists for your database, it will be used automatically; if not, the code will fail automatically
(and you can write the parser and contribute it to the project!).
Currently parsers exist for the following databases:
o MySQL
o SQLite
o Sybase
o PostgreSQL (still experimental)
Most of these parsers are able to query the database directly for the structure rather than parsing a text file. For large schemas, this
is probably orders of magnitude faster than traditional parsing (which uses Parse::RecDescent, an amazing module but really quite slow).
Though no Oracle parser currently exists, it would be fairly easy to query an Oracle database directly by using DDL::Oracle to generate a
DDL for the schema and then using the normal Oracle parser on this. Perhaps future versions of SQL::Translator will include the ability to
query Oracle directly and skip the parsing of a text file, too.
AUTHOR
Ken Y. Clark <kclark@cpan.org>.
SEE ALSO
DBI, SQL::Translator.
perl v5.14.2 2012-05-01 SQL::Translator::Parser::DBI(3pm)