java - Statement.execute(sql) vs executeUpdate(sql) and executeQuery(sql) -


i have question related method: st.execute(sql); st statement object. directly this oracle java tutorial:

execute: returns true if first object query returns resultset object. use method if query return 1 or more resultset objects. retrieve resultset objects returned query repeatedly calling statement.getresutset.

what meant "one or more resultset objects"? how possible manage them once got array of resultset? whereas st.executequery(sql) , st.executeupdate(sql) clear. it's not (at least me) aim of st.execute(sql) can return int if updated table.

thanks in advance

what mean "one or more resultset objects"?

the javadoc execute method says this:

"executes given sql statement, may return multiple results. in (uncommon) situations, single sql statement may return multiple result sets and/or update counts. can ignore unless (1) executing stored procedure know may return multiple results or (2) dynamically executing unknown sql string."

that pretty explains it. query can deliver more 1 resultset.

if how possible manage them once got array of resultset?

i'm not sure mean but:

  • you can't them array: must them 1 @ time, and
  • you put resultsets array ...

it's not (at least me) aim of st.execute(sql) can return int if updated table.

one use of execute execute sql statement if don't know if query, update (of kind) ... or else potentially delivers multiple result sets. generalization of executequery() , executeupdate() ...


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -