sathyaram_s
03-21-03, 08:54
| My aim is to print out all SQLSTATE message lines(paragrahs) from the command outputs of SQL Statements. I will not be interested about a couple of SQLSTATE values. Currently I have the SQL's output in sql.out and a list of SQLSTATES to be ignored in ignore_state.txt and I use the following command: cat sql.out | grep -p SQLSTATE | grep -vp -fignore_state.txt There should be a more elegant way to do this, I hope ... Any suggestions ? As an example : sql.out create table t2(i int not null,j int) DB20000I The SQL command completed successfully. create index ix2 on t2(i) DB20000I The SQL command completed successfully. alter table t2 add primary key(i) SQL0598W Existing index "SSANNASI.IX2" is used as the index for the primary key or a unique key. SQLSTATE=01550 alter table t3 references t3(j) DB21034E The command was processed as an SQL statement because it was not a valid Command Line Processor command. During SQL processing it returned: SQL0104N An unexpected token "references" was found following "alter table t3 ". Expected tokens may include: "FOREIGN KEY". SQLSTATE=42601 and ignore_state.txt : SQLSTATE=01550 |