Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

select

Former Member
0 Likes
535

Hi all,

i want to the exact difference between select and select single.can any one give me clarification on this.

thanks

hyma

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
513

<completely_removed_by_moderator>

Rgds,

Rajyalakshmi.

Edited by: Julius Bussche on Aug 20, 2008 10:07 PM

5 REPLIES 5
Read only

Former Member
0 Likes
513

Hi

SELECT SINGLE is to extract only one record: so if u want to be sure to extract the right record u should use only the key fields in WHERE conditions, else the SELECT SINGLE returns the first one found.

SELECT SINGLE * FROM <table> WHERE <condition>.

SELECT is to extract all records satisfating a certain condition, so SELECT is cycle and it needs to be closed by ENDSELECT.

SELECT * FROM <table> WHERE <condition>.

ENDSELECT.

It can obtain something as SELECT SINGLE using SELECT/ENDSELCT statament with the option UP TO 1 ROWS or EXIT:

SELECT * UP TO 1 ROWS FROM <table> WHERE <condition>.

ENDSELECT.

SELECT * FROM <table> WHERE <condition>.

EXIT.

ENDSELECT.

Max

Read only

Former Member
0 Likes
513

Select : fetches all the records from the database table satsifying the where condition

Select single : fetches only one record from the database table eventhough the specified where condition matches many records

Hope this helps U

Read only

Former Member
0 Likes
514

<completely_removed_by_moderator>

Rgds,

Rajyalakshmi.

Edited by: Julius Bussche on Aug 20, 2008 10:07 PM

Read only

Former Member
0 Likes
513

The 'SELECT SINGLE' statement selects the first row in the database that it finds that fulfils the 'WHERE' clause If this results in multiple records then only the first one will be returned and therefore may not be unique.

The 'SELECT .... UP TO 1 ROWS' statement is subtly different. The database selects all of the relevant records that are defined by the WHERE clause or lack of, applies any aggregate, ordering or grouping functions to them and then returns the first record of the resultant result set.

Read only

Former Member
0 Likes
513

Hi hyma,

pls se these threads. u can get bettter idea.

thanks

shankar