Quantcast
Channel: Liquibase Forums
Viewing all articles
Browse latest Browse all 2993

Validation and Output

$
0
0
Hi,

In the old sql script we had a validation ( just check if there is any invalid object in the database ), and after the validation if there is any invalid object we were printing the result with the ones that are invalid. This was really useful when you are running the script.

I partially fixed the problem using a precondition, and if there is any invalid object i just finish the execution of the script and i print the error message. But I would like to list the invalid objects also. Any Idea or suggestion ??

Current code:
  1. <!-- Check invalid objects in the Data Base -->
    <changeSet id="DataBaseCheck" author="e-ballo" runAlways="true" >
    <preConditions onFailMessage="There are invalid objects in the database!!" 
    onFail="HALT" >
    <sqlCheck expectedResult="0">
    <![CDATA[
    SELECT count(1)
    FROM all_objects alo
    WHERE status = 'INVALID'
    AND alo.owner in
    ('CIN','NOPA','ORC','PRV','SEC','TIPI_OWNER','TT','ZON');
    ]]>
    </sqlCheck>
    </preConditions>
    <sql>
    <![CDATA[
    SELECT alo.owner
    , alo.object_name
    , alo.status
    , alo.last_ddl_time
    FROM all_objects alo
    WHERE status = 'INVALID'
    AND alo.owner in
    ('CIN','NOPA','ORC','PRV','SEC','TIPI_OWNER','TT','ZON');
    ]]>
    </sql>
    </changeSet>
Thanks in advance


Viewing all articles
Browse latest Browse all 2993

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>