Can we define DB2 columns dynamically?



Unicenter CA-Easytrieve Plus Report Generator: CA's information retrieval and data management tool

Can we define DB2 columns dynamically?

Postby Raj2006 » Mon Nov 25, 2013 7:11 pm

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?
Raj2006
 
Posts: 17
Joined: Thu Jul 18, 2013 2:13 pm
Has thanked: 16 times
Been thanked: 0 time

Re: Can we define DB2 columns dynamically?

Postby Akatsukami » Mon Nov 25, 2013 9:26 pm

If you read and understand the first cause for SQLCODE -418, you will realize the error in your SQL.
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1058
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

Re: Can we define DB2 columns dynamically?

Postby Raj2006 » Mon Nov 25, 2013 11:11 pm

Hello Akatsukami,

Could you please explain me to understand this parameter marker?
Raj2006
 
Posts: 17
Joined: Thu Jul 18, 2013 2:13 pm
Has thanked: 16 times
Been thanked: 0 time

Re: Can we define DB2 columns dynamically?

Postby Akatsukami » Mon Nov 25, 2013 11:37 pm

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.
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day

These users thanked the author Akatsukami for the post:
Raj2006 (Tue Nov 26, 2013 12:35 am)
User avatar
Akatsukami
Global moderator
 
Posts: 1058
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times


Return to CA-Easytrieve

 


  • Related topics
    Replies
    Views
    Last post