Bash – String veryfication method

I have a lot of Teradata SQL files (example code of one of this file is below).

create multiset volatile table abc_mountain_peak as(
select 
a.kkpp_nip as nip,
from BM_RETABLE_BATOK.EDETON a 
) with data on commit preserve rows;

create multiset table qazxsw_asd_1 as (
select
a.address_id,
from  DE30T_BIOLOB.HGG994P_ABS_ADDRESS_TRE a,
) with data on commit preserve rows;

create multiset volatile table xyz_sea_depth as(
select 
a.trip,
from tele_line_tryt a
) with data on commit preserve rows;

CREATE multiset table wsxzaq_zxc_2 AS ( 
SELECT
a.bend_data 
FROM lokl_station a , 
) WITH data on commit preserve rows;

CREATE multiset table rfvbgt_ttuop_3 AS ( 
SELECT
a.heret_bini 
FROM fvgty_blumion a , 
) WITH data on commit preserve rows;

DROP qazxsw_asd_1;
DROP wsxzaq_zxc_2;

.EXIT

What I need to do is to create a script (bash), which could verify if the multist tables are dropped.
There are created two kinds of tables:

  • multiset volatile tables (which shouldn’t be dropped), and
  • multiset tables (which must be dropped)

In my example code, 2 of 3 multiset tables are dropped (which is correct), and one of them is not (which is incorrect).
Do You have any idea how to create script which could verify something like that (give information, that one table, or some tables aren’t dropped)? I am really begginer in bash. My idea (could be wrong) is to create array holding a names of the multiset tables (but not a multiset volatile tables), and later create another one table with ‘drop’ and the names of dropped tables, and finaly check if every table from first array is also in second array.
What do You think? Any help will be gratefully appreciate.


Source: unix

Leave a Reply