Home > database >  SQLCA always return is correct, please help, online, etc
SQLCA always return is correct, please help, online, etc

Time:09-17

PREPARE SQLSA FROM: s2;
The OPEN DYNAMIC my_cursor;
The FETCH my_cursor INTO: s_tday, d_mclose, : int_rcount;
The CLOSE my_cursor;
S3="select tday, McLose from t" + s1 + "where tday='" + s_tday +"' and McLose=1 ";
//tests will be s3="select one from the table where 1=2", sqlcode still returns 0, too depressed, 100
where did you go?The execute immediate: s3;
Messagebox (" delete table ", the sqlca sqlcode);
If the sqlca. Sqlcode & lt;> 100 then//here always returns 0


Test table name to not from the S3, sqlcode return 1
In addition, as long as the statement can pass, return is sqlcode=0, depressing

Consult a warrior help

I'd like to test out the sqlcode=100, thank you

CodePudding user response:

The execute immediate is used to perform did not return a result set of statements, only success and failure, should not be other results

CodePudding user response:

Sqlcode=0 is the execute immediate: s3; Is this sentence to perform a success, don't say the results

CodePudding user response:

The
refer to the original poster zhousanbao response:
PREPARE SQLSA FROM: s2.
The OPEN DYNAMIC my_cursor;
The FETCH my_cursor INTO: s_tday, d_mclose, : int_rcount;
The CLOSE my_cursor;
S3="select tday, McLose from t" + s1 + "where tday='" + s_tday +"' and McLose=1 ";
//tests will be s3="select one from the table where 1=2", sqlcode still returns 0, too depressed, 100
where did you go?The execute immediate: s3;
Messagebox (" delete table ", the sqlca sqlcode);
If the sqlca. Sqlcode & lt;> 100 then//here always returns 0


Test table name to not from the S3, sqlcode return 1
In addition, as long as the statement can pass, return is sqlcode=0, depressing

Consult a warrior help

I'd like to test out the sqlcode=100, thank you


The sqlcode returned in the dynamic SQL is executed successfully, if you need to determine whether there is data, can use sqlnrows try

CodePudding user response:

Agree with upstairs.