Home » SQL & PL/SQL » SQL & PL/SQL » ACCEPT and PROMPT (10.2.0.1.0)
ACCEPT and PROMPT [message #324230] Sat, 31 May 2008 15:29 Go to next message
peacock
Messages: 3
Registered: May 2008
Location: Baltimore, MD
Junior Member
Hi, everyone:

I'm very new to Oracle PL/SQL and am running Oracle 10g release 2 on my Windows XP Professional machine.

In a piece of code like this:

BEGIN
ACCEPT Username PROMPT “Username: “;
ACCEPT Password PROMPT “Password: “;
END;
/

How is it possible to make the first ACCEPT pause and take user input? Right now the first ACCEPT is getting populated with the second line ("ACCEPT Password PROMPT...").

Thanks,
Lisa

[Updated on: Sat, 31 May 2008 15:30]

Report message to a moderator

Re: ACCEPT and PROMPT [message #324231 is a reply to message #324230] Sat, 31 May 2008 15:34 Go to previous messageGo to next message
Littlefoot
Messages: 20891
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
ACCEPT is SQL*Plus command. Not SQL, not PL/SQL (which you have used).
SQL> accept username prompt "Username "
Username mike
SQL> accept password prompt "Password "
Password lion
SQL> connect &username/&password
Connected.
SQL>
Re: ACCEPT and PROMPT [message #324232 is a reply to message #324230] Sat, 31 May 2008 15:39 Go to previous messageGo to next message
BlackSwan
Messages: 25036
Registered: January 2009
Location: SoCal
Senior Member
SQL*PLUS<>PL/SQL

Since when is ACCEPT valid with PL/SQL?

PL/SQL runs inside the RDBMS engine & does not interact directly with the outside world.
Re: ACCEPT and PROMPT [message #324233 is a reply to message #324231] Sat, 31 May 2008 16:15 Go to previous messageGo to next message
peacock
Messages: 3
Registered: May 2008
Location: Baltimore, MD
Junior Member
Thanks, Littlefoot. What I hoped to do was create a procedure and pull in that user input. It doesn't seem that I can do that, but what I was able to do was create an external file that I can run in SQL*Plus to accomplish my end goal. Thanks again for your help; looks like I will read up on what I can do with SQL*Plus vs. PL/SQL!

Lisa
Re: ACCEPT and PROMPT [message #324234 is a reply to message #324230] Sat, 31 May 2008 17:03 Go to previous messageGo to next message
BlackSwan
Messages: 25036
Registered: January 2009
Location: SoCal
Senior Member
The whole Oracle Documentation set can be found at http://tahiti.oracle.com
Re: ACCEPT and PROMPT [message #324237 is a reply to message #324234] Sat, 31 May 2008 19:05 Go to previous message
peacock
Messages: 3
Registered: May 2008
Location: Baltimore, MD
Junior Member
Thank you -- this is helpful!
Previous Topic: How do I find a bad/corrupted record ?
Next Topic: using object tables
Goto Forum:
  


Current Time: Sun Dec 04 04:24:54 CST 2016

Total time taken to generate the page: 0.07424 seconds