DB2 ⭐ Featured
👁 0

Q: What is dynamic SQL?

Answer:
Dynamic SQL constructed at runtime. PREPARE creates executable. EXECUTE runs it. EXECUTE IMMEDIATE for one-time. DECLARE CURSOR for queries. More flexible but less efficient than static. Security concerns (injection).
DB2 ⭐ Featured
👁 0

Q: How to handle CLOB in COBOL?

Answer:
Declare: 01 CLOB-VAR SQL TYPE IS CLOB(1M). Or use LOB locator: 01 CLOB-LOC SQL TYPE IS CLOB_LOCATOR. FREE LOCATOR releases. DBMS_LOB procedures for manipulation. Large CLOBs need special handling.
DB2 ⭐ Featured
👁 0

Q: What is indicator variable?

Answer:
Indicator variable detects NULL values. Declare: 01 col-var. 01 col-ind PIC S9(4) COMP. Use: INTO :col-var:col-ind. If col-ind < 0, value is NULL. Set indicator negative to insert NULL. Required for nullable columns.
DB2
👁 0

Q: Explain host variable rules

Answer:
Host variables prefixed with : in SQL. Declare in WORKING-STORAGE. Must be compatible types. Use indicator for NULL. Cannot use in dynamic object names. VARCHAR needs two-part structure in COBOL.
COBOL
👁 0

Q: What is WORKING-STORAGE SECTION?

Answer:
WORKING-STORAGE SECTION declares program variables. Initialized at program load. Retains values between CALL invocations unless INITIAL program. Define all work areas, flags, counters, tables here. 01-49 levels for data, 77 for independent items.
DB2
👁 0

Q: Explain DECLARE CURSOR syntax

Answer:
DECLARE cursor-name CURSOR FOR SELECT... WITH HOLD keeps open after COMMIT. WITH RETURN returns to caller. FOR UPDATE OF allows positioned update. FOR READ ONLY optimizes read. ORDER BY for sorting. Static or dynamic declaration.
DB2
👁 0

Q: What is FETCH SENSITIVE cursor?

Answer:
SENSITIVE cursor reflects concurrent changes by other processes. EXEC SQL DECLARE cursor SENSITIVE STATIC/DYNAMIC SCROLL CURSOR. INSENSITIVE does not see changes. Affects isolation behavior. Consider performance impact.