📄 preparedstatement.html
字号:
<A HREF="../../java/sql/Clob.html">Clob</A> x)</CODE><BR> Sets the designated parameter to the given <code>Clob</code> object.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/sql/PreparedStatement.html#setDate(int, java.sql.Date)">setDate</A></B>(int parameterIndex, <A HREF="../../java/sql/Date.html">Date</A> x)</CODE><BR> Sets the designated parameter to a <code<java.sql.Date</code> value.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/sql/PreparedStatement.html#setDate(int, java.sql.Date, java.util.Calendar)">setDate</A></B>(int parameterIndex, <A HREF="../../java/sql/Date.html">Date</A> x, <A HREF="../../java/util/Calendar.html">Calendar</A> cal)</CODE><BR> Sets the designated parameter to the given <code>java.sql.Date</code> value, using the given <code>Calendar</code> object.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/sql/PreparedStatement.html#setDouble(int, double)">setDouble</A></B>(int parameterIndex, double x)</CODE><BR> Sets the designated parameter to a Java <code>double</code> value.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/sql/PreparedStatement.html#setFloat(int, float)">setFloat</A></B>(int parameterIndex, float x)</CODE><BR> Sets the designated parameter to a Java <code>float</code> value.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/sql/PreparedStatement.html#setInt(int, int)">setInt</A></B>(int parameterIndex, int x)</CODE><BR> Sets the designated parameter to a Java <code>int</code> value.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/sql/PreparedStatement.html#setLong(int, long)">setLong</A></B>(int parameterIndex, long x)</CODE><BR> Sets the designated parameter to a Java <code>long</code> value.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/sql/PreparedStatement.html#setNull(int, int)">setNull</A></B>(int parameterIndex, int sqlType)</CODE><BR> Sets the designated parameter to SQL <code>NULL</code>.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/sql/PreparedStatement.html#setNull(int, int, java.lang.String)">setNull</A></B>(int paramIndex, int sqlType, <A HREF="../../java/lang/String.html">String</A> typeName)</CODE><BR> Sets the designated parameter to SQL <code>NULL</code>.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/sql/PreparedStatement.html#setObject(int, java.lang.Object)">setObject</A></B>(int parameterIndex, <A HREF="../../java/lang/Object.html">Object</A> x)</CODE><BR> Sets the value of the designated parameter using the given object.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/sql/PreparedStatement.html#setObject(int, java.lang.Object, int)">setObject</A></B>(int parameterIndex, <A HREF="../../java/lang/Object.html">Object</A> x, int targetSqlType)</CODE><BR> Sets the value of the designated parameter with the given object.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/sql/PreparedStatement.html#setObject(int, java.lang.Object, int, int)">setObject</A></B>(int parameterIndex, <A HREF="../../java/lang/Object.html">Object</A> x, int targetSqlType, int scale)</CODE><BR> Sets the value of the designated parameter with the given object.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/sql/PreparedStatement.html#setRef(int, java.sql.Ref)">setRef</A></B>(int i, <A HREF="../../java/sql/Ref.html">Ref</A> x)</CODE><BR> Sets the designated parameter to the given <code>REF(<structured-type>)</code> value.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/sql/PreparedStatement.html#setShort(int, short)">setShort</A></B>(int parameterIndex, short x)</CODE><BR> Sets the designated parameter to a Java <code>short</code> value.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/sql/PreparedStatement.html#setString(int, java.lang.String)">setString</A></B>(int parameterIndex, <A HREF="../../java/lang/String.html">String</A> x)</CODE><BR> Sets the designated parameter to a Java <code>String</code> value.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/sql/PreparedStatement.html#setTime(int, java.sql.Time)">setTime</A></B>(int parameterIndex, <A HREF="../../java/sql/Time.html">Time</A> x)</CODE><BR> Sets the designated parameter to a <code>java.sql.Time</code> value.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/sql/PreparedStatement.html#setTime(int, java.sql.Time, java.util.Calendar)">setTime</A></B>(int parameterIndex, <A HREF="../../java/sql/Time.html">Time</A> x, <A HREF="../../java/util/Calendar.html">Calendar</A> cal)</CODE><BR> Sets the designated parameter to the given <code>java.sql.Time</code> value, using the given <code>Calendar</code> object.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/sql/PreparedStatement.html#setTimestamp(int, java.sql.Timestamp)">setTimestamp</A></B>(int parameterIndex, <A HREF="../../java/sql/Timestamp.html">Timestamp</A> x)</CODE><BR> Sets the designated parameter to a <code>java.sql.Timestamp</code> value.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/sql/PreparedStatement.html#setTimestamp(int, java.sql.Timestamp, java.util.Calendar)">setTimestamp</A></B>(int parameterIndex, <A HREF="../../java/sql/Timestamp.html">Timestamp</A> x, <A HREF="../../java/util/Calendar.html">Calendar</A> cal)</CODE><BR> Sets the designated parameter to the given <code>java.sql.Timestamp</code> value, using the given <code>Calendar</code> object.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/sql/PreparedStatement.html#setUnicodeStream(int, java.io.InputStream, int)">setUnicodeStream</A></B>(int parameterIndex, <A HREF="../../java/io/InputStream.html">InputStream</A> x, int length)</CODE><BR> <B>Deprecated.</B> <I></I> </TD></TR></TABLE> <A NAME="methods_inherited_from_class_java.sql.Statement"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TD><B>Methods inherited from interface java.sql.<A HREF="../../java/sql/Statement.html">Statement</A></B></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="../../java/sql/Statement.html#addBatch(java.lang.String)">addBatch</A>, <A HREF="../../java/sql/Statement.html#cancel()">cancel</A>, <A HREF="../../java/sql/Statement.html#clearBatch()">clearBatch</A>, <A HREF="../../java/sql/Statement.html#clearWarnings()">clearWarnings</A>, <A HREF="../../java/sql/Statement.html#close()">close</A>, <A HREF="../../java/sql/Statement.html#execute(java.lang.String)">execute</A>, <A HREF="../../java/sql/Statement.html#executeBatch()">executeBatch</A>, <A HREF="../../java/sql/Statement.html#executeQuery(java.lang.String)">executeQuery</A>, <A HREF="../../java/sql/Statement.html#executeUpdate(java.lang.String)">executeUpdate</A>, <A HREF="../../java/sql/Statement.html#getConnection()">getConnection</A>, <A HREF="../../java/sql/Statement.html#getFetchDirection()">getFetchDirection</A>, <A HREF="../../java/sql/Statement.html#getFetchSize()">getFetchSize</A>, <A HREF="../../java/sql/Statement.html#getMaxFieldSize()">getMaxFieldSize</A>, <A HREF="../../java/sql/Statement.html#getMaxRows()">getMaxRows</A>, <A HREF="../../java/sql/Statement.html#getMoreResults()">getMoreResults</A>, <A HREF="../../java/sql/Statement.html#getQueryTimeout()">getQueryTimeout</A>, <A HREF="../../java/sql/Statement.html#getResultSet()">getResultSet</A>, <A HREF="../../java/sql/Statement.html#getResultSetConcurrency()">getResultSetConcurrency</A>, <A HREF="../../java/sql/Statement.html#getResultSetType()">getResultSetType</A>, <A HREF="../../java/sql/Statement.html#getUpdateCount()">getUpdateCount</A>, <A HREF="../../java/sql/Statement.html#getWarnings()">getWarnings</A>, <A HREF="../../java/sql/Statement.html#setCursorName(java.lang.String)">setCursorName</A>, <A HREF="../../java/sql/Statement.html#setEscapeProcessing(boolean)">setEscapeProcessing</A>, <A HREF="../../java/sql/Statement.html#setFetchDirection(int)">setFetchDirection</A>, <A HREF="../../java/sql/Statement.html#setFetchSize(int)">setFetchSize</A>, <A HREF="../../java/sql/Statement.html#setMaxFieldSize(int)">setMaxFieldSize</A>, <A HREF="../../java/sql/Statement.html#setMaxRows(int)">setMaxRows</A>, <A HREF="../../java/sql/Statement.html#setQueryTimeout(int)">setQueryTimeout</A></CODE></TD></TR></TABLE> <P><!-- ============ FIELD DETAIL =========== --><!-- ========= CONSTRUCTOR DETAIL ======== --><!-- ============ METHOD DETAIL ========== --><A NAME="method_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Method Detail</B></FONT></TD></TR></TABLE><A NAME="executeQuery()"><!-- --></A><H3>executeQuery</H3><PRE>public <A HREF="../../java/sql/ResultSet.html">ResultSet</A> <B>executeQuery</B>() throws <A HREF="../../java/sql/SQLException.html">SQLException</A></PRE><DL><DD>Executes the SQL query in this <code>PreparedStatement</code> object and returns the result set generated by the query.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>a <code>ResultSet</code> object that contains the data produced by the query; never <code>null</code><DT><B>Throws:</B><DD><CODE><A HREF="../../java/sql/SQLException.html">SQLException</A></CODE> - if a database access error occurs</DL></DD></DL><HR><A NAME="executeUpdate()"><!-- --></A><H3>executeUpdate</H3><PRE>public int <B>executeUpdate</B>() throws <A HREF="../../java/sql/SQLException.html">SQLException</A></PRE><DL><DD>Executes the SQL INSERT, UPDATE or DELETE statement in this <code>PreparedStatement</code> object. In addition, SQL statements that return nothing, such as SQL DDL statements, can be executed.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>either the row count for INSERT, UPDATE or DELETE statements; or 0 for SQL statements that return nothing<DT><B>Throws:</B><DD><CODE><A HREF="../../java/sql/SQLException.html">SQLException</A></CODE> - if a database access error occurs</DL></DD></DL><HR><A NAME="setNull(int, int)"><!-- --></A><H3>setNull</H3><PRE>public void <B>setNull</B>(int parameterIndex, int sqlType) throws <A HREF="../../java/sql/SQLException.html">SQLException</A></PRE>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -