joness59
Member²
Is there a way to have PL/SQL Dev handle substitution variables the same way as in SQL*Plus? I have a script the sets a value for a variable in a select statement and then that variable is displayed in a second query. In PL/SQL Dev, I get a window prompting for a value for the variable, even though it has already been set. Here is the script:
col dbname format a8
set termout off
set verify off
select case value
when 'PSHRPRD9' then 'PROD'
when 'PSHRDEV' then 'DEV'
when 'PSHRTRN1' then 'TRN1'
when 'PSHRTRN2' then 'TRN2'
when 'PSHRGLD9' then 'GOLD'
else '???' end "dbname"
from v$parameter
where name = 'db_name';
set termout on
select '&dbname' "DATABASE"
, sid
, serial#
, username
, osuser
, terminal
, client_info "CLIENT"
, sql_hash_value
, status
, program
, to_char(logon_time,'MM/DD/YYYY HH:MI:SS') "LOGON_TIME"
from v$session@pshrtrn2
where username is not null
and status != 'INACTIVE'
order by database, client, osuser, status;
set verify on
col dbname format a8
set termout off
set verify off
select case value
when 'PSHRPRD9' then 'PROD'
when 'PSHRDEV' then 'DEV'
when 'PSHRTRN1' then 'TRN1'
when 'PSHRTRN2' then 'TRN2'
when 'PSHRGLD9' then 'GOLD'
else '???' end "dbname"
from v$parameter
where name = 'db_name';
set termout on
select '&dbname' "DATABASE"
, sid
, serial#
, username
, osuser
, terminal
, client_info "CLIENT"
, sql_hash_value
, status
, program
, to_char(logon_time,'MM/DD/YYYY HH:MI:SS') "LOGON_TIME"
from v$session@pshrtrn2
where username is not null
and status != 'INACTIVE'
order by database, client, osuser, status;
set verify on