Thomas <[email protected]> writes: > Hi, > > can someone please advise if it is possible to execute a 'set role' command > within a stored procedure? My code runs fine when being part of the java > program, but throws "ERROR 25001: Invalid transaction state: active SQL > transaction." when put inside a java stored procedure.
Hi Thomas, It should be fine to execute SET ROLE as the first SQL operation inside a stored procedure, but, as you've noticed, the transaction must be idle when the procedure is called. This means that if there's been any activity on the connection, you'll need to commit or rollback before you call the stored procedure. Hope this helps, -- Knut Anders
