What does this mean when SQLCOD = -206? I need to write 2 sets embedded SQL statement in my program.

5 pts.
Tags:
iSeries SQL
SQL statements
SQLRPGLE
System i
what does this mean when SQLCOD = -206. I need to write 2 sets embedded SQL statement in my program. first one is one and I was able to fetch data but the 2nd one has error just right after I declare cursor. Here are the statements EVAL SQLSTMT2 = SELECT_H_2 + WHERE_H_2; + AND_H_A; EXEC SQL PREPARE S2 FROM :SQLSTMT2; EXEC SQL DECLARE S2CURSOR CURSOR2 FOR S2; IF SQLCOD < 0; DUMP; LEAVESR; ENDIF;

Software/Hardware used:
System I

Answer Wiki

Thanks. We'll let you know when a new response is added.

First, you should get away from using SQLCOD (SQLCODEs) and use SQLSTATE instead. SQLSTATE is more standard and is better supported now and into the future.

A quick explanation of a SQLCOD can be found by displaying the associated message identifier. For SQLCOD = -206, the message ID is SQL0206. SQL message IDs should be found in message file QSYS/QSQLMSG. Therefore:<pre>
DSPMSGD SQL0206 MSGF( QSQLMSG )</pre>
The basic text then is “Column &1 not in specified tables.”

Without seeing the value you have in SQLSTMT2, along with the column list for whatever table(s) or view(s) is referenced in SQLSTMT2, there’s not much we can add.

I’d suggest that this:<pre>
EVAL SQLSTMT2 = SELECT_H_2 + WHERE_H_2;
+ AND_H_A;</pre>
…seems a little odd, though.

Tom

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • philpl1jb
    Since your program did a dump can you tell use what as in those 4 varibles..we might have a change at helping. Phil
    49,960 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following