View previous topic :: View next topic
|
Author |
Message |
ibmmainframe1
New User
Joined: 26 Jul 2005 Posts: 64 Location: India
|
|
|
|
Hi All
I have a querry which extracts space from the table
Code: |
EXEC SQL
SELECT " "
INTO :WS-SG57-SPACE
FROM SOASG57_SVCPRT_WTY
WHERE VIN_C = :CS0014-INPUT-VIN
END-EXEC |
Pls let me know which coloum value is fetched?
Thanks. |
|
Back to top |
|
|
GuyC
Senior Member
Joined: 11 Aug 2009 Posts: 1281 Location: Belgium
|
|
|
|
none
if 1 row is found, then a space will be put into WS-SG57-SPACE
If no row is found then +100 is returned
if >1 rows are found, you get some other sqlcode
Which is probably what the statement wants to test. |
|
Back to top |
|
|
ibmmainframe1
New User
Joined: 26 Jul 2005 Posts: 64 Location: India
|
|
|
|
I got it. Basically it is testing whether that Input_VIN is present in the table.
The other way could be..
select Vin_C and test if it is not spaces.
GuyC,
pls correct me if my understanding is wrong.
Thanks a lot for your response. |
|
Back to top |
|
|
Bharath Bhat
Active User
Joined: 20 Mar 2008 Posts: 283 Location: chennai
|
|
|
|
ibmmainframe1 wrote: |
I got it. Basically it is testing whether that Input_VIN is present in the table.
The other way could be..
select Vin_C and test if it is not spaces.
GuyC,
pls correct me if my understanding is wrong.
Thanks a lot for your response. |
select Vin_C and test if it is equal to CS0014-INPUT-VIN |
|
Back to top |
|
|
GuyC
Senior Member
Joined: 11 Aug 2009 Posts: 1281 Location: Belgium
|
|
|
|
The idea is that select space is faster than selecting a column.
select 1 as an integer would even be a little bit better.
But really that is talking about nanoseconds or even picoseconds.
If you select with a where clause there is no need to test the field afterwards. The statement will always return +100 when not exists. |
|
Back to top |
|
|
ibmmainframe1
New User
Joined: 26 Jul 2005 Posts: 64 Location: India
|
|
|
|
Quote: |
The idea is that select space is faster than selecting a column.
|
I was not aware of this.
Thanks a lot for a clear explanation GuyC |
|
Back to top |
|
|
|