Home » SQL & PL/SQL » SQL & PL/SQL » sqlplus on Windows sends parameter 1: '2>nul'
sqlplus on Windows sends parameter 1: '2>nul' [message #220540] Wed, 21 February 2007 03:00 Go to next message
KCee
Messages: 16
Registered: October 2006
Junior Member
I've got an SQL script which runs fine on unix:
$ cat update1.sql
update order_no set desc = '&1';

$ sqlplus / as sysdba @update1.sql testpar1
... 10.1.0.2.0 ...
old 1: update order_no set desc = '&1'
new 1: update order_no set desc = 'testpar1'

But on Windows:

C:\> sqlplus /3 as sysdba @update1.sql testpar1
... 10.2.0.1.0 ...
old 1: update order_no set desc = '&1'
new 1: update order_no set desc = '2>nul'

Does anyone knows a work-around so the SQL script can be used on both OS?
Re: sqlplus on Windows sends parameter 1: '2>nul' [message #220552 is a reply to message #220540] Wed, 21 February 2007 04:21 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
There seems to be nothing wrong with your script.
Did you perhaps define &1 earlier by using &&1 ??
Re: sqlplus on Windows sends parameter 1: '2>nul' [message #220556 is a reply to message #220552] Wed, 21 February 2007 04:28 Go to previous messageGo to next message
KCee
Messages: 16
Registered: October 2006
Junior Member
no, it looks like a windows bug
Re: sqlplus on Windows sends parameter 1: '2>nul' [message #220583 is a reply to message #220540] Wed, 21 February 2007 05:34 Go to previous messageGo to next message
KCee
Messages: 16
Registered: October 2006
Junior Member
Found it: my login.sql:

host echo define sid=%ORACLE_SID%> %TEMP%\t.sql
start %TEMP%\t.sql 2>nul
host del %TEMP%\t.sql 2>nul
undefine usr

col usr new_value usr

set termout off
select lower(user) usr from dual
/
set termout on
set sqlprompt 'SQL>(&&sid) '


--> Changed
start %TEMP%\t.sql 2>nul
in
start %TEMP%\t.sql

all fine now.
Better: unset SQLPATH
Re: sqlplus on Windows sends parameter 1: '2>nul' [message #220700 is a reply to message #220583] Wed, 21 February 2007 10:50 Go to previous message
William Robertson
Messages: 1640
Registered: August 2003
Location: London, UK
Senior Member
You might also try using &_CONNECT_IDENTIFIER (9.2 onwards), although the format does vary depending on how you connected.
Previous Topic: Populate Drop Down list with query results
Next Topic: COUNT THE NUMBER OF ROWS IN A TABLE
Goto Forum:
  


Current Time: Sat Dec 03 08:14:54 CST 2016

Total time taken to generate the page: 0.04518 seconds