How to echo text during SQL script execution in SQLPLUS
The prompt command will echo text to the output: prompt A useful comment. select(*) from TableA; Will be displayed as: SQL> A useful comment. SQL> COUNT(*) ———- 0
The prompt command will echo text to the output: prompt A useful comment. select(*) from TableA; Will be displayed as: SQL> A useful comment. SQL> COUNT(*) ———- 0
I presume that you want a low-overhead method of knocking out queries, but want more functions than SQL*Plus provides? Why not use Oracle’s SQL Developer? It’s free. Install, make a new connection to your database, then just start typing a script. Press F5 to run it (or just the part of the script that you’ve … Read more
SQLPLUS COMMAND Skipped: set heading off That message is most likely because you are not executing it through SQL*Plus, but some GUI based tool. You are using SQLPlus command in SQL Developer. Not all SQL*Plus commands are guaranteed to work with SQL Developer. I would suggest you execute the script in SQLPlus and you would … Read more
Another solution you can use is SQL Developer. With it, you have the ability to import from a csv file (other delimited files are available). Just open the table view, then: choose actions import data find your file choose your options. You have the option to have SQL Developer do the inserts for you, create … Read more
For example: sqlplus -s admin/password << EOF whenever sqlerror exit sql.sqlcode; set echo off set heading off @pl_script_1.sql @pl_script_2.sql exit; EOF
Firstly, you will need to invoke your script like so: sqlplus.exe MYUSER/mypassword@HOST030 @refreshDataOnOracle.sql foo bar Instead of the OS redirection you will use the “@” symbol to indicate the file name to execute. You will also supply the script parameters on the command line. In the script you will refer to the parameters using &1, … Read more
If your filename is myQueries.sql, just type SQL>@/path/to/my/query/myQueries.sql SQL>/
You need to follow it with a slash like begin dbms_output.put_line(‘Hello World’); end; /
Right from the SQL*Plus manual http://download.oracle.com/docs/cd/B19306_01/server.102/b14357/ch8.htm#sthref1597 SET TERMOUT SET TERMOUT OFF suppresses the display so that you can spool output from a script without seeing it on the screen. If both spooling to file and writing to terminal are not required, use SET TERMOUT OFF in >SQL scripts to disable terminal output. SET TERMOUT is … Read more