I have created a shell script that reads line from text file and insert into DB table. I have used IFS to separate the line text. Looks IFS is splitting text properly but while passing one of the values that has special characters in it to query, it is giving weird issue. Below is my script looks like
Below is my text file data
when I run the script, output is coming as below
I really do not understand why it is showing output like this but I investigated and found that this issue is coming due to the parameter COMPANY in the query. It has special characters. If I remove and change to simple text then it is not giving this issue and record is inserting successfully. Please suggest if any solution.
Last edited by vgersh99; 10-30-2018 at 05:29 PM..
Reason: Code tags, please!
Hi,
When i execute the below statement , the value is not getting stored in the variable.
AnneeExercice=`sqlplus $LOGSQL/$PASSWORDSQL << FIN >> $GEMOLOG/gemo_reprev_reel_data_ventil_$filiale.trc
SELECT bi09exercice
FROM bi09_scenario
WHERE bi09idfiliale=UPPER('de')
AND ... (1 Reply)
Unix prompt
=========
echo "Enter the query"
read q
==========
User has entered :
SELECT * FROM employee
=====================
Now the problem starts..
echo $q
Output: SELECT "all files names in the PWD" FROM employee
================================================
... (5 Replies)
Hi,
I am passing an argument for the script and that argument values should exist in database.
bill_period_input="'""$1""'"
bill_period=`sqlplus uname/pwd@dbname <<eof!
set verify off
set heading off
set feedback off
select bill_period from bill_period_ref where... (4 Replies)
Hi ,
I used the below script to get the sql data into csv file using unix scripting.
I m getting the output into an output file but the output file is not displayed in a separe columns .
#!/bin/ksh
export FILE_PATH=/maav/home/xyz/abc/
rm $FILE_PATH/sample.csv
sqlplus -s... (2 Replies)
Hi Everyone,
Can anyone help me how do i call hash variable in to sql query in perl. Please see the script below
i have defined two Hash %lc and %tab as below
$lc{'REFF'}='V_RES_CLASS';
$lc{'CALE'}='V_CAP_CLASS';
$lc{'XRPD'}='V_XFMR_CLASS';
$tab{'V_RES_CLASS'}='V_MFR_SERS';... (6 Replies)
I used the following code
code
select * from tablename where columnname
Instead of printing the expected output it prints all the files in the present directory since there is a "*" in the code. Is there any way to overcome the problem?
Thanks
Ananth (2 Replies)
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)
Hi, this's Pom. I'm quite a new one for shell script but I have to do sql on shell script to query some information from database.
I found a concern to get a new line...When I run my script, it retrieves all data as wondering but it's shown in one line :(
What should I do? I'm not sure that... (2 Replies)
I have a postgres sql statement that is the following:
select age from students;
which gives me the entries:
Age
---
10
15
13
12
9
14
10
which is about 7 rows of data.
Now what I would like to do with this is use a shell script to create an array age. As a results... (3 Replies)
Discussion started by: JSNY
3 Replies
LEARN ABOUT DEBIAN
data::phrasebook::sql::query
Data::Phrasebook::SQL::Query(3pm) User Contributed Perl Documentation Data::Phrasebook::SQL::Query(3pm)NAME
Data::Phrasebook::SQL::Query - Query Extension to the SQL/DBI Phrasebook Model.
SYNOPSIS
my $q = $book->query( 'find_author' );
my $q = $book->query( 'find_author', 'Dictionary' );
DESCRIPTION
An extension to the SQL class to specifically handle the DBI interface for each query requested.
CONSTRUCTOR
new
Not to be accessed directly, but via the parent Data::Phrasebook, by specifying the class as SQL.
METHODS
sql
Get/set the current "sql" statement, in a form suitable for passing straight to DBI.
sth
Get/set the current statement handle.
args
Return list of arguments that will be used as bind parameters to any placeholders. Any given arguments will replace the whole list.
Returns list in list context, arrayref in scalar.
order
As for "args", but regarding the corresponding list of argument names.
The assorted "order_XXX" methods are supported as for "args_XXX".
dbh
Get/set the database handle.
PREPARATION / EXECUTING METHODS
execute
Executes the query. Returns the result of "DBI::execute".
Any arguments are given to "order_args" with the return of that method being used as arguments to "DBI::execute". If no arguments, uses
those already specified.
Calls "prepare" if necessary.
order_args
Given a hash or hashref of keyword to value mappings, organises an array of arguments suitable for use as bind parameters in the order
needed by the query itself.
prepare
Prepares the query for execution. This method is called implicitly in most cases so you generally don't need to know about it.
rebind
Rebinds any bound values. Lets one pass a scalar reference in the arguments to "order_args" and have the bound value update if the original
scalar changes.
This method is not needed externally to this class.
DELEGATED METHODS
Any method not mentioned above is given to the statement handle.
All these delegations will implicitly call "prepare".
SEE ALSO
Data::Phrasebook, Data::Phrasebook::SQL.
SUPPORT
Please see the README file.
AUTHOR
Original author: Iain Campbell Truskett (16.07.1979 - 29.12.2003)
Maintainer: Barbie <barbie@cpan.org> since January 2004.
for Miss Barbell Productions <http://www.missbarbell.co.uk>.
COPYRIGHT AND LICENSE
Copyright (C) 2003 Iain Truskett.
Copyright (C) 2004-2010 Barbie for Miss Barbell Productions.
This module is free software; you can redistribute it and/or
modify it under the Artistic Licence v2.
perl v5.10.1 2010-08-31 Data::Phrasebook::SQL::Query(3pm)