开发者

Execute Oracle Stored Proc

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜