cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Did Alter Actually Alter?

0 Kudos
1,903

Is there a way to tell whether an Alter statement made changes to what was already there?

For example if I have a view that says XYZ and I use an alter statement to alter it to the same exact thing (XYZ) is there a way to tell that as opposed to an alter statement that made a change from the original?

Accepted Solutions (1)

Accepted Solutions (1)

VolkerBarth
Contributor
0 Kudos

DDL statements don't have return values (except the error codes when they fail).

I guess you just would have to compare the object's definition before and after the ALTER statement, e.g. compare for views whether sysview.view_def has changed. The same would apply to ALTER TABLE with (identically) altered or renamed columns or constraints and the according catalog tables.

Note that for all objects with "source code" (like view or procedure definitions) the actual SQL statement is typically stored in a "source" column in the according system tables - at least if the option preserve_source_format is set (as default).

In my experience, those "source definitions" are better suited for comparisons because different SA versions might store the parsed definitions of identical objects somewhat differently. As a consequence, when comparing the reload files of migrated databases, I often notice differences in the parsed definitions w.r.t. line breaks, position of "end if" statements and the like. - However, when comparing the "source definitions", those artificial differences should not appear.

Answers (0)