SQL select statement doesn't return any rows,

SQL select statement doesn't return any rows,

When an SQL select statement doesn't return any rows, is an SQLException thrown?

View Answers

November 15, 2010 at 5:33 PM

Hi Friend,

No. If you want to throw an exception, you have to wrap the SQL related code in a custom class and throw Exception like ObjectNotFoundException when the returned ResultSet is empty.

Thanks









Related Tutorials/Questions & Answers:
SQL select statement doesn't return any rows,
SQL select statement doesn't return any rows,  When an SQL select statement doesn't return any rows, is an SQLException thrown
JDBC Batch SQL Update Statement Example With Return Number of Effected Rows
JDBC Batch SQL Update Statement Example With Return Number of Effected Rows: In this example, we are discuss about update statement with return number... SQL statements and execute on the created statement object and store return
Advertisements
SQL SELECT DISTINCT Statement
SQL SELECT DISTINCT Statement     ... with the select statement. The SQL Distinct clause is used with the Select statement... Stu_Table The Select statement return you the records from
mysql select statement - SQL
mysql select statement  i want to select id,name,age values from database.i created the following coding to select values from the table according to the id value which is selected by the user.pls help me select id,name,age from
Select Statement in SQL, SQL Tutorial
The SELECT statement for SQL       SELECT key word is used to select data from a table. ADS..._TO_REPLACE_3 SELECT column_name(s) FROM table_name
SQL SELECT DISTINCT Statement
SQL SELECT DISTINCT Statement   ... clause with the select statement. The SQL Distinct clause is used with the Select... from SQL Select Distinct Statement. The create table statement help you
The SELECT statement for SQL
The SELECT statement for SQL       SELECT key word is used to select data from a table. ADS..._TO_REPLACE_3 SELECT column_name(s) FROM table_name
JDBC Batch Example With SQL Select Statement
JDBC Batch Example With SQL Select Statement: In this example, we are discuss about SQL select statement with JDBC batch process. We will create SQL... will insert value in these table and then fetch data by using select statement
SQL And Statement
SQL AND Statement      ... into table Stu_Table. The Select return you the records or row from table Stu... Syntax  return you a filter records or rows from a table based
How to display all the rows in JSP ,MySQL select condition statement IN dept_table
How to display all the rows in JSP ,MySQL select condition statement IN dept_table  I iam unable to display all the rows in JSP select statement from... is displayed.@select * from department where dept_no=10;My display code in JSP
Help with SELECT/JOIN statement
a select statement that will return me all rows of t1 but, when t1.id = t2.id, I...Help with SELECT/JOIN statement  I have two tables (t1 and t2... id | name | value ------------------- 2 | lyn | 99 I would like a SQL
return all rows mysql php
return all rows mysql php  How to find or return results that are not available in another table .. using join method in PHP and MYSql.   SELECT * FROM Declined LEFT JOIN Request ON Declined.RequestID
use of return statement
use of return statement  what is the use of return statement
PHP SQL Right Join
join is used in case of need to return all rows from the right table, even if the left table doesn't have any match. In this example right join is used to join... PHP SQL Right Join      
PHP SQL Left Join
is used in case of need to return all rows from the left table, even if the right table doesn't have any match. In this example left join is used to join... PHP SQL Left Join      
PHP SQL Rows
PHP SQL Rows       PHP SQL Rows is used to fetch the select the row value based on the condition..._TO_REPLACE_1 The Tutorial illustrate an example from 'PHP SQL Rows
SQL statement - SQL
SQL statement  Hi, i have an sql statement that needs to add... be charged 10. otherwise nothing. Heres the code: $orderAmount = 0; $sql = "SELECT SUM(pd_price * od_qty) FROM tbl_order_item oi, tbl_product p
How to sort the rows in SQL?
How to sort the rows in SQL?  How to sort the rows in SQL?   Hi, Here is the answer,ADS_TO_REPLACE_1 The ORDER BY clause allows you... in SELECT statements. The syntax for the ORDER BY clause is: SELECT column_list FROM
How to use select Statement in MySQL?
How to use select Statement in MySQL?  Hi, How to use select Statement in MySQL? I want to learn the various ways to use the SQL select statement... the select statement in MySQL Suppose we have following table: CREATE TABLE
SQL Union
SQL Union       SQL Union is used to combine the query of two or more Select Statement... to return the result of select queries from two table 'stu' and 'stu1
where clause in select statement
where clause in select statement  In Mysql,I write the following query: select * from emp where designation = "MANAGER" But the actual value in the table is "manager" Will the above query retrieve any records? According to me
in string how will write the return statement..........?
in string how will write the return statement..........?  import java.util.Scanner; class BinaryConversion12{ static int j=1; static int l=1; public static void main(String args[]){ int i=Integer.parseInt(args[0
Return Statement in PHP
In PHP Return is a Statment that returns value back to the calling program. For example if the Return Statment is called from within a function it will end the excution on it(return statment) and will return the value or argument back
Java Method Return Value
When it  reaches a return statement throwing  an exception, whichever occurred first. The return statement is used to return the value within the body of method. The method declared void does not return any
The Update Statement in SQL.
The Update Statement in SQL.  The Update Statement in SQL.   Hi, here is the answer,ADS_TO_REPLACE_1 The update statement in the sql is written as follows- UPDATE table_name SET column_name = new_value WHERE column
error : not an sql expression statement
error : not an sql expression statement  hii I am gettin followin... { Connection conn = DatabaseManager.getConnection(); Statement stmt... (Exception ex) { ex.printStackTrace(); } return true
MySQL Select Statement
MySQL Select Statement     ... statement in MySQL and you can also learn how to use SELECT statement with WHERE clause. The SELECT statement is used to retrieve the records from the table
SQL Backup query with where statement
SQL Backup query with where statement       SQL Backup query with where statement ... Insert into statement add the records or rows to the table 'Stu_Table
Mysql Cross Join Statement
Mysql Cross Join Statement       Mysql Cross Join Statement is used to return the product... crossjoin:- The below query return you all the records or rows from both table name
Select today's date sql
Select today's date sql   I wanted to show the data from database according to the current date. So, can anyone give me the select today's date sql query? Thanks!   select current date in mysql query select * from
SQL AND Statement
SQL AND Statement      ... into table Stu_Table. The Select return you the records or row from table Stu... Syntax  return you a filter records or rows from a table based
Java error missing return statement
Java error missing return statement   ... a return statement inside the conditional clauses. method with a non-void return... a return statement in the non-void method so, whenever the compiler execute the code
SQL Alter View
of an SQL statement. A virtual table contains rows and columns, as same... into add the records or rows to the created table'Stu_Table'.The select statemet  return you all the record added by the insert into statement
If statement doesn't work ,(doesn't print alert message when user dont field name and email)
If statement doesn't work ,(doesn't print alert message when user dont field name and email)  I've created some if / else statements to get a download when a user hit click jf he fields name and email but doesn"t work for my site
PHP SQL Number of Rows
PHP SQL Number of Rows       This example illustrates how to count the rows of the table. To understand how to count the number of rows in a table, we have created a sql_num_rows.php
Need SQL Statement
IS THE SQL STATEMENT NEEDED TO ACHIEVE THESE RESULTS...Need SQL Statement  QUESTION IS CAPITALIZED AT THE BOTTOM... There is a table Employee, with three columns: Name (varchar), Department (varchar
how to select random rows from database through servlet
how to select random rows from database through servlet  hello i want to know, how to select random rows from database through servlet
profile doesn't match any valid certificate private key pair in the default keychain
profile doesn't match any valid certificate private key pair in the default... error is coming profile doesn't match any valid certificate private key pair in the default keychain and I am not able to select my certificate for building
Use HANDLER Statement in Cursors
set. The repeat statement in SQL include a set of statements... 'name'. The select name return you all the row which satisfy the condition... Use HANDLER Statement in Cursors   
SQL Select From
SQL Select From       SQL Select From keyword show you the records from a specified table. Understand with ExampleADS_TO_REPLACE_1 The Tutorial illustrate an example from 'SQL Select
The UPDATE Statement, SQL Tutorial
clause.  It simply work as a select statement, if the given criteria match... should use the following SQL statement : ADS_TO_REPLACE_3 Syntax... The UPDATE Statement      
insert rows from browsed file to sql database
insert rows from browsed file to sql database  i need to insert rows from excel to database by browsing the file in jsp. by connecting both the databases using odbc i can do this. but after browsing and uploaded the file
PHP SQL Select Where
PHP SQL Select Where       PHP SQL Select Where is used to provide the records from the table... helps you to return only those records that meet the specific criteria in the SQL
SQL Backup query with where statement
SQL Backup query with where statement       SQL Backup query with where statement ... Insert into statement add the records or rows to the table 'Stu_Table
The DELETE Statement, SQL Tutorial
The DELETE Statement       The DELETE statement is used to delete rows from a table. database will update... To Delete All the Rows : This means that the table structure, attributes
Mysql Merge Statement
Mysql Merge Statement       Mysql Merge Statement is used to merge the two sql statement using UNION clause. The UNION clause is used to combine the result set of any two
Mysql Merge Statement
Mysql Merge Statement       Mysql Merge Statement is used to merge the two sql statement using UNION clause.The UNION clause is used to combine the result set of any
SQL STATEMENT in JDBC in NETBEANS IDE
SQL STATEMENT in JDBC in NETBEANS IDE  Iam using NETBEANS IDE. Iam developing a bank application. Using JDBC in SERVLETS For the withdraw function, "bal" and "ano" are user inputs when i wrote like, st.executeQuery("UPDATE
UNICODE or SQL statement issue - JDBC
UNICODE or SQL statement issue  Hi again............ I have got something new that........... i was using MS Access as the database with my... nothing ...... I had also change my backhand to SQL SERVER but retrieves same
select maximum from table and hoe to store it in any variable
select maximum from table and hoe to store it in any variable  public..."); Connection cn=DriverManager.getConnection("jdbc:odbc:student"); Statement st=cn.createStatement(); ResultSet i=st.executeQuery("select MAX(sn

Ads