Oracle does not support a limit similar to MySQL. But you can still rownum to limit the number of rows returned by the result set.
If you only want to return the first 10 rows of records, you can write:
SELECT * FROM table WHERE rownumHowever, the
resultset.getmetadata () Gets the structure information of the result set, such as the number of fields, field names, and so on.resultset.getmetadata (). Gettablename (1) You can return the table name.resultset.getmetadata (). getColumnCount () Gets
Loop result set using Transact-SQL statements
You can use a Transact-SQL statement to traverse a result set in three ways.
One way is to useTempTable. In this way, you create the "snapshot" of the initial SELECT statement and use it as the basic
In versions earlier than 2.0, a connection is usually opened and closed for each database server request, and only one command can be executed at the same time, that is, asynchronous processes are not supported, opening a connection to the database
When writing a stored procedure, you need to query a result from the database and assign values to several parameters based on the result. In the past, this situation was rarely encountered. Occasionally, a cursor is used to operate multiple result
An overview of the ORDER BY statement
The
order BY statement is used to sort the result set based on the specified column.
The order BY statement sorts records by default in ascending order.
If you want to sort records in descending
The example in this article describes how the Java implementation encapsulates the result set into the list. Share to everyone for your reference, specific as follows:
Import java.sql.Connection;
Import Java.sql.ResultSet;
Import
The most common processing process: 1. Creates a temporary table #tmp that is compatible with the return result set of the target stored procedure procedure_name (compatible, not necessarily the same). CREATE TABLE #tmp ([Columns_list]) 2. Executes
The use of another stored procedure as a table in one stored procedure does not support the direct receipt of a stored procedure from the from in SQL Server. This time we can use the temporary table to achieve.
Example:
SELECT ID, Roleid, roletype
There's been a problem with the program recently, and it's the problem of converting the result set into a two-dimensional array.
String sql = "Select name,id,type,manufacturer,location from Equiment";
Database db = new database (); Write your own
PHP calls the stored procedure returns the result set, solves the can ' t return a results set in the given the method needing the PHP to call the stored procedure, returns a result set, discovers very difficult, looked for a long time, finally
C + + call stored procedure failed! The following error occurred: MySQL error:procedure Xmdk.query_all_plan can ' t return a result set in the given contextwhichXMDK is the database name,Query_all_plan is the name of the stored procedure written by
Join on: Multi-Table AssociationInternal connections: Connecting to other tablesFrom table 1 T join table 2 s on t. Field 1 =s. field 2 join table 3 N on N. field 3=t. field 1 or from table 1 A, table 2 B, table 3c where a. field =b. field Self-
First, limit the number of result set rows1. Select top 5* from T_employee order by Fsalary DESC2. (*) Retrieve the information of four persons starting from the sixth place according to the ranking of wages from high to Low:Select Top 4 * from
DB2 SQL query result set automatic numbering, return bar number range control ResearchSummary:the DB2 SQL statement implements the record of the query automatically numbering, and further realizes the record range control according to the number,
The order of the data cannot be guaranteed because the optimizer may choose to parallel processing or scan the data in a multi-file case without looking in order. The only order by is to ensure the sequence.The process of parallel processing results
The most common use of stored procedures is to query a data table and return a result set.In SQL SERVER, this type of operation is easiest and can be done with a simple select * from XX. But this is not supported in Oracle, so how do we implement
There are several ways in which a function/procedure in Oracle Returns a result set:In the case of function return, the stored procedure needs to be changed to an out parameter and passed in the Oracle 10g test.(1) Returns a cursor:The type of
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.