IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Select statement


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sunil_chappy

New User


Joined: 19 Mar 2006
Posts: 9
Location: Bangalore, INDIA

PostPosted: Fri Mar 24, 2006 7:39 pm
Reply with quote

why select * not used in embeded sql
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1448
Location: Chicago, IL

PostPosted: Fri Mar 24, 2006 10:43 pm
Reply with quote

http://ibmmainframes.com/viewtopic.php?t=9847

Regards,
Priyesh.
Back to top
View user's profile Send private message
T-REXDB2

New User


Joined: 28 Apr 2005
Posts: 11
Location: USA

PostPosted: Sun Mar 26, 2006 4:00 am
Reply with quote

sunil_chappy wrote:
why select * not used in embeded sql


Hello to you, Sir, Sunil_chappy:

Yes, " SELECT * " may be used in a host program, containing imbedded SQL DML statements. That is truly a given.

It is grave mis-conception that " SELECT * " cannot be imbedded within a host program. It may be imbedded, just like any other SELECT explicit COLUMN statement would be.

What you must know is, it is bad practice to imbed a "SELECT *" into a host program because if additional columns are added to the structure you are selecting from, then the program fails because the number of columns the program was expecting DB2 to return will have increased and will, most likely, not be handled correctly by the host program logic code.

Again, by eliminating " SELECT * " and only specifying exact columns, in your SELECT, future structure changes will not, negatively, impact the execution of the host program. Although, the program would have to be modified to include any/all newly added column(s) to said structure(s).

Thank you and hope this helps, muchly!

;-]
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Dynamically pass table name to a sele... DB2 2
No new posts SELECT from data change table DB2 5
No new posts Select two different counts from SQL... DB2 6
No new posts JOIN STATEMENT PERFORMANCE. DFSORT/ICETOOL 12
No new posts Select a DB2 value in a specific deci... DB2 4
Search our Forums:

Back to Top