RE: pipelined functions and rolling back dml: proper way to do this?

Morning Charles,

>>    /* Process audit fee assessment. */
>>    callBannerAPIhere(with_some_parameters);

I suspect that what you need to do now is "bulk collect" the table into a local 
collection. That way, you get the data locally stored and should be able to 
rollback at any point thereafter without losing the data.

>> When I try to rollback (does not seem to matter where), I get:
>> ORA-04092: cannot ROLLBACK in a trigger
Is your code being called from a trigger at some point? If so, then you cannot 
rollback in a trigger, no matter how deeply nested the code executing the 
rollback is.

>> *Using AUTONOMOUS pragma*
>> If I put the rollback after I close the cursor, I get:
>> ORA-06519: active autonomous transaction detected and rolled back

>> If I put the rollback before I PIPE ROW (as suggested by Oracle
>> documentation), I get:
>> ORA-01002: fetch out of sequence
This will be cured by bulk collecting all the data from SQL into PL/SQL. (At 
least, it should be cured!)

COMMIT and ROLLBACK in a loop reading a cursor will give you this error. Grab 
all the data and you should be ok. The ROLLBACK in a Trigger not withstanding.

The ideal solution is to drop the banner results "temporary" table and create a 
proper global temporary table - I think - and simply leave it to drop the rows 
on commit. That way, existing code can still rollback and your own code doesn't 
have to worry about the rows remaining around because you cannot rollback.

As ever, test first in a unimportant location.


Cheers,
Norm.

Norman Dunbar
Contract Senior Oracle DBA
Capgemini Database Build Team
Internal : 7 28 2051
External : 0113 231 2051

Information in this message may be confidential and may be legally privileged. 
If you have received this message by mistake, please notify the sender 
immediately, delete it and do not copy it to anyone else.

We have checked this email and its attachments for viruses. But you should 
still check any attachment before opening it.
We may have to make this message and any reply to it public if asked to under 
the Freedom of Information Act, Data Protection Act or for litigation.  Email 
messages and attachments sent to or from any Environment Agency address may 
also be accessed by someone other than the sender or recipient, for business 
purposes.

If we have sent you information and you wish to use it please read our terms 
and conditions which you can get by calling us on 08708 506 506.  Find out more 
about the Environment Agency at www.environment-agency.gov.uk
--
http://www.freelists.org/webpage/oracle-l


Other related posts: