Home » RDBMS Server » Server Administration » Win NT variables in SQLPlus
Win NT variables in SQLPlus [message #370841] Tue, 15 February 2000 06:36 Go to next message
Daniel
Messages: 47
Registered: February 2000
Member
How can I use WinNT variables like %USERNAME% or %oracle_home% in a sql statemant to insert into a database ?
Re: Win NT variables in SQLPlus [message #370853 is a reply to message #370841] Fri, 18 February 2000 10:12 Go to previous message
Ben
Messages: 48
Registered: January 2000
Member
Daniel,

There at least three methods to do that, depending on your senarios. I'm giving you examples of using %username% in SELECT clause. Same principle applies to INSERT. I hope these help.

Method 1
--------
In nttoora.cmd file:
echo select '%username%' "USER" from dual; > nttoora.sql
echo exit >> nttoora.sql
plus80 scott/tiger @nttoora.sql
del nttoora.sql

NT command:
C:\nttoora.cmd

Method 2
--------
In nttoora.cmd file:
echo select '%1' "USER" from dual; > nttoora.sql
echo exit >> nttoora.sql
plus80 scott/tiger @nttoora.sql
del nttoora.sql

NT command:
C:\nttoora.cmd %username%

Method 3
--------
In nttoora.sql file:
set ver off
select '&1' "USER" from dual;
exit

NT command:
C:\plus80 scott/tiger @nttoora.sql %username%

Ben
Previous Topic: TKPROF
Next Topic: How to Partition tables
Goto Forum:
  


Current Time: Thu Oct 22 05:01:12 CDT 2020