How to check the database name before executing DDL statements(without using PL/SQL)?? [message #19621] |
Mon, 01 April 2002 20:25 |
Sreedhar
Messages: 30 Registered: March 2000
|
Member |
|
|
Hi,
I am currently using 3 databases on same machine. I got DDL scripts to drop/create tables/views.
Is there anyway to check for the database name before executing DDL scripts???? I want to incorporate this check into script itself, so that I dont have to worry which database I am using. If I am using the wrong database, script should exit saying 'Wrong Database'.
P.S:- Its illegal to use DDL in PL/SQL.
Thanks and Regards
Sreedhar
|
|
|
|
Re: How to check the database name before executing DDL statements(without using PL/SQL)?? [message #19625 is a reply to message #19621] |
Mon, 01 April 2002 22:45 |
sonali vernekar
Messages: 8 Registered: March 2002
|
Junior Member |
|
|
Connected to:
Oracle8 Enterprise Edition Release 8.0.4.0.0 - Production
With the Partitioning and Objects options
PL/SQL Release 8.0.4.0.0 - Production
08:35:10 HCIT>
HCIT is the SID of the database where I am currently connected. Every prompt indicates the time. So when SQL*Plus is done with one command it will display the new time on the prompt for next command. This tells you exactly when the previous command terminated.
How do you set SQL*Plus to do this?
Go to your oracle home directory. e.g.. d:orant.
Go to the SQL*Plus Directory. e.g.. Plus33, Plus80.
Edit or create file Glogin.sql
Add the following text at the end of the file:
set lines 100
set pages 100
set termout off
col dbname new_value prompt_dbname
select substr(global_name,1,instr(global_name,'.')-1) dbname
from global_name;
set sqlprompt "&&prompt_dbname> "
set termout on
set time on
if u come to kno which d/b u r using u dont need to
have a pl/sql for telling u that u r using wrong d/b.
hope this solves ur query.
|
|
|