symptom: Running SQL*Plus script fails
symptom: SP2-0640: Not connected
change: The following statements were added to the glogin.sql file:
column global_name new_value gname
Select Lower(User)||'@'|| Decode(Global_Name, 'SO817F1','sof1','HO817F1','hof1',
set sqlprompt '&gname> '
cause: The script contains the "/NoLog" parameter while calling
SQL*Plus. This means that no initial connection is established to the database.
Since glogin.sql gets executed when starting the SQL*Plus executable, the above
error gets generated if glogin.sql contains a select statement. The select
statement requires that a connection to the database has been established.
Do not use the "/nolog" parameter when calling SQL*Plus if glogin.sql
contains a select statement.
Originally posted by davey23uk scrap original post, whats in you login.sql / glogin.sql
bet it contains a select statement with &db_name in it
You don't need any SELECT to obtain the database identifier in SQL*Plus since 9.2. You have additional system-defined variable available, called &_CONNECT_IDENTIFIER that automaticaly obtains the value of your instance's SID. So in SQL*Plus you can simply define your sqlprompt without any selects by using:
SET SQLPROMPT '&_CONNECT_IDENTIFIER>'
Jurij Modic ASCII a stupid question, get a stupid ANSI
24 hours in a day .... 24 beer in a case .... coincidence?