Search notes:

SQL*Plus: Run SQL scripts from the command line

The @ symbol can be used on the command line when invoking SQL*Plus to start an SQL script file:
$ sqlplus usr/pw@db @script.sql

PowerShell

Highlight warnings and errors

In PowerShell, it is possible to pipe the output of into a pipeline that embeds the text error or warning into ANSI escape sequences so that these two words are highlighted:
sqlplus rene/secretGarden@Ora19 `@script | foreach-object { $line = $_; $line = $line -replace '^(error|warning).*|^SP2-', "$([char]27)[38;5;9m$line$([char]27)[0m" ; $line }
Note: in the example above, the @ before the script name must be escaped with the back-tick (PowerShell's escape character).
See also writing colored output from SQL Plus.

Execute a single statement

The following example executes a single SQL statement by piping it into the SQL*Plus executable. The statement is followed by a new line (`n) and exit so that sqlplus returns to the shell again:
PS> "grant select on customer to sales;`nexit" | sqlplus [admin]@db

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1759561894, '216.73.216.149', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/databases/Oracle/SQL-Plus/start/run-SQL-script-from-command-line(53): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78