kralco626
kralco626

Reputation: 8624

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!

Upvotes: 0

Views: 1409

Answers (2)

Tony Andrews
Tony Andrews

Reputation: 132570

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

Upvotes: 3

Dave Costa
Dave Costa

Reputation: 48111

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;
/

Upvotes: 1

Related Questions