i'm used a sql query in a unix script to get the information from table. but unable to extract the output which i need. Any help with logic will be greatly appreciated.
my sql query provide output some thing like this -
col1 col2 count
---- ---- ------
A B 10
c D 6
e... (8 Replies)
query sql using shell script, is it possible?
my friend told me to do a file.sql and link to my shell script, but can i query sql using shell script?
thanks in advance! (2 Replies)
Hi All,
I'm finding it difficult to format the query output that was returned in a shell script.
Actually i have one shell script which does some DB stuff and depending on the result it will do some more tasks. My question here is to format the query output returned by mysql.
Intitally my... (5 Replies)
Hi,
I need to connect to the database and retrieve two variables from the database and store them in a variable,out of these two variables I need to get lastdigit appended to the variable 1 retrieved and variable 2 with out any modification
in short
select var,data from usage;
o/p=... (1 Reply)
Hi Guys..
Need your help to format the output of my shell script.
I am using spool command to take out put in csv file.
below is my code. (for example)
col USERNAME for a15
col EMAIL for a30
col FULL_NAME for a20
col LAST_LOGIN for a40
col DATE_CREATED for a40
SPOOL 120.csv... (3 Replies)
hey , i am using this code to store value of a sql query and and then use
it in other query but after some time , but it is not working. please help
#!/bin/bash
val_1=$( sqlplus -s rte/rted2@rel76d2 << EOF
setting heading off
select max(stat_id) from cvt_stats;
exit
EOF
)
nohup... (5 Replies)
Hi,
I never did this before... what I want to do is execute a SQL query from a unix script and redirect sql query's output to a flat file (comma separated one) without the header info (no column names). I would also want not to print the query's output to the screen.
snapshot of my script:... (13 Replies)
I want to run sql query in shell script and output data save as delimited text (delimited text would be comma)
Code:
SPOOL_FILE=/pgedw/dan.txt
SQL=/pgedw/dan.sql
sqlplus -s username/password@myhost:port/servicename <<EOF
set head on
set COLSEP ,
set linesize 32767
SET TRIMSPOOL ON
SET... (8 Replies)
I am writing the following script to create the file v_out.txt.
sqlplus -s /nolog << EOF
CONNECT scott/tiger@orcl;
whenever sqlerror exit sql.sqlcode;
set newpage 0;
SET PAGESIZE 0;
SET ECHO OFF;
SET FEEDBACK OFF;
SET HEADING OFF;
SET VERIFY OFF;
SET LINESIZE 100;
set tab off;
set... (7 Replies)
I am trying to write SQL query output into a .csv file. But in the output columns are displaying in different lines instead of coming in one line.
Main Code shell script:
this is my code:
#!/bin/bash
file="db_detail.txt"
. $file
rm /batch/corpplan/bin/dan.csv... (6 Replies)
Discussion started by: sandeepgoli53
6 Replies
LEARN ABOUT DEBIAN
class::dbi::query
Class::DBI::Query(3pm) User Contributed Perl Documentation Class::DBI::Query(3pm)NAME
Class::DBI::Query - Deprecated SQL manager for Class::DBI
SYNOPSIS
my $sth = Class::DBI::Query
->new({
owner => $class,
sqlname => $type,
essential => @columns,
where_columns => @where_cols,
})
->run($val);
DESCRIPTION
This abstracts away many of the details of the Class::DBI underlying SQL mechanism. For the most part you probably don't want to be
interfacing directly with this.
The underlying mechanisms are not yet stable, and are subject to change at any time.
OPTIONS
A Query can have many options set before executing. Most can either be passed as an option to new(), or set later if you are building the
query up dynamically:
owner
The Class::DBI subclass that 'owns' this query. In the vast majority of cases a query will return objects - the owner is the class of which
instances will be returned.
sqlname
This should be the name of a query set up using set_sql.
where_clause
This is the raw SQL that will substituted into the 'WHERE %s' in your query. If you have multiple %s's in your query then you should supply
a listref of where_clauses. This SQL can include placeholders, which will be used when you call run().
essential
When retrieving rows from the database that match the WHERE clause of the query, these are the columns that we fetch back and pre-load the
resulting objects with. By default this is the Essential column group of the owner class.
METHODS
where()
$query->where($match, @columns);
This will extend your 'WHERE' clause by adding a 'AND $column = ?' (or whatever $match is, isntead of "=") for each column passed. If you
have multiple WHERE clauses this will extend the last one.
perl v5.12.4 2004-04-25 Class::DBI::Query(3pm)