I’m trying to return sequence.nextval to my program from a proc stored in a package. I’m pretty green when it comes to PL/SQL and I’m kind of at a loss as to what is happening. The error that is actually being return is
PLS-00306: Wrong number or types of arguments in call to PROCGET_BOOKMARKID line 1, column 7 statement ignored.
Here is my package creation code…
create or replace package BOOKMARKS AUTHID DEFINER is type t_Bookmark is ref cursor; procedure procGet_Bookmarked_Information(bookmarkId in NUMBER, bookmark out t_Bookmark); procedure procInsert_Bookmark(bookmarkId in NUMBER, currExtent in VARCHAR2, selectedLayers in VARCHAR2); procedure procGet_Bookmark_Id(bookmarkId out NUMBER); end BOOKMARKS;
And the proc for get_bookmark_id looks like this (the other procs work fine so I’m not going to post them)…
procedure procGet_Bookmark_Id(bookmarkId out NUMBER) IS BEGIN SELECT seq_bookmarks.nextval INTO bookmarkId FROM dual; END procGet_Bookmark_Id;
Now, I’m sure it’s not my sequence. I can get the nextval if I just query the db directly from my code by doing this…
string sql = string.Format(@'select {0}.seq_bookmarks.nextval from dual', ApplicationSchema);
Where application schema is just the db I'm connecting to in this case.
So, it appears to me that the problem is completely in my PL/SQL and that would make sense because I've hardly used it. Any ideas?
EDIT Ok, so here is the code that is actually making the call.
DataOperationResult result = DataAccess.GetBookmarkId(); DataRow currResult = result.DataTableResult.Rows[0];
Where DataAccess is a class of just queries and the following is the code there for this specific query.
string sql = string.Format('{0}.bookmarks.procGet_Bookmark_Id', ApplicationSchema); DataOperation operation = new DataOperation(DataOperationType.ExecuteScalar, ConnectionString, System.Data.CommandType.StoredProcedure, sql); return operation.PerformOperation();
Application Schema is just the database we want to query. ExecuteScalar is kind of long-winded and it's code I've not written that should be assumed to work (keyword being assumed). Hopefully this is enough to get an idea of what's happening though.
I’ve just compiled your package, in
PL/SQL Developerit works fine.The problem seems to be with the datatypes in your
C#code.From what I see in description, you don’t bind any parameters. You should bind parameters somewhere in your code, like
If there are lots of abstractions you need to deal with, you may redefine you procedure as a function:
and call it in a
SELECTquery:, which you seem to be able to do.