Is DECLARE TABLE in DCLGEN necessary? Why it used?
Answers were Sorted based on User's Feedback
Answer / obularaju
It not necessary to have DECLARE TABLE statement in
DCLGEN. This is used by the pre-compiler to validate the
table-name, view-name, column name etc., during pre-compile
| Is This Answer Correct ? | 8 Yes | 1 No |
Answer / abhishek singh
DECLARE TABLE, that is table structure of DCLGEN is NOT really needed for pre-compilation. But if it is used, then any misspelled table name, column names are trapped in pre-compilation stage itself.
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / satty
yes, it is necessary to have declare table in dclgen.
without declaring the table we cant able to define the host
variable of what data type and length of data type.... the
not needed part is
dclgen table(xxxx)
library(yyyy)
action(add)
quote
this is not needed because the declare and host variable
definition can be hard coded into the pgm.
| Is This Answer Correct ? | 2 Yes | 5 No |
SET is the ANSI standard for variable assignment, SELECT is not. SET can only assign one variable at a time, SELECT can make multiple assignments at once. If assigning from a query, SET can only assign a scalar value. If the query returns multiple values/rows then SET will raise an error. SELECT will assign one of the values to the variable and hide the fact that multiple values were returned (so you'd likely never know why something was going wrong elsewhere - have fun troubleshooting that one) When assigning from a query if there is no value returned then SET will assign NULL, where SELECT will not make the assignment at all (so the variable will not be changed from it's previous value) As far as speed differences - there are no direct differences between SET and SELECT. However SELECT's ability to make multiple assignments in one shot does give it a slight speed advantage over SET.
What is the specific need of Plan and..where are the tables in DB2 are physically saved
What is the difference between primary key & unique index ?
What is the cascade rule and how does it relate to deletions made with a subselect?
If the cursor is kept open followed the issuing of commit, what is the procedure to leave the cursor that way?
What are the isolation levels possible ?
What is meant by the attachment facility?
What is load utility in db2?
How do I create a table MANAGER (EMP-NO, MANAGER) where MANAGER is a foreign key which references to EMP-NO in the same table? Give the exact DDL.
What techniques are used to retrieve data from more than one table in a single SQL statement?
What do you mean by between and in? Is between inclusive of specified range values?
What are the two types of logging in the db2 database? Explain them.