Questions tagged [sqlplus]

SQL*Plus is a command-line interface for the Oracle RDBMS product. SQL*Plus questions should probably be also tagged with oracle.

SQL*Plus is a command-line interface for the Oracle RDBMS product. SQL*Plus can be installed as part of the Oracle database product, or as a separate client, as well as as an Instant Client.

SQL*Plus questions should probably be also tagged with .

While SQL commands can be run through SQL*Plus, the tag should be used for questions that relate specifically to the SQL*Plus tool (e.g., connection or formatting issues) and not for SQL statements where the use of SQL*Plus is incidental.

When asking questions regarding SQL*Plus, it is advisable to state the version of the client as well as the database version.

Useful links:

3440 questions
50
votes
2 answers

arrow keys are not functional in sqlplus

I find that the arrow keys don't work on the sqlplus console. For example if I press left arrow key, it shows like SQL>^[[B Does any solutions exist to solve this problem?
daizuozhuo
  • 1,747
  • 2
  • 13
  • 14
49
votes
14 answers

How to insert a string which contains an "&"

How can I write an insert statement which includes the & character? For example, if I wanted to insert "J&J Construction" into a column in the database. I'm not sure if it makes a difference, but I'm using Oracle 9i.
Andrew Hampton
  • 1,632
  • 3
  • 20
  • 29
48
votes
5 answers

How to display table data more clearly in oracle sqlplus

I want to be able to display the resulting data from a select in a pretty way, not all columns under others. Here is the way sqlplus displays my table data: But I want to show them as: Name | Address | Phone …
Nubkadiya
  • 3,285
  • 13
  • 40
  • 45
47
votes
2 answers

Suppress output of variables substitution in sqlplus

I'd like to suppress the output of such lines as the following ones old 9: AND FROMDAT <= TO_DATE('&duedate', 'YYYYMMDD') new 9: AND FROMDAT <= TO_DATE('20091031', 'YYYYMMDD') old 10: AND TODAT > TO_DATE('&duedate', 'YYYYMMDD') new 10: AND…
user321068
46
votes
4 answers

Oracle SqlPlus - saving output in a file but don't show on screen

Using SqlPlus for Oracle, how do I save the output of a query in a file but not show it on the terminal/prompt.
simplfuzz
  • 12,479
  • 24
  • 84
  • 137
46
votes
6 answers

Force index use in Oracle

I encountered this question in an interview and had no clue how to answer: There is a table which has a index on a column, and you query: select * from table_name where column_having_index="some value"; The query takes too long, and you find out…
Vijay
  • 65,327
  • 90
  • 227
  • 319
43
votes
2 answers

How to run Oracle query with begin/end in SQL*Plus?

I have created a query block with begin/end and want to run that in SQL*Plus. But how can I run it in the command line? Actually the code is from some blog and it is used for searching text in the database. ABC is the texts to be searched. set…
newguy
  • 5,668
  • 12
  • 55
  • 95
43
votes
1 answer

executing a .sql file in sql plus terminal

I have written couple of sql scripts in a text file and saved them with a .sql extension. I want to execute these scripts in the sql plus terminal without having to manually type the standalone sql scripts, but i'm struggling with it. If someone…
shashwatZing
  • 1,550
  • 1
  • 17
  • 24
41
votes
4 answers

insert a multiline string in Oracle with sqlplus

I have a SQL script that will insert a long string into a table. The string contains a new line (and this new line is absolutely necessary), so when it is written in a text file, the query is split to multiple lines. Something like: insert into…
Louis Rhys
  • 34,517
  • 56
  • 153
  • 221
41
votes
2 answers

How do I pass arguments to a PL/SQL script on command line with SQLPLUS?

How do I pass arguments to a PL/SQL script on command line with SQLPLUS? I can call my PL/SQL script like so, but the script requires arguments in order for it to succeed. How can I run sqlplus.exe so that I can pass arguments to the script? …
djangofan
  • 28,471
  • 61
  • 196
  • 289
40
votes
7 answers

Oracle: Import CSV file

I've been searching for a while now but can't seem to find answers so here goes... I've got a CSV file that I want to import into a table in Oracle (9i/10i). Later on I plan to use this table as a lookup for another use. This is actually a…
cr8ivecodesmith
  • 2,021
  • 5
  • 21
  • 30
40
votes
6 answers

Connect to sqlplus in a shell script and run SQL scripts

I have a .sql file, which is a bunch of oracle pl/sql commands and I want to create a shell script to run these commands. Suppose that user/pass@server is my credentials. What will be the shell script to do such a task?
Farshid
  • 5,134
  • 9
  • 59
  • 87
39
votes
3 answers

Remove Column Header into the Output Text file

I want to create a flat file (text file) of my query from Oracle SQL Developer. I have successfully created the text file using SPOOL, thru a script text file, but i want to remove the header of each column into my output. I am getting this…
Marvin Wong
  • 479
  • 2
  • 8
  • 11
39
votes
6 answers

How to install SQL * PLUS client in linux

I am working on AWS services. I have an ec2 ( centos ) instance. I need to configure SQL*Plus client on this centos machine. The server with whom I want to connect is at some remote area. The server version is oracle-se(11.2.0.2) How can I get the…
Megha Sharma
  • 2,235
  • 8
  • 27
  • 31
38
votes
17 answers

Is there a good alternative to SQL*PLUS for Oracle?

I am not a fan of using SQL*PLUS as an interface to Oracle. I usually use yasql, but it hasn't been updated since 2005 and can do with some improvements. A quick Google search shows yasql and SQLPal. I am using linux, so SQLPal is not an option. …
gpojd
  • 22,558
  • 8
  • 42
  • 71