Try "go" instead of ";" -----Original Message----- From: Daniel Henrique Ferreira e Silva [mailto:[EMAIL PROTECTED] Sent: 12 July 2005 14:32 To: [email protected] Subject: Re: Multiple queries in one call
Hi Brian, Can't you wrap the statements in a stored procedure? Cheers, Daniel Silva. On 7/11/05, Barnett, Brian W. <[EMAIL PROTECTED]> wrote: > Tried a ";" and got the error below. Maybe I should take Niels advice > and not use the SQL injection ?? > > Caused by: > com.ibatis.common.jdbc.exception.NestedSQLException: > --- The error occurred in com/scholar/model/map/StudentProfileSQL.xml. > --- The error occurred while applying a parameter map. > --- Check the getStudentProfileDataCombined-InlineParameterMap. > --- Check the results (failed to retrieve results). > --- Cause: java.lang.NullPointerException ... > > java.lang.NullPointerException > at sun.reflect.GeneratedMethodAccessor185.invoke(Unknown Source) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccess > orImpl > .java:25) > at java.lang.reflect.Method.invoke(Method.java:324) > at > com.ibatis.common.jdbc.logging.ResultSetLogProxy.invoke(ResultSetLogPr > oxy.ja > va:47) > at $Proxy62.close(Unknown Source) > at > com.ibatis.sqlmap.engine.execution.SqlExecutor.closeResultSet(SqlExecu > tor.ja > va:392) > at > com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQuery(SqlExecuto > r.java > :191) > at > com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.sqlExecute > Query( > GeneralStatement.java:201) > at > com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQue > ryWith > Callback(GeneralStatement.java:169) > at > com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQue > ryForL > ist(GeneralStatement.java:119) > at > com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlM > apExec > utorDelegate.java:610) > at > com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlM > apExec > utorDelegate.java:584) > at > com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSes > sionIm > pl.java:105) > at > com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForList(SqlMapClie > ntImpl > .java:77) > at > com.scholar.model.dao.SQLMapDao.executeQueryForList(SQLMapDao.java:42) > > -----Original Message----- > From: Larry Meadors [mailto:[EMAIL PROTECTED] > Sent: Monday, July 11, 2005 3:05 PM > To: [email protected] > Subject: Re: Multiple queries in one call > > > try a ";" between the sql stmts. > > On 7/11/05, Barnett, Brian W. <[EMAIL PROTECTED]> wrote: > > Anyone know how to make something like this work in MS SQL Server? I > > have two select statements, the first selects into a temp table and > > the second selects from the temp table. I want to do it in one call > > to the db. I need help with the SQL. I can execute both queries in > > SQL Query Analyzer just fine, but I can't when I use iBATIS. Is > > there a different syntax I need to use? > > > > The SQL is something like this: > > SELECT col1, col2 FROM table1 INTO ##mytemptable JOIN table2 ON blah > > blah JOIN table3 ON blah blah WHERE blah blah > > > > SELECT DISTINCT col1, col2 FROM ##mytemptable > > > > > > SQL Map snippet: > > <select id="getData" resultMap="result_map" > > parameterClass="java.util.HashMap"> > > $sql$ > > </select> > > > > TIA, > > Brian Barnett > > > > ******************************************************************** > > ** > > ****** > > This email may contain confidential material. > > If you were not an intended recipient, Please notify the sender and > > delete all copies. > > We may monitor email to and from our network. > > > ********************************************************************** > ****** > > > > ********************************************************************** > ****** This email may contain confidential material. > If you were not an intended recipient, Please notify the sender and > delete all copies. > We may monitor email to and from our network. > ********************************************************************** > ****** >
