Home » RDBMS Server » Server Administration » PL/SQL Prompts
PL/SQL Prompts [message #371533] Thu, 02 November 2000 17:54 Go to next message
Paul Chapman
Messages: 2
Registered: November 2000
Junior Member
I need help, I am frustratingly trying to work out how to prompt the user for input, then place that input into a already created table.

Please Help, before I go completely bald!
Re: PL/SQL Prompts [message #371534 is a reply to message #371533] Thu, 02 November 2000 18:04 Go to previous messageGo to next message
Suresh
Messages: 189
Registered: December 1998
Senior Member
U can u use " & " simple for user input.

I didn't get ur question.Explain clearly.
Re: PL/SQL Prompts [message #371535 is a reply to message #371533] Thu, 02 November 2000 21:00 Go to previous messageGo to next message
Paul Chapman
Messages: 2
Registered: November 2000
Junior Member
Ok, I am creating a database in Oracle using PL/sql and or sql. It a database for my music collection. The database is successfully
made, with all my current music information added. However I want to be able to create a prompt for my database, asking me to
enter "new album" information when I purchase a album in the future.

My problem is, I dont know how to create a prompt, then take the input I enter, store it in a temporary variable, then transfer the
contents of that variable into the relevant database table.

I am currently using code

ACCEPT temp PROMPT'Please enter a title: '
Temp being a temperory variable, that I will declare. I do not know the code for storing the user input from the prompt, into the temp
variable. NOR know how to transfer the contents to the table.

I hope this is a little clearer.

Your help is much appreciated.

Paul
Re: PL/SQL Prompts [message #371541 is a reply to message #371533] Fri, 03 November 2000 13:13 Go to previous messageGo to next message
Amit Chauhan
Messages: 74
Registered: July 1999
Member
Hi,
Heres a sample script that prompts for the name and prints it and also inserts into a temp table :

ACCEPT name PROMPT Enter the name :
BEGIN
dbms_output.put_line ('Name Entered : ' || &&name);
insert into temp (name) values ('&&temp');
END;

Hope it helps
Thanks
Amit
Re: PL/SQL Prompts [message #371545 is a reply to message #371533] Fri, 03 November 2000 14:21 Go to previous message
Suresh
Messages: 189
Registered: December 1998
Senior Member
For this u can use the " & " for get the input value either in SQL or PL/SQL.

SQL:

Select * from Emp where empno=&Eno;

It will ask to enter the empno value. ok.

In PLSQL:

Declare
Name Varchar2(10);
Begin
Select ename into Name from Emp where empno=&Empno;
End;

Dbms_output.Put_Line(
Previous Topic: Query
Next Topic: Oracle Vs sybase merits and demerits
Goto Forum:
  


Current Time: Thu May 02 06:52:58 CDT 2024