views:

59

answers:

2

Can i use insert into tables in a procedure (on oracle) ? example:

procedure my_procedure (aa1 number ,aa2 number ) is 

begin 
  insert into lam_table values(aa1,aa2,null) ;(*ofcourse depending on the tables )
  ...
  ...
end ;

** note i tried it and it worked but there were a message in the bottom that said (successfully compiled not modified )

+7  A: 

Yes, you can. Just be aware of the difference between creating the procedure and executing it. Once the procedure is created, you can execute it with:

begin
my_procedure(aa1, aa2);
end;

where aa1 and aa2 are the supplied values for the args.

dpbradley
+1  A: 

Just as dpbradley says. Also, any insert performed by your insert statement will only be visible in that session unless you do a commit;

cat_in_the_tap