In such a case, the type of the parameter is automatically set. If the application calls this setObject method with an obj value NULL, the driver assumes that the type of the parameter is one that is set by the previously called method. If the obj value is NULL and no type information for that parameter can be determined, this setObject method converts the specified parameter to a CHAR before sending it to the database. For more information, see Configuring How java. Time Values are Sent to the Server.
Viewed 11k times. Do we have a solution for this? Oleg Mikheev Don't you know the definition of your table? Add a comment. Active Oldest Votes. Oleg Mikheev Oleg Mikheev Try: preparedStatement. Hopefully, this should work. Sets a parameter to a vector; should be used when the type is a collection of REF s. The resultset to be closed.
Executes the SQL Statement; globalization enabled. The SQL statement to be executed. The number of elements provided in each buffer of bind variables.
Executes a non-query statement; globalization enabled. Parameter index; first parameter is 1, second is 2, and so on. Used for vectors of UString Class ; globalization enabled.
Used for vectors of BfileClass. Used for vectors of Blob Class. Used for vectors of Date Class. Used for vectors of double Class. Used for vectors of float Class. Used for vectors of int Class. Used for vectors of IntervalDSClass. Used for vectors of IntervalYMClass.
Used for vectors of Number Class. Used for vectors of RefAnyClass. Used for vectors of string Class. Intended for use on platforms where partial ordering of function templates is supported. Intended for use on platforms where partial ordering of function templates is not supported, such as Windows NT. Used for vectors of Timestamp Class. Available only on platforms where partial ordering of function templates is supported.
Used for on vectors of unsigned int Class. Reference to the vector OUT parameter into which the values should be retrieved. Column index; first column is 1, second is 2, and so on. The maximum size of the retrieved value. Sets column returned to be a binary stream. The amount of data to be read or returned as a binary Stream. Sets column returned to be a character stream. The amount of data to be read or returned as a character Stream.
Selected character set, as a UString. Pointer to user-allocated buffer; if iterative or array executes are done, it should have numIterations size bytes in it. Type of the data that is provided or retrieved in the buffer. Size of the data buffer; for iterative and array executes, it is the size of each element of the data items. Pointer to the length of data in the buffer; for iterative and array executes, it should be an array of length data for each buffer element; the size of the array should be equal to arrayLength.
Returns code; for iterative and array executes, a return code for every buffer element. Pointer to user-allocated buffer. Maximum number of elements in the array. Pointer to number of current elements in the array. Size of the data buffer for each element. Pointer to an array of lengths. Pointer to an array of indicators. Enable exceptions if TRUE. Maximum number of iterations allowed on this statement. Sets the value of a parameter to NULL using an object.
Name of the schema where the object or collection is defined.. The object containing the input parameter value. The SQL type name of the object to be set. Number of bytes used for storing data fetched during each server round trip. Number of rows to fetch for each round trip to the server. The schema where the object type is defined [optional]. A SQL statement in same character set as the connection source of the statement.
Sets a const Bfile vector; multibyte support. Sets a const Blob vector; multibyte support. Sets a const Blob vector; UTF16 support. Sets a const Clob vector; multibyte support. Sets a const Clob vector; UTF16 support.
Sets a const Date vector; multibyte support. Sets a const Date vector; UTF16 support. Sets a const double vector; multibyte support. Sets a const double vector; UTF16 support. Sets a const float vector; multibyte support. Sets a const float vector; UTF16 support. Sets a const int vector; multibyte support. Sets a const int vector; UTF16 support. Sets a const IntervalDS vector; multibyte support.
Sets a const IntervalYM vector; multibyte support. Sets a const Number vector; multibyte support. Timestamp value. Timestamp value, using the given Calendar object. URL value. Methods inherited from interface java. Note: You must specify the parameter's SQL type. Parameters: parameterIndex - the first parameter is 1, the second is 2, Data will be read from the stream as needed until end-of-file is reached.
Note: This stream object can either be a standard Java stream object or your own subclass that implements the standard interface. Use setCharacterStream Sets the designated parameter to the given input stream, which will have the specified number of bytes. InputStream object. The data will be read from the stream as needed until end-of-file is reached. In general, parameter values remain in force for repeated use of a statement.
Setting a parameter value automatically clears its previous value. However, in some cases it is useful to immediately release the resources used by the current parameter values; this can be done by calling the method clearParameters. This method is similar to setObject int parameterIndex, Object x, int targetSqlType, int scaleOrLength , except that it assumes a scale of zero. The given argument will be converted to the corresponding SQL type before being sent to the database.
Note that this method may be used to pass datatabase- specific abstract data types, by using a driver-specific Java type. Note: Not all databases allow for a non-typed Null to be sent to the backend.
For maximum portability, the setNull or the setObject int parameterIndex, Object x, int sqlType method should be used instead of setObject int parameterIndex, Object x. Note: This method throws an exception if there is an ambiguity, for example, if the object is of a class implementing more than one of the interfaces named above.
Some prepared statements return multiple results; the execute method handles these complex statements as well as the simpler form of statements handled by the methods executeQuery and executeUpdate. The execute method returns a boolean to indicate the form of the first result. You must call either the method getResultSet or getUpdateCount to retrieve the result; you must call getMoreResults to move to any subsequent result s.
Returns: true if the first result is a ResultSet object; false if the first result is an update count or there is no result Throws: SQLException - if a database access error occurs; this method is called on a closed PreparedStatement or an argument is supplied to this method SQLTimeoutException - when the driver has determined that the timeout value that was specified by the setQueryTimeout method has been exceeded and has at least attempted to cancel the currently running Statement See Also: Statement.
String , Statement. String setCharacterStream void setCharacterStream int parameterIndex, Reader reader, int length throws SQLException Sets the designated parameter to the given Reader object, which is the given number of characters long.
Reader object. Reader object that contains the Unicode data length - the number of characters in the stream Throws: SQLException - if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs or this method is called on a closed PreparedStatement Since: 1.
Because a PreparedStatement object is precompiled, it is possible to know about the ResultSet object that it will return without having to execute it.
0コメント