web analytics
Using SQL*Plus in Oracle Options
codeling
Posted: Thursday, February 18, 2016 10:53:01 AM

Rank:Advanced Member
Groups: Member
Joined: 12/11/2015
Posts: 738
Points: 3102

SQL*Plus is an interactive and batch query tool that is installed with every Oracle Database installation. It has a command-line user interface, a Windows Graphical User Interface (GUI) and the iSQL*Plus web-based user interface.

SQL*Plus has its own commands and environment, and it provides access to the Oracle Database. It enables you to enter and execute SQL, PL/SQL, SQL*Plus and operating system commands to perform the following:

  • Format, perform calculations on, store, and print from query results
  • Examine table and object definitions
  • Develop and run batch scripts
  • Perform database administration

 

Sponsor
Posted: Thursday, February 18, 2016 10:53:01 AM
codeling
Posted: Thursday, February 18, 2016 11:00:05 AM

Rank:Advanced Member
Groups: Member
Joined: 12/11/2015
Posts: 738
Points: 3102

Starting SQL*Plus Command-line

The SQL*Plus executable is usually installed in $ORACLE_HOME/bin, which is usually included in your operating system PATH environment variable. You may need to change directory to the $ORACLE_HOME/bin directory to start SQL*Plus.

In the following examples, you enter the SQL*Plus command to login devdb with the user id and password:

c:\>sqlplus username/passwor@devdb
codeling
Posted: Thursday, February 18, 2016 11:03:07 AM

Rank:Advanced Member
Groups: Member
Joined: 12/11/2015
Posts: 738
Points: 3102

Execute a SQL script file in SQLPlus

To execute a script file in SQLPlus, type @ and then the file name.

SQL > @{file}

For example, if your file was called script.sql, you'd type the following command at the SQL prompt:

SQL > @script.sql
codeling
Posted: Thursday, February 18, 2016 11:45:39 AM

Rank:Advanced Member
Groups: Member
Joined: 12/11/2015
Posts: 738
Points: 3102

Run Oracle SQL script and exit from sqlplus.exe via command prompt

Question

I would like to run an Oracle script through SQL Plus via a Windows command prompt. The script does not contain an "exit" command, but I would still like SQL Plus to exit, returning control to the command prompt on completion of the script. My goal is to do this without modifying the script. Is this possible?

Solution

use this command in the batch file:

echo exit | sqlplus user/pass@connect @scriptname
Users browsing this topic
Guest

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.


© 2017 Digcode.com. All rights reserved.