View previous topic :: View next topic
|
Author |
Message |
anju subrahmanian
New User
Joined: 11 Jul 2010 Posts: 21 Location: Bangalore
|
|
|
|
In my cobol program, am using dynamic sql, but 'PREPARE' statement gives me an sql code -312 at run time. Please find details below
EXEC SQL
PREPARE SQLSTMT FROM :WS-SQL-STATEMENT
END-EXEC.
where WS-SQL-STATEMENT contains below sql statement
UPDATE tablename
SET UNT_PAR_VALUE_AMNT = :FUND-UNT-PAR-VALUE-AM
WHERE SPNSR_NO = :FUND-SPONSOR-NO AND
SPONSR_FUND_NO = :FUND-SPONSR-FUND-NO
variable FUND-UNT-PAR-VALUE-AM is defined in a copybook and the same is included in cobol program using 'sql include' statement.
Below is error I get.
SQLCODE = -312, ERROR: FUND IS AN UNDEFINED OR UNUSABLE HOST
VARIABLE OR IS USED IN A DYNAMIC SQL STATEMENT OR A TRIGGER
DEFINITION
What could be the reason for error...... |
|
Back to top |
|
|
anju subrahmanian
New User
Joined: 11 Jul 2010 Posts: 21 Location: Bangalore
|
|
|
|
Can we use host variables in Dynamic SQL statement? |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
Back to top |
|
|
anju subrahmanian
New User
Joined: 11 Jul 2010 Posts: 21 Location: Bangalore
|
|
|
|
Dick, thanks a lot for the document.
Looks like we cannot use host variables in dynamic sql. But the whatever I am trying to achieve becomes difficult.
My requirement is below.
I want to update a table, but the columns of the table that need to updated is not fixed. i.e, for example this time I want to update only one coulmn of the table, but in a different situation I have to update 2 or 3 columns. |
|
Back to top |
|
|
|