Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I'm losing my mind !!!

Status
Not open for further replies.

softdrink

Programmer
Jul 26, 2001
112
CA
I'm NEW to Oralce. I love it, but... lots of mistakes
I'm using SqlPlus for Oracle 8i

here's what I'm typing

accept col_name prompt 'Enter column name :'
select &col_name
from users

the error is this:
accept col_name prompt 'Enter column name :'
*
ERROR at line 1:
ORA-00900: invalid SQL statement

WHY WHY WHY ??? When I go to the editor I enter the accept command there, righ before select statement. Should I be doing this there or does the accept command only work before issuing select statement. I mean, enter accept command and then run the select statement. Please HELP !!!

softdrink
 
This works fine for me, command line or in a script.
I am on Solaris8.

Are you using a script or the command-line ?
Thomas V. Flaherty Jr.
Birch Hill Technology Group, Inc.
 
Instead of using the accept command you can use

select &colname
from users

and you will be prompted for the value.

If you do want to use accept then it has to be entered before the select statement - the value of the variable will then remain defined until you clear it with undefine or by exiting sqlplus Blood, Sweat But No Tears!
 
I don't think you are allowed to enter multiple commands in your SQL*Plus buffer. Perhaps that's the reason for your error.

The right way to execute a file containing multiple commands is to use the "@" command followed by a file name.

@full_path_name_of_file

It's likely your script would have worked if you had typed at the SQL*Plus prompt

@afiedt.buf
 
Karluk, thanks you were right. The buffer does not let me do it, but executing the command @my_file_name works fine. Thanks all you guys for help and suggestions.

softdrink
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top