UPDATE xxx SET kunde = pers_id WHERE kunde IS NULL ;
SELECT pers_id FROM xxx WHERE kunde = :INkunde OR (fornavn = :INfornavn AND etternavn = :INetternavn AND postnummer = :INpostnummer AND response_dt = :INresponse_dt AND response_tm = :INresponse_tm AND next_step_dt = :INnext_step_dt AND eksref = :INeksref) ; );[/code]
As you see we have a small select at the end of the macro. It works in SQLAdmin with ODBC connection. When run through JDBC connection however, I get the following error:
When run with execute() or executeUpdate() it does work. But I don't get any result back.
I have macros working from JDBC both as simpler selects and pure updates. But this macro combining update and select seems to be a bit more complicated..
You cannot make use of executeQuery() because the macro modifies data. the executeUpdate() API is not designed to return resultsets either.
You should use execute() and make use of the getResultSet() and getMoreResultSets() api calls to go through the "multiple" result sets (some could be null, like for example for the update statement) when getMoreResultSets() returns false, you don't have any more resultsets to go through.
Refer the Sun Java documentation for the class java.sql.PreparedStatement for more details on these API methods.