06-20-2007 7:24 AM
can any one please tell me the exact difference between select * and select single
what difference will appear in the output.
06-20-2007 7:48 AM
Hi Hemal,
The difference between select * and select single is as follows:
Select *
If * is specified, the resulting set is built based on all columns in the database tables or views specified after FROM, in the order given there. The columns in the resulting set take on the name and data type from the database tables or views.
This select statement will select all the fields of a row from a particular database table. That mean if it select's any row is will consequently select all the fields from it.
eg: select * from mara.
endselect.
Select single:
This select statement will select a single line from the resulting set. This means that if it select more than one line from the database, the first line that is found is entered into the resulting set.
eg: select single * from mara.
Note: 1. You dont need end select.
2. You need to specify all the key fields.
Thanks
Samantak.
Please rewards points if useful.
06-20-2007 7:42 AM
Hi,
1) Select * will take all the field from the particular table into your internal table /
work area. The Fields would be selected in the order in which they are in the
table.
eg) Select * from MARA.
This will select all the filed from MARA (Matreial) Table into your WorkArea
/ Internal Table.
2) Select Single Select only one row is returned. It does not begin a loop.
eg) Select single matnr from mara.
In this you are getting a single row from mara table.
To Ensure 1 unique row is retrived you should specify all the pimary key fields in Where Clause.
Hope this helps.
Reward Points if useful.
Regards
Jitendra
06-20-2007 7:45 AM
hi,
select * will fetch the all rows from database table (all rows and their columns)
whereas select single will give u the only one row and coluns corresponding to that one row only)
regards,
sudha
06-20-2007 7:48 AM
Hi Hemal,
The difference between select * and select single is as follows:
Select *
If * is specified, the resulting set is built based on all columns in the database tables or views specified after FROM, in the order given there. The columns in the resulting set take on the name and data type from the database tables or views.
This select statement will select all the fields of a row from a particular database table. That mean if it select's any row is will consequently select all the fields from it.
eg: select * from mara.
endselect.
Select single:
This select statement will select a single line from the resulting set. This means that if it select more than one line from the database, the first line that is found is entered into the resulting set.
eg: select single * from mara.
Note: 1. You dont need end select.
2. You need to specify all the key fields.
Thanks
Samantak.
Please rewards points if useful.
06-20-2007 7:49 AM
HI,Select single * can work on the work area not on the internal table. It has no endselect.
Select * upto 1 rows can be implemented in Internal table and work area both. It has endselect.
Regards
Sudheer