I want to take runtime input from user in Oracle 10g PL/SQL blocks (i.e. interactive communication with user). Is it possible?
declare
x number;
begin
x=&x;
end
this code gives error as
& can't be used in oracle 10g
BusinessWorks framework passes the input to the processContext parameter in the public N execute(N input, ProcessContext<N> processContext) method, which can be used to retrieve the actual value of a field. You can find this method in the ActivityName _ ActivityType Activity.
The ACCEPT command is used to obtain input from the user. With it, you specify a user variable and text for a prompt. The ACCEPT command displays the prompt for the user, waits for the user to respond, and assigns the user's response to the variable.
The simplest way to obtain user input is by using the input() function. This function prompts the user for an input from the keyboard. Once the user has give the input and pressed Enter, the program flow continues.
a number;
b number;
begin
a:= :a;-- instead of "&" use ":" here
b:= :b;
if a>b then
dbms_output.put_line('Large number is '||a);
else
dbms_output.put_line('Large number is '||b);
end if;
end;
Actually when I tried this it worked perfectly and actually "&" is giving error so you can use ":".
hope it you got answer :)
you can try this too And it will work:
DECLARE
a NUMBER;
b NUMBER;
BEGIN
a := &aa; --this will take input from user
b := &bb;
DBMS_OUTPUT.PUT_LINE('a = '|| a);
DBMS_OUTPUT.PUT_LINE('b = '|| b);
END;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With