Click here to Skip to main content
15,884,684 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

please help i want to take input from user in oracle10g pl/sql
how can i take
i got this code from a website but it is not working
MIDL
declare
x number;
begin
x := &enter_value;
dbms_output.put_line(x*2);
end;
Posted
Updated 13-Oct-19 23:02pm
Comments
Hemant_R_D 9-Mar-12 0:58am    
There is no direct way to input from user in oracle 10g.All other PL/SQL I/O is done through APIs that interact with other programs. For example, the DBMS_OUTPUT package has procedures such as PUT_LINE. To see the result outside of PL/SQL requires another program, such as SQL*Plus, to read and display the data passed to DBMS_OUTPUT.

=>HTF and HTP for displaying output on a web page
=>DBMS_PIPE for passing information back and forth between PL/SQL and
operating-system commands
=>UTL_FILE for reading and writing operating-system files
=>UTL_HTTP for communicating with web servers
=>UTL_SMTP for communicating with mail servers




Although some of these APIs can accept input as well as output, there is no built-in language facility for accepting data directly from the keyboard. For that, you can use the PROMPT and
ACCEPT commands in SQL*Plus.

There is no direct way to input from user in oracle 10g.All other PL/SQL I/O is done through APIs that interact with other programs. For example, the DBMS_OUTPUT package has procedures such as PUT_LINE. To see the result outside of PL/SQL requires another program, such as SQL*Plus, to read and display the data passed to DBMS_OUTPUT.

=>HTF and HTP for displaying output on a web page
=>DBMS_PIPE for passing information back and forth between PL/SQL and
operating-system commands
=>UTL_FILE for reading and writing operating-system files
=>UTL_HTTP for communicating with web servers
=>UTL_SMTP for communicating with mail servers




Although some of these APIs can accept input as well as output, there is no built-in language facility for accepting data directly from the keyboard. For that, you can use the PROMPT and
ACCEPT commands in SQL*Plus.

Hemant-S.S.Aggrawal
 
Share this answer
 
v2
code is right,but make sure in DBMS OUTPUT tab turn output on.
Please let me know if you any problem.

Thanks & regards,
Rajasekhar Reddy Malasani
 
Share this answer
 
Comments
adilmemon 14-Jun-11 11:57am    
thanx sir
but ya it is on
i am using oracle 10g
n when i am not taking input inittialize then display it is working

and i am getting this eror when i run this

ORA-06550: line 4, column 6:
PLS-00103: Encountered the symbol "&" when expecting one of the following:

( - + case mod new not null
avg
count current exists max min prior sql stddev sum variance
execute forall merge time timestamp interval date

pipe

2. x number;
3. begin
4. x := &enter_value;
5. dbms_output.put_line(x*2);
6. end;
adilmemon 14-Jun-11 13:50pm    
please someone give me answer first i need it very urgently
declare

a number(6);

begin

a:= :x;

dbms_output.put_line('Inputed Number is >> '|| a);
end;

/
 
Share this answer
 
use variable_name:=:variable_name;
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900