@ command does not work in SQL PLUS (OS HP-unix)
I have a sql file (abc.sql) which contains some code. I am able to run this using "run" command as
SQL> run abc.sql
1* select 1 from dual
1
SQL>
But not able开发者_开发知识库 to execute using "@" command. If i execute using @ it just return to the SQL prompt without executing this file.
SQL> @abc.sql
SQL>
SQL>
Could you please help me in resolving this issue?
FYI, I m using Oracle 8.1.7.4.0 on HP-unix (Tru64 UNIX V5.1B (Rev. 2650)
run
does not execute a file's content. Rather, it runs the content of the buffer.
The docu ( http://download.oracle.com/docs/cd/E11882_01/server.112/e16604/ch_twelve037.htm#sthref1803 ) says
R[UN]
Lists and executes the SQL command or PL/SQL block currently stored in the SQL buffer.
The buffer has no command history list and does not record SQL*Plus commands.
Usage
RUN causes the last line of the SQL buffer to become the current line.
The slash command (/) functions similarly to RUN, but does not list the command in the SQL buffer on your screen. The SQL buffer always contains the last SQL statement or PL/SQL block entered.
You are probably misstaking run
for the start
command.
within your file do have
select 1 from dual
/
you need to tell the sql engine to execute the line (/)
Edit
after the @ type in "EDIT" and see what the buffer says:
SQL> @a.sql
1
----------
1
SQL> ed
Wrote file afiedt.buf
...
select 1 from dual
/
精彩评论