But inside a PL-SQL block. How can I do it? I could use DBMS_OUTPUT to replace the prompt, but what can I use instead of the ACCEPT ? (I search for a DBMS_InPUT package but that doesn't seem to exists :-) ).
did you try using a substitution variable.
Select ename, mgr from emp where empno = &eno;
Here, eno is the substitution variable ( it is preceeded by a & to indicate that it is a substitution variable ) and oracle prompts the user to provide value for this variable. This may not be the exact alterntive to ACCEPT, but some what usefull in certain cases.
Also i haven't figured out how to use the value the user had given for this sunstitution variable ( eno ) elsewhere in the PLSQL block. Using it as &eno will cause oracle to prompt again and using it as eno gave me errors.
You cannot use ACCEPT in PL/SQL.
Is it possible to split your PL/SQL in two blocks, one before and one after the ACCEPT command? (As mentioned by Ad in the Development Forum).
Or you can use a substitution variable, as Wolf mentioned.
If you need the substitution variable (&your_variable) more then one time in your code, use double ampersands (&&your_variable) or asing it once to a variable you use in the rest of your code (my_used_variable := &my_substitition_variable).
I try a substitution variable and it work, but I still have one problem:
What I want to do is a validation loop, where my user enter a password until it is valid. The problem is, once I have given a value for my substitution variable, it stay the same, causing an infinite loop.