ROWCOUNT Parameter with Oracle SPs


Author
Message
Keith Harvey
Keith Harvey
StrataFrame Beginner (22 reputation)StrataFrame Beginner (22 reputation)StrataFrame Beginner (22 reputation)StrataFrame Beginner (22 reputation)StrataFrame Beginner (22 reputation)StrataFrame Beginner (22 reputation)StrataFrame Beginner (22 reputation)StrataFrame Beginner (22 reputation)StrataFrame Beginner (22 reputation)
Group: Forum Members
Posts: 18, Visits: 75
Hi there,

I am using Oracle SPs to handle my Inserts, Updates, etc.  I noticed that I had to have an out parameter named ROWCOUNT in order for my SPs to work.

Does SF use the ROWCOUNT parameter?  Is there a way I can access via my BOs?

Cheers,

Keith

StrataFrame Team
S
StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
The ROWCOUNT is needed to determine how many rows were modified by the last action.  So, it's either going to contain 1 or 0 so that the BO can check for concurrency issues.  1 means the record was successfully updated, 0 means the record was not updated because it's been deleted, or the concurrency checks failed.  We had to include a ROWCOUNT because silly Oracle does not automatically return the RecordsAffected through the ExecuteNonQuery() on the OracleCommand objects for stored procedures.  So, in order to determine whether the record was updated, we had to include the ROWCOUNT parameter that should return the number of records affected by the command.

Looking at my Oracle unit tests, we use this to stuff the row count into the parameter:

"P_ROWCOUNT" := SQL%ROWCOUNT;

As for only returning a set number of rows... you can certainly use the WHERE ROWCOUNT < X as the equivalent of SQL TOP X.  We do this in places where we need to generate a SELECT TOP dynamically.  But if you want the raw rowcount of the table, you'll just have to use SELECT COUNT(*).

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search