The sql tag has no usage guidance.
0
votes
1answer
30 views
How to return sequence value in sqlldr from unix shell
I have a test.txt file with column (Serialnumber,value).
test.txt:
"SEQ_IN_AMT.NEXTVAL",123123
"SEQ_IN_AMT.NEXTVAL",123114
here SEQ_IN_AMT is a sequence name create on Oracle. Now, when I load ...
1
vote
1answer
38 views
Pass shell variables to SQL statement
I want to pass shell variables to sql statement. Both shell script and SQL statement are present in the same script file.
I want the values of the variables retMonth, retLastDay and retPrvYear in the ...
1
vote
1answer
101 views
Passing multiple varibles to a script for SQL query
I have this script called info_code:
#!/bin/ksh
if [ $# -eq 0 ] ;then
echo "Enter code : \c"
read code
echo ""
else
code=$1
fi
code=`echo ${code} | tr '[a-z]' '[A-Z]'`
echo "select * from ...
1
vote
1answer
920 views
Redirect the output of a query in a file
How I can do to redirect the query result in a text file in sqlplus
I tried: start requete.sql > resultat.txt but it dosen't work
0
votes
1answer
41 views
Error not found [closed]
I wrote this script to encode / encrypt data from a sql query by changing the names of tables and fields (I played on the ASCII character codes).
#! /bin/bash
chr() {
[ "$1" -lt 256 ] || return 1
...
0
votes
3answers
1k views
Remove special characters in a text file
I have a text file which contains in each line a sql query.
For each line, I need to remove some special characters.
Expl: if I have:
select * from Users;
insert into Users values ...
0
votes
2answers
109 views
Awk one-liner to print column of SQL table?
Suppose I have table like:
This is first line
name minimum maximum config_value
----------------------------------- ----------- ----------- ------------
some ...
0
votes
0answers
60 views
How to read ms-sql file on Linux system
I'm debian user. I'm going to read *.sql file which was generated by MS-SQL database.
My system was below
release 7.8 (wheezy) 32bit
Kernel Linux 3.2.0-4-686-pae
GNOME 3.4.2
I'm looking for any ...
2
votes
2answers
161 views
An error of variable type?
I've an error that I don't understand, it seems that that the problem is that my parameters into the shell are not of the same type as what they are in my SQL Database.
For a better understanding: ...
-1
votes
1answer
48 views
To use several parameters that are in a .lst [closed]
I've a doc.lst that is :
23/02/2015 0 AAA
23/02/2015 0 AB1
23/02/2015 0 AC2
23/02/2015 0 FRR
23/02/2015 0 FPT
23/02/2015 0 PEI
23/02/2015 0 PEA
I would like to ...
0
votes
1answer
321 views
Loop for's result in a variable for sql query
I have this part of my script
for i in `cat ${RELLIST}`
do
for mr in `cat ${i}/DBA/install.list`
do
grep -i "'dba_" ${i}/DBA/sql/${mr}/*.tab 2> /dev/null | sed 's/^.*://'
#grep -i ...
0
votes
0answers
89 views
checkbox to automated sql scripts run
I want to provide a menu in a shell script that offers a check list of SQL scripts to run.
I actually need to execute the selected SQL scripts but it's about 20 of them and that make it hard to cover ...
2
votes
4answers
159 views
Tool for escaping all quotes in a string/file
I have a weird problem that I don't have a good way around.
My company, because reasons, stores scripting code in a database table. Don't ask. Whenever I have to insert a new version of the code, I ...
0
votes
0answers
222 views
Disabling strict mode does not take effect from the config file
I am trying to disable the MySQL/MariaDB strict mode in the variable sql_mode. But it doesn´t work. My my.cnf in section [mysqld] got this line:
sql_mode="NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
...
0
votes
0answers
22 views
Oracle / sql : calculation one or more value within the same field
I want select statement to sum the amount of value
352+652+20+356 that come in the same filed without need PL/SQL .
[{Name:"account:account_1"&Value:352&New:256&CreditLimit:0}
...
0
votes
1answer
148 views
From Mysql query output to retrieve files in the file system and rename the files
I have to call a SQL query from bash that outputs 1000 rows of two columns
File_Path (Eg., /opt/files/dest/2.bin)
Name_of_the_file (Eg., fax attachment.pdf, invoice.docx... yes, there are spaces). ...
1
vote
1answer
450 views
Convert XML to SQL INSERT statements using the command line
Is there a way to convert XML to SQL INSERT using the command line, here is examples:
<something>
<somthingelse>lol</somethingelse>
</something>
would be
INSERT INTO ...
1
vote
0answers
124 views
How to run multiple queries in a KSH script
I have a KSH script that has one SQL Query and generates and emails output of the query in HTML format. I want to change the script so that it has three SQL queries and the last query generates and ...
0
votes
0answers
87 views
sql db from cpanel into phpmyadmin takes forever
As titles states, I just cant import my database from cpanel, I used cpanel to export it but i also went in cpanel directly to phpyadmin to export.
I want to import it on my new server , size is ...
-2
votes
1answer
49 views
unix oracle connectivity [closed]
Operating system : Windows8.1
i use Linux ubuntu using vmware
Today i have installed oracle database 11g release 2 in particular drive
i want to access database via linux/ubuntu
i able to ...
0
votes
1answer
3k views
SQLPLUS withing shell script loops
Hello I am trying to run a loop and get the details of a project. I have these projects in my work space. How do I loop over the SQL code?
#!/bin/bash
workspace=$(sudo locate -r '/workspace$')
...
0
votes
1answer
95 views
KSH script missinterpreting alias stored in SQL oracle DB
I have stored the path of my file in a table with as an alias (as the complete path was too long for the table's field). However, in my KSH script, when I am doing :
nomtmp=`sqlplus -S bla/bla ...
0
votes
1answer
355 views
What is the format of the data that must be fed to the freetds tool bsqldb?
I need help figuring out how to input my data to bsqldb. I have been looking for a manual or some examples or tutorial but I cant find anything online beside its command line help.
I am planning to ...
2
votes
2answers
102 views
A combination of uniq and agrep?
I have a file full of long SQL queries, one per line. I need to create a list of unique queries, but most of the queries include parameter values that make using an exact matching tool like uniq ...
0
votes
1answer
583 views
dovecot mysql-connection error because of special charater in config
I successful set up my Server with froxlor, etc. but now I get errros with my mail delivery Agent because I use a '#' in my mysql-pw. I tried to escape it with a '\' but it doens't seem to work. :(
...
4
votes
2answers
4k views
Insert to oracle table in a loop
Requirement: In one server in a directory multiple files are present. I need to read the file names and populate into a oracle table.
I have written the script like this, but its not working:
...
0
votes
2answers
2k views
How can I get sql queries to show in output file?
I tried executing set of queries from a shell script while capturing both input (SQL query) and output in the log file.
But the input query is not displayed along with output. Only the outputs are ...
1
vote
1answer
1k views
Error out shell script if plsql program fails
In the shell script, I am calling a PLSQL stored procedure
sqlplus -s <<EOF
$v_fcp_login
set head off feed off serverout on size 1000000
exec ...
2
votes
3answers
601 views
Adding breaks between every two words in bash
My Query is:
QUERY="SELECT 'Your Name:', FullName, 'Your Phone:', Phone, 'Email:', Email FROM Table1 JOIN WHERE EmpID=001;"
The output I get is
Your Name: Samanta Your Phone: 111-111-1111 Email: ...
1
vote
2answers
184 views
Can sed be used to generate a load file for my date lookup fact table?
I have an SQL fact table which is used for looking up a date and returning another date.
The table schema is as follows:
TABLE date_lookup
(
pk_date DATE,
plus1_months DATE,
plus2_months DATE,
...
4
votes
2answers
175 views
check patterns that don't exist in sqlite
I explained a similar situation with plain text files on Grep huge number of patterns from huge file. Many people there said I should, so now I'm migrating my data to a sqlite database:
I have a file ...
3
votes
1answer
490 views
An efficient filter for .sql files with just “INSERT INTO”
Several times I've found myself working on data that has been exported to .sql files that I want to process rather than import into a database.
I'm only talking about "pure data" sql files. Ones that ...
3
votes
2answers
7k views
Replace all occurrences of a character in a variable using korn script
Part of the Korn script I am writing requires that I replace all occurrences of the ' character with two occurrences (''). I am trying to log some SQL that I am generating in this script to a column ...