开发者

use insert statement into a procedure !

开发者 https://www.devze.com 2023-01-04 20:43 出处:网络
Can i use insert into tables in a procedure (on oracle) ? example: procedure my_p开发者_JAVA百科rocedure (aa1 number ,aa2 number ) is

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

procedure my_p开发者_JAVA百科rocedure (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 )


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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消