Oracle query execution time

One can issue the SQL*Plus command SET TIMING ON to get wall-clock times, but one can’t take, for example, fetch time out of that trivially. The AUTOTRACE setting, when used as SET AUTOTRACE TRACEONLY will suppress output, but still perform all of the work to satisfy the query and send the results back to SQL*Plus, … Read more

sqlplus: error while loading shared libraries: libsqlplus.so: cannot open shared object file: No such file or directory

The minimum configuration to properly run sqlplus from the shell is to set ORACLE_HOME and LD_LIBRARY_PATH. For ease of use, you might want to set the PATH accordingly too. Assuming you have unzipped the required archives in /opt/oracle/instantclient_11_1: $ export ORACLE_HOME=/opt/oracle/instantclient_11_1 $ export LD_LIBRARY_PATH=”$ORACLE_HOME” $ export PATH=”$ORACLE_HOME:$PATH” $ sqlplus SQL*Plus: Release 11.1.0.7.0 – Production on … Read more

Sql*plus always returns exit code 0?

You have to explicitly tell sqlplus to do that, in your script. Basically, there are two statements that you can use: WHENEVER SQLERROR EXIT SQL.SQLCODE WHENEVER OSERROR EXIT For example: WHENEVER SQLERROR EXIT SQL.SQLCODE begin SELECT COLUMN_DOES_NOT_EXIST FROM DUAL; END; / And for OS errors: WHENEVER OSERROR EXIT FAILURE START no_such_file For more information, see … Read more

insert a multiline string in Oracle with sqlplus

Enable SQLBLANKLINES to allow blank lines in SQL statements. For example: SET SQLBLANKLINES ON insert into table(id, string) values (1, ‘Line1goesHere Line2GoesHere blablablabla ‘); The premise of this question is slightly wrong. SQL*Plus does allow multi-line strings by default. It is only blank lines that cause problems.