The sql tag has no usage guidance.
1
vote
0answers
10 views
display unix variable with dbms_output.put_line
I have a loop with while that is reading a file and then make a query of these value but when I'm trying to show a message with dbms_output.put_line it says me :
dbms_output.put_line(henry);
...
-2
votes
2answers
31 views
need help in shell shell scripting with oracle
I am trying to substitute a unix variable to a select statement, but I am getting the below error. What did I do wrong?
sqlplus "/ as sysdba" << EOF
spool /home/oracle/l.log
archive log list;
...
1
vote
0answers
25 views
Nice way to SQL query multiple CSV files?
I was looking for a way to traverse CSV files as relational database tables.
I did some research as nothing I found fit my bill of requirements in its entirety. I found several partially good options,...
2
votes
1answer
34 views
How to pretty-print CSV/spreadsheet from SQuirreL results?
I'm in a situation where I want to be able to take SQL query results from SQuirreL and paste them as ascii text into various forms and reports. With SQuirreL, I can export results as Excel or a CSV, ...
1
vote
1answer
14 views
Change column datatypes in Hive database
I am new to Hive database. Can someone please help me to change the datatype in Hive database? Below is a complete information about the same.
I have a database named "test". It has a table "name". ...
0
votes
0answers
25 views
how to split the spooling into smaller csv files
I am using a shell script like the following to spool two columns(fields) of a particular table into a csv file as follow:
#!/usr/bin/bash
FILE="emp.csv"
sqlplus -s scott/tiger@XE <<EOF
SET ...
0
votes
1answer
51 views
How to use sqlformat tool with pgAdmin
I am trying to add external SQL formatting utility to pgAdmin.
There is an option available in pgAdmin3 in Preferences -> Query tool -> Query editor called external formatting utility
I set up ...
1
vote
2answers
44 views
How to log PostgreSQL table data changes into syslog?
I have a program which uses these tables, and I want to add some additional functionality to its logging without modifying the program.
groups
------
id bigint not null
name character varying(100) ...
1
vote
1answer
68 views
Escaping bash variables before storing them in an apache hive database
I'm running a script file sqoop_import_ATM.sh and would like to store the logs in a SQL database.
First thing I did was to direct the logs into my own variable:
OUTPUT="$(/home/me/...
1
vote
0answers
32 views
Input return key in an SQL script
I have an SQL script which when run prompts me to input a value. If I don't input any value and press the Enter/Return key, it will select the default value and will pull all the records. I am trying ...
-1
votes
1answer
25 views
Pick Values From A Oracle Select Query
I have executed the below command (Part of a 2 step procedure required for password reset when we face the error ORA-28007).
SQL> select USER#,NAME,PASSWORD FROM user$ where name='TESTUSER';
...
3
votes
0answers
74 views
Tomcat, SQL, Kerberos, oh my!
I am working on setting up Tomcat 8.0.35 on Ubuntu 16.04 with Oracle Java (not openjdk) 1.8.0_91-b14 to use Kerberos authentication when authenticating to our Microsoft SQL database. The issue I am ...
1
vote
1answer
59 views
Output broken when appending output of sql query in ksh
I'm very new to scripting. I would like to add the output of the sql function given below to another variable for example:
month_end ()
{
mdate=$($SQLPLUS_HOME/sqlplus.exe -S $DBC << END
set ...
0
votes
0answers
66 views
How to connect SQL from VMWare?
I've windows 7 and I am using linux in vmware. Can I connect to my sql database which is running in my windows7 from linux?
0
votes
1answer
49 views
How to write down SQL query to get the data count of a table?
I have one table named FDR_DATA. There are following fields present in the table. Fields are: B1_NAME, B2_NAME, B3_NAME, ELEMENT, DATUM, WERT. Now I want to query the total number of data in this ...
0
votes
1answer
103 views
How to populate a database in sqlite3 using shell script while extracting data from files
I have many .dat files containing specific fields such as <Overall>, <Content>, <Cleanliness> all with a number next to them.
I have the code to be able to extract the data from ...
1
vote
2answers
78 views
Bash script - chomp parts out of a line
I have a data file (see sample three lines below) separated by pipes.
What I want to be able to do is to "chomp" out the fields and put them into variables. They are of pre-defined lengths. I want to ...
3
votes
2answers
144 views
vim: Force specific syntax via command-line argument
When I want to easily read my PostgreSQL schema, I dump it to stderr and redirect it to vim:
pg_dump -h localhost -U postgres dog_food --schema-only | vim -
This gives:
vim does not have a syntax ...
0
votes
2answers
177 views
Read SQL file by blocks in bash
I've been trying to do a string replacement type of operation in bash. It's not exactly as easy as it seems though, so here's the explanation:
Say you have an SQL file with multiple SELECT statements ...
0
votes
0answers
41 views
sqoop from MS SQL 2000
I have this sqoop problem with MS SQL server 2000 on my Cloudera setup, I tried to use jtds 1.3.1 to list the database it gave me the following error, not sure if anyone has experienced before:
#...
1
vote
1answer
42 views
How to read fields of a text block?
I would like to create sql inserts based on Radius log fields. For example, I have these two types of accounting logs and I'd like to convert each text block to an insert like below:
INSERT INTO ...
0
votes
4answers
100 views
Run multiple piped grep commands from a list in bash
As part of my security job, I analyze dozens of Google Chrome history files each day using sqlite3 over SSH.
There are a few dozen authorized "safe" sites each user is allowed to navigate to. For my ...
0
votes
1answer
78 views
unlang: SQL results to local variable
I'm trying to save a resultset of a SQL query in unlang. (First time with unlang for me, by the way, so please don't judge me for mistakes.)
The corresponding line is
Sql-Result-Set = %{expr: %{sql:...
1
vote
2answers
89 views
Complex sed Command with AND/OR/NOT
I have a bunch of php files which have many select commands.
In each query i want to insert a coloumn variable admin_id = '$admin_id'
i.e. if the query is select * from users where abc='xyz' and qwe='...
0
votes
0answers
373 views
How do I use grep to search for strings that exist both on single lines and multiple lines?
I am searching large amounts of SQL scripts for data dependencies, but due to variations in the scripts, I have encountered an interesting problem.
If I am searching for the word FROM, it only ...
0
votes
1answer
1k views
Cannot run test program while cross compiling - cross compiling Firebird
I've tried to compile firebird server for arm linux, with cross-compiler (it's choosen - it's working properly).
When using:
./autogen.sh --host=arm-linux-gnu
I get this error:
checking for ...
0
votes
1answer
64 views
Reading Multi Line SQL in UNIX
Currently, I am reading few queries from the below .sql file
--SOURCE TABLE NAME
--SOURCE QUERY
SEL COL1, COL2, COL3, COL4,
COL5, COL6, COL7 WHERE COL5 = '2015-11-04 16:24:00.000000' FROM ...
-2
votes
1answer
37 views
Physical Backup of Maria DB as a snapshot using LVM
I have a SQL database which I want to backup as a snapshot. I want to use LVM to do so, but I am not able to do it. Also my database is not stored in a LVM partition but its located in my /dev/sda2 ...
-1
votes
2answers
45 views
Putting output into SQL table
I am trying to convert the output of
ps awux
into 11 fields with the headers eliminated and then importing that output into an existing table in SQL.
0
votes
3answers
304 views
Use Command Line Argument and Variable with sed Inside Bash Script
I have a bash script that takes a bunch of command line arguments. The only one that matters in this context is the first, $1, which is a text file.
The header is very long, below are examples of ...
0
votes
1answer
110 views
removing all tabs in sqlplus
I can resolve this problem, but I don't understand, why happen this...
My task is: (in ksh)
1st step: Query a number from a DB with sqlplus,
2nd step: Format some text for a mail,
3rd step: send a ...
0
votes
1answer
302 views
How to delete the lines that starts with a specific word and end with a specific word
Eg:
CREATE TABLE COMM.ACL_ENTRY (
ACL_OID CHAR(18) FOR BIT DATA NOT NULL ,
USER_DESC_TYPE FOR COLUMN USER_00001 BIGINT NOT NULL ,
USER_DESC_OID FOR COLUMN USER_00002 ...
-1
votes
1answer
118 views
When to use SQL or NoSQL databases? [closed]
The title of this question pretty sums it up. I am interesting in learning when to use a SQL database, such as MariaDB, and when to use a NoSQL one, such as MongoDB. Is there a specific case where one ...
0
votes
1answer
251 views
FreeTDS missing encryption support to connect to MS SQL
I'm running a Gentoo Linux and I'm trying to connect to MS SQL via pyodbc using freetds.
I enabled the debug log in freetds. Now when I try to connect I'm seeing this:
18:13:00.841828 13523 (net.c:...
0
votes
1answer
88 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 this ...
1
vote
2answers
1k views
Pass shell variables to SQL statement
I want to pass shell variables to an 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 ...
1
vote
1answer
365 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
5k 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
48 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
12k 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 ('UR01','Kim','...
0
votes
2answers
294 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 ...
2
votes
2answers
190 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: I'...
-1
votes
1answer
57 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
753 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
185 views
checkbox to automated SQL scripts to 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 makes it hard to ...
2
votes
4answers
381 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
653 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
1answer
252 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
772 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
226 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 ...