Page 1 of 1

Can we define DB2 columns dynamically?

PostPosted: Mon Nov 25, 2013 7:11 pm
by Raj2006
Hi all,

Please help me...

Can we define a DB2 column dynamically as below?

This works in cobol. My requirement like this 11/25/2013 + 50 DAYS = 01/14/2014

SELECT (DATE(:IN-DATE) + PERIOD_A DAYS) +
FROM TABLEX WITH UR

EX:
PERIOD_A COLUMN HAS:
--------
50


I am getting -418 sqlcode, Could you help me to fix this?

Re: Can we define DB2 columns dynamically?

PostPosted: Mon Nov 25, 2013 9:26 pm
by Akatsukami
If you read and understand the first cause for SQLCODE -418, you will realize the error in your SQL.

Re: Can we define DB2 columns dynamically?

PostPosted: Mon Nov 25, 2013 11:11 pm
by Raj2006
Hello Akatsukami,

Could you please explain me to understand this parameter marker?

Re: Can we define DB2 columns dynamically?

PostPosted: Mon Nov 25, 2013 11:37 pm
by Akatsukami
Raj2006 wrote:Hello Akatsukami,

Could you please explain me to understand this parameter marker?

A parameter marker is a placeholder in a SQL statement for a value obtained at run time. In dynamic SQL, the parameter marker is a question mark; in static SQL, it is the name of a host language variable prefixed with a colon.