Error Code

Database
Enthusiast

Error Code

Hi

I am a new user. I have a confusion with the error codes.

I have the following SQL.

SELECT * FROM TEST;

.IF ERRORCODE=0 THEN .GOTO LAB1;

DROP TABLE TEST;

.LABEL LAB1;

INSERT INTO TEST
VALUES(1,2);

Can someone explain what happens in this case?
2 REPLIES
Enthusiast

Re: Error Code

first the following statement will be executed..

1) SELECT * FROM TEST;

If there are any error in this, say the user does not have select access on this table, then the errorcode will be greater than 0. which means that the following statement will not hold true and the control proceeds to step 3.

2) .IF ERRORCODE=0 THEN .GOTO LAB1;

If Step 1 executes successfully, the errorcode will be equal to 0 and in this case the ".GOTO LAB1" will take the control directly to step 4. Step 3 will be skipped.

3) DROP TABLE TEST;

.LABEL LAB1;

4) INSERT INTO TEST
VALUES(1,2);
This query inserts a row into the table TEST.

Hope this helps!
Enthusiast

Re: Error Code

kondal

thanks for the clarification...it helped..