mervat Shaaban
mervat Shaaban

Reputation: 11

use insert statement into a procedure !

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 )

Upvotes: 1

Views: 238

Answers (2)

cat_in_the_tap
cat_in_the_tap

Reputation: 11

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

Upvotes: 1

dpbradley
dpbradley

Reputation: 11925

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.

Upvotes: 7

Related Questions