PL/SQL Prompts [message #371533] |
Thu, 02 November 2000 17:54 |
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 #371535 is a reply to message #371533] |
Thu, 02 November 2000 21:00 |
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 |
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 |
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(
|
|
|