Questions tagged [sqlplus]

an Oracle cli tool to access databases, mixing SQL statements with the PL/SQL language.

sqlplus (SQL*Plus) is a command-line tool used to access databases by mixing SQL statements with the PL/SQL procedural language. Both are Oracle products.

They allow scripts to use variables, loops, conditional clauses, functions, classes, and so on. Other proprietary databases provide similar features.

29 questions
4
votes
2 answers

SQLplus and Oracle, bad UTF-8 display

I have set export NLS_LANG=Italian_ITALY.UTF8 db is on UTF-8 SELECT * FROM NLS_DATABASE_PARAMETERS NLS_CHARACTERSET |AL32UTF8 But sqlplus displays bad ò à ì characters. select titolo from…
elbarna
  • 12,050
  • 22
  • 92
  • 170
2
votes
1 answer

Executing linux aliases from sqlplus

In sqlplus there is an option to execute standard shell commands, simply by prefixing them with '!'. Example: SQL>!ps -af returns expected processes. My question is, is there an option to execute user defined aliases in the same way? So far I tried:…
Z.Szymon
  • 143
  • 7
1
vote
1 answer

-bash: /usr/lib/oracle/19.10/client64/bin/sqlplus: No such file or directory

I'm trying to run Oracle Linux 9(aarch64) on M2 MacBook Air using UTM, so that I can develop my python application that is required to connect to Oracle Database 11g. Because the python app requires Oracle instantclient installed, I installed 3…
user53620
  • 121
  • 5
1
vote
1 answer

SQL*Plus version not printing in tempfile

I am trying to execute below Unix script to fetch the Oracle version from Windows command prompt using ssh command to connect to Unix terminal. #!/use/bin/ksh Freport=/tmp/test.txt cd /usr/oracle2/product/11.2.0/bin echo "Begin" > $Freport set…
Chakkara
  • 37
  • 6
1
vote
1 answer

Inserting into a Oracle table from a shell variable storing thousands of values

I'm trying to insert records into a column in Oracle where the values are passed from a shell variable. The variable itself stores pattern generated from a list of files. This pattern is generated on each iteration inside a for loop. The variable…
1
vote
1 answer

Shell script that starts sqlplus utility and executes a query, gathers output

I'm trying to do this: In sample.sh: #!/bin/bash sqlplus / as sysdba select * from dual; And just when I run this shell script, it opens sqlplus utility, but it cannot execute the next line that I have written. When I manually exit out of sqlplus,…
1
vote
1 answer

bind variable and shell scripting with sqlplus

I wish to execute DMLs using bind variable with shell scripts. For example, something like: #!/bin/bash SH_NUM=10 sqlplus -S test_user/test_pass <
Nir
  • 1,265
  • 7
  • 23
  • 34
1
vote
0 answers

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 temp tables. I managed to create the base table…
A.Bhargava
  • 11
  • 2
1
vote
1 answer

How to capture only the stderror in this bash script?

this is my scash script query="select * from blabla;" sqlplus64 -S /nolog <>errorLog.txt CONNECT username/pwd@domainName:1521/serviceName whenever sqlerror exit sql.sqlcode; $query …
1
vote
0 answers

Running SQLPlus Oracle Command as Root returns incorrect answer

I am trying to create a script that checks the usage of each disk in an ASMDISK group. I have my script setup on one node in each RAC cluster. It works on several of the servers without issue, but on two of them it is returning the incorrect…
1
vote
2 answers

Shell script : Redirect sql query output to a file

Inside a shell script, I have written below sqlq(){ result=`sqlplus -S sss/eee@sid < $1|grep -v '^$'` echo $result } echo "select * from emp" > q.sql sqlq q.sql I need to direct the output to a file. I have tried spool inside q.sql like below but…
Srikanth Yadake
  • 189
  • 2
  • 4
  • 11
1
vote
2 answers

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 the SQL statement. Below is the code. echo…
user2488578
  • 185
  • 2
  • 2
  • 7
0
votes
0 answers

sqlplus - read list of variables from flatfile to search in the DB

I am using sqlplus to connect to an Oracle DB via Linux command line. I would like to be able to read through a flatfile that contains a list of macro names I am searching for in the db. I would like for it to read each one, output the results to…
Joel
  • 1
0
votes
1 answer

Bind variables in terminal

Is it possible to request a variable directly in the terminal? For example, I want to use command cat , but I want the terminal to ask what file name to use. Just like in SQL plus I'm using bind variables for this. Is there any solution…
0
votes
1 answer

Unix command substitution when using sqlplud

Trying to invoke a sql file from unix shells script. ExecuteSql1.sh #!/bin/sh ## steps to get the connection and form it. result=`sqlplus -S ${connectURL} << EOF SET PAGES 0 lines 800 @ /sql/testQuery.sql ${LOGFILE} EOF` echo $result output of…
Tim
  • 103
  • 6
1
2