runNamedQuery for Oracle Script Working but Returning The Following Error

Named Query:

Script on Button Click:

def runAction(self, event):
	"""
	Method that will run whenever the selected event fires.

	Arguments:
		self: A reference to the component that is invoking this function.
		event: Events fired by the relevant mouse/touch interaction.
			altKey (bool): True if the 'alt' key was held down when the event
			               was fired.
			button (int | float): The button number that was pressed when the
			                      event was fired.
			buttons (int | float): The buttons being depressed when the event
			                       was fired.
			clientX (int | float): The X coordinate in local coordinates.
			clientY (int | float): The Y coordinate in local coordinates.
			ctrlKey (bool): True if the 'ctrl' key was held down when the event
			                was fired.
			metaKey (bool): True if the 'meta' key was held down when the event
			                was fired.
			pageX (int | float): The X coordinate relative to the whole
			                     document.
			pageY (int | float): The Y coordinate relative to the whole
			                     document.
			screenX (int | float): The X coordinate in global (screen)
			                       coordinates.
			screenY (int | float): The Y coordinate in global (screen)
			                       coordinates.
			shiftKey (bool): True if the 'shift' key was held down when the
			                 event was fired.
	"""
	params ={"organization_id":self.getSibling("organizationid").props.text, "batch_id":self.getSibling("batchID").props.text, "RTYQuery":self.getSibling("RTYType").props.value, "Reason":self.getSibling("Reason").props.text}
	
	system.db.runNamedQuery("UpdateException", params)

The result is that the data gets merged successfully but I get this error back from Oracle
ORA-01002: fetch out of sequence

This seems to indicate that Ignition is running a script behind the scenes to fetch something against a cursor within the Oracle connection.

Any thoughts on how to mitigate this?

Just got the same error running a single insert using system.db.runPrepQuery anyone suffered with this?
Using Ignition 8.1.16 and Oracle 19c (But tested with 21c too!)

You are using multiple statements. JDBC doesn't officially support SQL scripts, just SQL statements. Some drivers accept it, but it isn't guaranteed.

Meanwhile, if running updates, use runPrepUpdate. JDBC will then know to obtain the affected rows count as the driver reply. If running a SELECT of any kind, use runPrepQuery. JDBC will then know that the reply is a data set.

You say you are inserting, which means you are using the wrong function.

1 Like

Omg!! I can't believe I've done that!!!