Oracle PL/SQL/SQL Plus/Prompt

Материал из SQL эксперт
Перейти к: навигация, поиск

PROMPT command outputs a line of data to the screen.

  
SQL>
SQL>
SQL> prompt
SQL> prompt This is a list of users and their default
This is a list of users and their default
SQL> prompt tablespaces
tablespaces
SQL>
SQL> select username, default_tablespace
  2    from dba_users where rownum < 50;
USERNAME                       DEFAULT_TABLESPACE
------------------------------ ------------------------------
SYS                            SYSTEM
SYSTEM                         SYSTEM
ANONYMOUS                      SYSAUX
MDSYS                          SYSTEM
OUTLN                          SYSTEM
DIP                            SYSTEM
TSMSYS                         SYSTEM
FLOWS_FILES                    SYSAUX
CTXSYS                         SYSAUX
DBSNMP                         SYSAUX
FLOWS_020100                   SYSAUX
USERNAME                       DEFAULT_TABLESPACE
------------------------------ ------------------------------
XDB                            SYSAUX
HR                             USERS
13 rows selected.
SQL>
SQL>



Set the prompt

    
SQL>
SQL> --Set the prompt. Use predefined variables to access login
SQL> --user name and net service name
SQL> SET SQLPROMPT "&_user@&_connect_identifier(&database_name) >"
sqle@XE(XE) >
sqle@XE(XE) >SET TERMOUT ON
sqle@XE(XE) >
sqle@XE(XE) >SET FEEDBACK ON
sqle@XE(XE) >
sqle@XE(XE) >



Use prompt to display information

  
SQL>
SQL>
SQL> prompt
SQL> prompt This is a list of users and their default
This is a list of users and their default
SQL> prompt tablespaces
tablespaces
SQL>
SQL> select username, default_tablespace
  2    from dba_users
  3    where rownum < 50
  4  /
USERNAME                       DEFAULT_TABLESPACE
------------------------------ ------------------------------
SYS                            SYSTEM
SYSTEM                         SYSTEM
ANONYMOUS                      SYSAUX
MDSYS                          SYSTEM
OUTLN                          SYSTEM
DIP                            SYSTEM
TSMSYS                         SYSTEM
FLOWS_FILES                    SYSAUX
CTXSYS                         SYSAUX
DBSNMP                         SYSAUX
FLOWS_020100                   SYSAUX
USERNAME                       DEFAULT_TABLESPACE
------------------------------ ------------------------------
XDB                            SYSAUX
HR                             USERS
13 rows selected.
SQL>
SQL>



Use prompt to output message

    
SQL> prompt Please wait while data is inserted into class tables.
SQL>
SQL>