Questions tagged [sql]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
54 views

How to run multiple line sql from text file

a file.txt have a multipe sql update. update table1 set meta_url = replace(meta_url,'test1.jpg','test1.gif'); update table1 set meta_url = replace(meta_url,'test2.jpg','test2.gif'); update table1 set ...
0
votes
1answer
16 views

How to fetch Data of Previous date in shell script?

Kindly refer the script below. #!/usr/bin/bash #scirpt to connect with db master_db_user='' master_db_passwd='' master_db_port='3306' master_db_host='' master_db_name='uppcldashboard' Now=$(date +"...
0
votes
1answer
8 views

Dynamic date in sql query shell script

Okay kindly refer the below code then I'll put my question. #!/usr/bin/bash #scirpt to connect with db master_db_user='root' master_db_passwd='123' master_db_port='3306' master_db_host='localhost' ...
0
votes
1answer
29 views

how to get dynamic variable in a query of a shell script [duplicate]

The last piece of my script is only pending. kindly refer to the code below. master_db_user='root' master_db_passwd='123' master_db_port='3306' master_db_host='localhost' master_db_name='...
0
votes
1answer
12 views

How do I write SQL to fetch strings that begin with % in Oracle?

Could someone please assist on how to fetch the data in SQL for all the strings starting with %%string? I tried below to escape %% but it didn't work SELECT * FROM Tablename WHERE host LIKE ‘[%][%]%’...
0
votes
0answers
21 views

Convert 2 HTML file which is output from SQL query into 1 main HTML output file in shell script

In shell script, I used 2 different SQL query & output of these 2 files in HTML format like (eg- ab.html, cd.html). Before DML operation 1 SQL query will run then after DML operation another query ...
1
vote
1answer
51 views

Convert 2 HTML file output from SQL query into 1 main HTML output file in shell script

In shell script, I used 2 different SQL query & output of these 2 files in HTML format like (eg- ab.html, cd.html). Shell script as -> #/bin/ksh ab=$(SQLPLUS -s <username>/<password>@...
1
vote
1answer
29 views

Failed to find package in third party repository

I'm new to debian & linux, and I want to know how to download packages from third party repositories. Specifically, I want to download a Microsoft SQL driver into a docker container (guide). ...
0
votes
1answer
37 views

How to get result of SQL query in shell script with same format that when we run on Oracle SQL developer/Toad/PLSQL developer

In shell script I am using SQL query. #/bin/ksh var=$(sqlplus -s <user>/<password>@DB <<EOF set heading on set trimspool off set linesize 200 set feedback ...
0
votes
2answers
38 views

sqlplus doesn't work in Crontab

/oracle/GR1/121/bin/sqlplus / as sysdba <<EOF >> $LOGFILE whenever sqlerror exit sql.sqlcode; set echo on; set serveroutput on; STARTUP; EXIT EOF Already tried it with the path, but it ...
0
votes
4answers
216 views

Shell script to append single quotes and commas

I have a file named input.txt: $cat input.txt This is sample Input file To execute sql statement I need output like below assigned to a variable: X=('This is sample', 'Input file', 'To execute sql ...
0
votes
0answers
20 views

List all crowd users in DB without the root or write access credentials

Hi I want to run a query on the Crowd DB with a read permission access. However, I ran a query on my Linux CLI to get the list of all active users with write access credentials, whereas I want to use ...
0
votes
0answers
35 views

Extract and combine values from an SQL dump

I have several large SQL dumps with very long lines, including one containing a version & subversion of the database in a long INSERT statement, formatted like this: INSERT INTO `table` VALUES (.....
0
votes
0answers
234 views

How to draw HTML table having contain result of SQL query and send to mail in Shell script

I want to draw HTML table contain record of SQL query and send to mail in shell script. Here is the shell script:- #!/usr/bin/ksh out=$(for id in 1 2 3 4 do sqlplus -s <user>/<...
0
votes
0answers
266 views

SqlState 24000, Invalid cursor state - Sqlcmd - CentOS

I have a problem when restoring a database, when running the query, this throws me this error .. Cannot open backup device '/var/opt/mssql/backup/RespaldoQualitz.bak'. Operating system error 2(The ...
0
votes
1answer
32 views

string substituton for match pattern

I have an SQL file of 170GB. I am trying to restore it on AWS RDS but i am not able because of keyring encryption is enabled on the file. I can't edit it using vi because it's causing my session ...
0
votes
1answer
604 views

Sybase query: save output to a file

I´ve created the following script: #!/bin/bash isql -U databasename_dba -P password -b <<EOF! select quantity, date from name_table where numer_id="1234" go quit EOF! ...
0
votes
1answer
189 views

To print log file with out put of cron job scheduled for a sql block - with Date and time (all the executions of cron)

I have a shell script which executes a pl/sql block, I'm printing output to output file but it's not keeping old information and not displaying time and date when the script was executed. My script ...
0
votes
1answer
52 views

How to extract Oracle DML (insert,update) queries from a dump file?

Example: $cat data.txt SCN THREAD OPERATION ID OBJECT ID OBJECT NAME REPLICATE OPERATION SQL ------------- ------- ------...
1
vote
1answer
677 views

Manjaro MySQL - mariadb.service fails when trying to start

When trying to start MariaDB with systemctl status mariadb, I get: ● mariadb.service - MariaDB 10.3.15 database server Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor ...
1
vote
3answers
53 views

Prevent Script from Inserting Space in File Name

I have an Oracle database table that is storing the full path and name of a file in a table column. In a SQL client I can run: select file_name from table where request_id=12345 and I will get this ...
1
vote
3answers
77 views

Search for a dynamic pattern in a file in a file and replace it with variables

I have written the below commands that will generate three different shuffled vales A=`echo 'abcdefghijklmnopqrstuvwxyz' | sed 's/./&\n/g' | shuf | tr -d "\n"` B=`echo '...
0
votes
1answer
69 views

Postfix: Whitelist all entries in address book

my postfix currently rejects emails that are potentially SPAM. Howver, some of my contacts have servers that are not correctly configured and I want to avoid rejecting their email. ...
0
votes
1answer
90 views

Forgot sql password for a certain user (debian)

I have two sql users on my sql server: root and bob. I know the root password, but I forgot bob's password. How can I view/reset bob's password?
0
votes
2answers
1k views

Adding headers to a CSV

I have an SQL command which fetches you an output like 70 138 200 This is stored in a csv and I have added headers to it but appears like A,B,C 70 138 200 I wanted it to look like A 70 B 138 C ...
1
vote
1answer
209 views

PhpMyadmin times out with small SQL file

I am trying to upload bump to phpmyadmin, which has has only 2MB but it has 12 thousand lines. I always get this error: Service Unavailable The server is temporarily unable to service your request ...
0
votes
1answer
614 views

make json from SQL query output

I have this query: select hostname,size from tableinfo output is like this: hostname size ------------------------- ----------- host1 28 host2 ...
-1
votes
4answers
2k views

SQL operation on csv file using bash or shell

This is my input file 0164318,001449,001452,001922 0164318,001456,001457,001922 0842179,002115,002118,001485 0846354,001512,001513,001590 0841422,001221,001224,001860 0841422,001227,...
15
votes
2answers
1k views

How does this shebang that starts with a double hyphen (--) work?

I have found the following kind of shebang in the RosettaCode page: --() { :; }; exec db2 -txf "$0" It works for Db2, and a similar thing for Postgres. However, I do not understand the whole line. ...
0
votes
1answer
220 views

How to compile a “.pc” file on Debian 9?

I need to compile a Pro*C - .pc file on Ubuntu. So far what I have realised is that I need a Pro*C compiler to translate the Pro*C - .pc file into pure / standard C code.  But I need to have Oracle ...
0
votes
1answer
216 views

Use sed to prefix and suffix multiple strings per line

I have a .sql file with some 15,000,000 INSERT commands on each line, which look something like this: INSERT INTO tableName (col1,col2,col3,col4,col5,col6,col7,col8) VALUES ('Jan 7 2018 12:33PM', 'R'...
0
votes
1answer
228 views

Incorrect syntax error in unix script while using if exists command (sybase as database)

I have the below script presenting me the following error: isql -U$DBLogin -PDBPAss -S$DBName -e <<! use $db go if exists (select 1 from syscolumns where id = object_id('Main_table') and ...
0
votes
1answer
535 views

Installing Oracle SQL Developer in Arch

I've spent >3 hrs trying to figure this out. I've done both methods shown in the wiki. Both seem to have worked fine. When I search I can't find any newly installed software with any name like "...
-2
votes
1answer
112 views

Delete remotely oracle schema using shell script [closed]

I have a remote instance like database-ora12 with existing user tester / password and SID=orac How I can delete remotely database or schema from this system for this user using shell script without ...
0
votes
1answer
196 views

REGEX search & replace with sed or other command

I have a big SQL file with content like [code language="bash"] git checkout master git pull origin master ... [/code] Lorem ipsum dolor sit amet, consectetur adipiscing elitUt enim ad minim [code]...
-1
votes
1answer
47 views

What happens if I specify nonexisting join field(s) for one or both of the input files?

I have two files $ cat file1 c c1 b b1 $ cat file2 a a2 c c2 b b2 What happens if I specify nonexisting join field(s) for one or both of the input files? Why do the following outer joins generate ...
-1
votes
1answer
77 views

What does `join` do in terms of equijoin in SQL or operations in relational algebra?

join in coreutils reminds me of equijoin in SQL. join writes to standard output a line for each pair of input lines that have identical join fields. I am not very clear about what join does from ...
0
votes
0answers
635 views

How to update data of a field in an oracle table?

My table name: KEY_PARAMETER It consists two fields named SET_NO. and MES_VAL SET_NO. is fixed which doesn't change but my MES_VAL filed is getting changed is every on minute. My intention is to ...
0
votes
1answer
232 views

AWK Script to read some parameters from log file and Insert that data to Oracle DB table

I have a requirement to read some parameters from log file and then use this data in an Insert statement to create records in a a database table. Input is log file testapi.log which may consists of ...
0
votes
1answer
827 views

Split SQL file with multiple databases in it

I've recently received a SQL-dump file, but it contains multiple databases in it. Is there any tool I can use to easily split this up into multiple .sql files, one per database?
0
votes
1answer
2k views

pass a variable value as an input to an oracle sql file that is being called from a shell script

Wanted to know if it is possible to "pass a variable value as an input to an oracle sql file that is being called from a shell script" I am trying like this, but its not working: SQL file: set head ...
1
vote
2answers
58 views

Finding and extracting immediate characters

I have a file with some SQLs and I want to find out the fields that have cast by using shell scripting. For example, I have a file abc.txt with the below sql SELECT field1,field2,field3,field4,...
0
votes
2answers
976 views

SQLite3 Query storing IP address syntax error

I'm trying to run a sqlite3 query against a small DB to update a table. While the script is more complicated, for testing I set the following variables: DN=123 UP=123 downlocalip=10.1.2.3 ...
0
votes
1answer
898 views

DROP USER IF EXISTS syntax error in MySQL CLI

I use Ubuntu 16.04 with Bash and MySQL Ver 14.14 Distrib 5.7.21, for Linux (x86_64) using EditLine wrapper. I try to create a DB stack for a webapp (WordPress) directly from command line and I share ...
1
vote
0answers
672 views

Referencing dynamically created table names in Create statement written in shell script

I need to write a script to automatically generate a month end report. The generation process involved creating tables in database and then accessing them later in the same script to create another ...
0
votes
1answer
210 views

Running a Python that calls a SQL in BASH W10

Trying to run this Python file python pid_info.py 12345 which looks like #!/usr/bin/env python import subprocess import sys, getopt # add if -b or -e then look for username/email like etc... # ...
1
vote
1answer
31 views

ansi: two fast questions about this term

I'm a little confused about ANSI and sql. Is the ansi/sql relationship the same as posix/unix? Is sql language an ansi standard?
0
votes
2answers
274 views

how to import customers to dolibarr

I have a rough and ready table as: mysql> mysql> show tables; +----------------------+ | Tables_in_businesses | +----------------------+ | 2017july | +----------------------+ 1 row ...
0
votes
1answer
915 views

MySQL Select with function IN () with bash array

How can I do this with an array? (without storing the array as regular variable) VAR='String1 String2 String3' SELECT * FROM db.table WHERE xy IN ( ${VAR// /, } ); not working example: SELECT * ...
0
votes
1answer
78 views

Having trouble with sqlite3 ssh command (I am assuming bad quotes)

The following works great: ssh plxch1035.pdx.xxxxxx.com "sqlite3 /p/hdk/rtl/proj_data/shdk74/fe_data/ipci/ipci.db 'select * from tools'" When I want a specific tool row though: ssh plxch1035.pdx....