I am so depressed that I have been depressed for more than half a day.
Start with the user-defined functions previously written:
Create or replace function f_getworkdays (daybegin date, dayend in date) return numberis... End f_getworkdays;
Today, I want to execute SQL statements in oledbcommand: (in fact, it is more complex than this, and there is also a type of parameter)
Select oauser. f_getworkdays (to_date ('1970-9-1 ', 'yyyy-hh24-dd'), sysdate) from SYS. Dual
Error:
System. argumentexception: the decimal byte array constructor requires an array containing valid decimal bytes and a length of 4.
Because of the original parameters, we also reported:
System. Data. oledb. oledbexception: The accessor is not a parameter accessor.
It is even suspected that oledb cannot call user-defined functions. Convert to a view and place the User-Defined Functions in the Oracle view. The errors are the same.
It is suspected that it is a permission. Grant a system permission.
Later, I changed my friend's suggestion to a stored procedure:
Create or replace package companydeptalermpackage istype t_resultset is ref cursor; procedure merge (companydeptid in number, io_cursor in out t_resultset); End companydeptalermpackage ;... The package implementation is omitted.
Then, we are faced with the storage process of oledb calling the returned result set.Article:
Http://support.microsoft.com/default.aspx? SCID = KB; en-US; 309361
The following error is reported:
System. Data. oledb. oledbexception: ORA-06550: Line 1, column 58:
PLS-00201: identifier 'IO _ cursor 'must be declared
I was almost desperate. Then I suddenly wondered, is it a decimal precision problem? Immediately go back to the computer and change the SQL:
Select trunc (oauser. f_getworkdays (to_date ('1970-9-1 ', 'yyyy-hh24-dd'), sysdate), 2) from SYS. Dual
Daji. Oh, my God.