Page 1 of 1

QueryRecCount and Oracle Stored Procedure bug

Posted: Thu 16 Feb 2012 12:26
by paulkdavies
If I use the QueryRecCount option on a TUniStoredProc component which returns a ref cursor from a Stored Procedure in an Oracle database, I get the following error when calling the Open method.

ORA00907: missing right parenthesis

If QueryRecCount is set to false, the dataset is returned correctly.

Details: Delphi 2009, UniDAC 4.1.4 (problem also existed in 4.1.3), Oracle 11g Database

Posted: Thu 16 Feb 2012 15:44
by AlexP
hello,

When setting the QueryRecCount to True, the text in SQL Text turns into a query.

Code: Select all

SELECT COUNT(*) FROM (SQL.Text )
And as it is necessary to call the stored procedures in the anonymous block, when using them,

Code: Select all

BEGIN
// calling a stored procedure
END;
the error occurs when turning such code into

Code: Select all

SELCT COUNT(*) FROM (BEGIN ...  END;)
To retrieve the number of records that are returned in the cursor, you should retrieve this number directly in your procedure at a server, and return it in the OUT parameter of the procedure.

Posted: Thu 16 Feb 2012 16:56
by paulkdavies
Ok, thanks Alex.