help with procedures! [message #614199] |
Sun, 18 May 2014 20:20 |
|
reuben123
Messages: 4 Registered: March 2014 Location: India
|
Junior Member |
|
|
Hello everyone,
I have just started learning oracle, so my doubt might be really dumb, but i would really appreciate it if anyone could help me.
this is my code:
create or replace procedure new
is
BEGIN
EXECUTE IMMEDIATE 'insert into reuben values(:name,:num);
end;
/
my objective is to accept values from the user, during runtime of the procedure.
but when i try to do this i get several errors :
variables unbounded etc
please help!
|
|
|
|
Re: help with procedures! [message #614210 is a reply to message #614200] |
Mon, 19 May 2014 02:35 |
cookiemonster
Messages: 13920 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
Oracle procedures and functions are not user interactive.
If you want a program that interacts with users and prompts them for input you should write it in a different language - java for example - and then have that program call the DB procedure to do the insert.
|
|
|
|
Re: help with procedures! [message #614218 is a reply to message #614210] |
Mon, 19 May 2014 03:28 |
|
Michel Cadot
Messages: 68645 Registered: March 2007 Location: Nanterre, France, http://...
|
Senior Member Account Moderator |
|
|
... or use an interactive SQL tool like SQL*Plus:
SQL> insert into reuben values('&name',&num);
Enter value for name: michel
Enter value for num: 1
insert into reuben values('michel',1)
*
ERROR at line 1:
ORA-00942: table or view does not exist
But this is not a good way to do it from a performances point of view as you don't use bind variables. So it is good only if it is seldom used.
[Updated on: Mon, 19 May 2014 03:30] Report message to a moderator
|
|
|