# Sqlplus shell

**URL:** <https://community.unix.com/t/sqlplus-shell/374237>\
**Category:** Shell Programming and Scripting\
**Created:** [November 29, 2018, 4:53pm UTC](https://community.unix.com/t/sqlplus-shell/374237 "2018-11-29T16:53:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tricampeon81](https://community.unix.com/letter_avatar/tricampeon81/32/5_5575768a8748004e209b776fc1b2916d.png) [@tricampeon81](https://community.unix.com/u/tricampeon81)\
**Post date:** [November 29, 2018, 4:53pm UTC](https://community.unix.com/t/sqlplus-shell/374237/1 "2018-11-29T16:53:56Z")

</div>

friends because when calling a sqlplus from a shell it brings me the following message

```nohighlight

       sqlplus -s $BDDUSER/$BDDPASS@$BDDHOST @$DIR_SQL/prueba.sql
       echo "bandera 3 " $?
       STATUS=$?
       if [$STATUS -ne 0];then
           echo "bandera 4 " $?
           #log_info "La ejecucion de $DIR_SQL/prueba.sql termino con errores [${STATUS}]. Saliendo"
           echo "bandera 5 " $?
           return 102
       fi

```

message

```nohighlight
SQL*Plus: Release 11.2.0.4.0 Production

Copyright (c) 1982, 2013, Oracle. All rights reserved.

Use SQL*Plus to execute SQL, PL/SQL and SQL*Plus statements.

Usage 1: sqlplus -H | -V

    -H Displays the SQL*Plus version and the
                   usage help.
    -V Displays the SQL*Plus version.

Usage 2: sqlplus [[<option>] [{logon | /nolog}] [<start>] ]

  <option> is: [-C <version>] [-L] [-M "<options>"] [-R <level>] [-S]

    -C <version> Sets the compatibility of affected commands to the
                   version specified by <version>. The version has
                   the form "x.y[.z]". For example, -C 10.2.0
    -L Attempts to log on just once, instead of
                   reprompting on error.
    -M "<options>" Sets automatic HTML markup of output. The options
                   have the form:
                   HTML [ON|OFF] [HEAD text] [BODY text] [TABLE text]
                   [ENTMAP {ON|OFF}] [SPOOL {ON|OFF}] [PRE[FORMAT] {ON|OFF}]
    -R <level> Sets restricted mode to disable SQL*Plus commands
                   that interact with the file system. The level can
                   be 1, 2 or 3. The most restrictive is -R 3 which
                   disables all user commands interacting with the
                   file system.
    -S Sets silent mode which suppresses the display of
                   the SQL*Plus banner, prompts, and echoing of
                   commands.

  <logon> is: {<username>[/<password>][@<connect_identifier>] | / }
              [AS {SYSDBA | SYSOPER | SYSASM}] [EDITION=value]

    Specifies the database account username, password and connect
    identifier for the database connection. Without a connect
    identifier, SQL*Plus connects to the default database.

    The AS SYSDBA, AS SYSOPER and AS SYSASM options are database
    administration privileges.

    <connect_identifier> can be in the form of Net Service Name
    or Easy Connect.

      @[<net_service_name> | [//]Host[:Port]/<service_name>]

        <net_service_name> is a simple name for a service that resolves
        to a connect descriptor.

        Example: Connect to database using Net Service Name and the
                 database net service name is ORCL.

           sqlplus myusername/mypassword@ORCL

        Host specifies the host name or IP address of the database
        server computer.

        Port specifies the listening port on the database server.

        <service_name> specifies the service name of the database you
        want to access.

        Example: Connect to database using Easy Connect and the
                 Service name is ORCL.

           sqlplus myusername/mypassword@Host/ORCL

    The /NOLOG option starts SQL*Plus without connecting to a
    database.

    The EDITION specifies the value for Session Edition.

  <start> is: @<URL>|<filename>[.<ext>] [<parameter> ...]

    Runs the specified SQL*Plus script from a web server (URL) or the
    local file system (filename.ext) with specified parameters that
    will be assigned to substitution variables in the script.

When SQL*Plus starts, and after CONNECT commands, the site profile
(e.g. $ORACLE_HOME/sqlplus/admin/glogin.sql) and the user profile
(e.g. login.sql in the working directory) are run. The files may
contain SQL*Plus commands.

```

---

<div class="post-metadata">

**Author:** ![Corona688](https://community.unix.com/letter_avatar/corona688/32/5_5575768a8748004e209b776fc1b2916d.png) [@Corona688](https://community.unix.com/u/Corona688)\
**Post date:** [November 29, 2018, 5:09pm UTC](https://community.unix.com/t/sqlplus-shell/374237/2 "2018-11-29T17:09:19Z")

</div>

First things, I'd try quoting your variables:

```nohighlight
sqlplus -s "${BDDUSER}/${BDDPASS}@${BDDHOST}" "@${DIR_SQL}/prueba.sql"

```
