Returning an SQL result to a Shell script

Often it can be useful to return the result of a simple SQL*Plus query to a shell script variable, for example to check for a value before deciding wether or not to proceed. The syntax is actually pretty simple :

Using the & (ampersand) character in Oracle SQL*Plus scripts

It can be very frustrating when using Oracle SQL*PLus (sqlplus) to run a SQL script that contains an ampersand (&) character only to have the script stop mid-way through and ask you for a value :


  • oracle (8)
  • Mac OS (6)
  • Oracle (6)
  • SQL (5)
  • apex (4)
  • mac os (3)
  • iPhone (3)
  • script (2)
  • GIS (2)
  • map (2)