How to call stored procedure from Oracle using PetaPoco

1.2k views Asked by At

I have stored procedure in Oracle

CREATE OR REPLACE PROCEDURE proc1 (p_param1 INTEGER, p_param2 CHAR, p_param3 INTEGER)
AS
BEGIN
... 
END;

and I call it in Oracle SQL Developer using this statement:

EXECUTE proc1(2013, 1, 3);

I try to call it in C# from Visual Studio but it doesn't works

_db.Execute("EXEC proc1 (2013, 1, 3)");

How can I properly call it in C#?

Thanks.

1

There are 1 answers

2
Dmitriy On BEST ANSWER

EXEC is a command of SQL*Plus. Try to use command without EXEC or in anonymous PL/SQL block:

_db.Execute("proc1 (2013, 1, 3)");

or

_db.Execute("begin proc1 (2013, 1, 3); end;");

Also, in this case, 1 could be converted to CHAR automatically, and in other cases you need to use quotes '':

_db.Execute("begin proc1 (2013, 'abc', 3); end;");