(Not recommended) Set properties for database cursor
The set
function is not recommended. There is no replacement for
this functionality. To import data, use the fetch
function. For details, see Compatibility Considerations.
set(object,'
property
',value)
set(object)
set(object,'
sets the value of property
',value)property
to value
for the
specified cursor
.
set(object)
displays all properties for
object
.
cursor
ObjectsValid values for the property
and value
arguments for a cursor
object are as follows.
cursor
ObjectEstablish a JDBC connection to a data source. Run fetch
to
retrieve data from the table EMP
, and then set the row limit to
5
.
conn = database('orcl','scott','tiger',... 'oracle.jdbc.driver.OracleDriver',... 'jdbc:oracle:thin:@144.212.123.24:1822:'); curs = exec(conn,'SELECT * FROM EMP'); set(curs,'RowLimit',5) curs = fetch(curs) curs = cursor with properties: Attributes: [] Data: {5x8 cell} DatabaseObject: [1x1 database] RowLimit: 5 SQLQuery: 'SELECT * FROM EMP' Message: [] Type: 'Database Cursor Object' ResultSet: [1x1 oracle.jdbc.driver.OracleResultSet] Cursor: [1x1 com.mathworks.toolbox.database.sqlExec] Statement: [1x1 oracle.jdbc.driver.OracleStatement] Fetch: [1x1 com.mathworks.toolbox.database.fetchTheData]
The RowLimit
property of curs
is
5
and the Data
property is 5x8
cell
, indicating that fetch
returned five rows of
data.
In this example, RowLimit
limits the maximum number of rows you can
retrieve. Therefore, rerunning the fetch
function returns no
data.