Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

verify errors in bteq

Status
Not open for further replies.

forumbo

Programmer
Nov 23, 2004
3
ES
Hello:

This is my first question in this forum.

If I have some "updates", "inserts",.... in one bteq, and I want to verify if each operation is ok, How can I do this? I don't want to have a label error for each operation. Could I use variables to indicate which is the error and then goto a unique label error?

For example:

insert into tmp_table select 20,*,0,0,0 from x;
.if errorcode <> 0 THEN .goto label1;

update tmp_table set mm='hello'
.if errorcode <> 0 THEN .goto label2;

Is it posible
insert into tmp_table select 20,*,0,0,0 from x;
.if errorcode <> 0 THEN ERRORVARIABLE='Error in insert' .goto label1;

update tmp_table set mm='hello'
.if errorcode <> 0 THEN ERRORVARIABLE='Error in update' .goto label1;

.label 1
insert into error_table (ERRORVARIABLE)
.quit errorcode



Thanks and sorry for my English
 
Hi,
What is the relationship between the INSERT and the UPDATE? are you trying to verify the INSERT and if that fails do the UPDATE on the same row?

Teradata has a UPSERT SQL statement.

Update set ....
else
Insert .....


you might want to look at the thread


This is a Link to the thread in the archive. It might not be available in the archive until next week.
 
Thanks tdatgod.

However, I have to say that there is no relationship between INSERT and UPDATE in my bteq.

In fact, I want to run multiple SQL statements and I want to control each one (there is no relationship between them). I am looking for the way to avoid having many error labels, I mean, I would like to have a variable (UNIX VARIABLE?)that contains the description error, if this happens, and then in my unique error label, insert the value of this variable into a table.

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top