开发者

Execute Oracle Stored Proc

开发者 https://www.devze.com 2023-02-07 17:34 出处:网络
I have an oracle stored proc with signiture: (part of package: Contractor) PROCEDURE usp_sel_contractors(g_contractors OUT sel_contractor);

I have an oracle stored proc with signiture: (part of package: Contractor)

PROCEDURE usp_sel_contractors(g_contractors OUT sel_contractor);

I am trying to execute it like:

execute Contractor.usp_sel_开发者_如何学运维contractors;

I'm used to MSSqlServer. This seems like it should be strait forward.

I keep getting error:

Invalid Sql Statement

Thanks!


Assuming sel_contractor is a ref cursor type, you could do this in SQL Plus:

var rc refcursor

exec usp_sel_contractors(:rc)

print rc


I'm not sure why you'd be getting that specific error message, but the obvious problem is that the procedure has a parameter and you're not passing one. Since it's an OUT parameter you would need to pass a variable of the appropriate type which will be populated by the procedure.

For example:

DECLARE
  my_contractors  sel_contractor;
BEGIN
  usp_sel_contractors( my_contractors );

  // Do something with the contents of my_contractors here
END;
/
0

精彩评论

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

关注公众号