Unless I'm mistaken, the pre-compiler resolves the SELECT * at compile-time, so the result is the same as explicitly listing the columns.
-----Original Message-----
From: David Gibbs via RPG400-L [mailto:rpg400-l@xxxxxxxxxxxxxxxxxx]
Sent: Friday, May 01, 2020 12:34 PM
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Cc: David Gibbs <david@xxxxxxxxxxxx>
Subject: Re: Implicitly hidden column & EXTNAME D/S
On 5/1/20 12:19 PM, Justin Taylor wrote:
" BTW it is never a good ide to use SELECT *!"
Personally, I'd say "almost never". Can you explain why it's better
for the SELECT (in static SQL) to explicitly list every single column
rather than doing SELECT *?
If a table's structure changes, and you're retrieving into host variables, you will be either missing variables, have too many, or have mismatches.
As Brigitta says, better to list every column you want to retrieve so there is little risk of mismatch.
david
--
IBM i on Power Systems: For when you can't afford to be out of business!
I'm riding in the American Diabetes Association's Tour de Cure to raise money for diabetes research, education, advocacy, and awareness. You can make a tax-deductible donation to my ride by visiting
https://mideml.diabetessucks.net.
You can see where my donations come from by visiting my interactive donation map ...
https://mideml.diabetessucks.net/map (it's a geeky thing).
I may have diabetes, but diabetes doesn't have me!
As an Amazon Associate we earn from qualifying purchases.