Hi,
use awk, like e.g. :
[EMAIL PROTECTED]:~/eclipse_workspace/SDMS/src> sql sdmsdb2 < /tmp/x | awk '
> BEGIN { do_print = 0 }
> /^E_/ { do_print = 1 }
> /^continue/ { do_print = 0 }
> do_print == 1 { print }
> '
E_US0845 Table 'table_does_not_exist' does not exist or is not owned by
you.
(Mon Feb 20 08:45:31 2006)
The /tmp/x script looks like
select * from table_does_not_exist;
\p\g
select count(*) from iitables;
\p\g
The main problem is not to catch the error messages, it is the transaction
logic. So if your script tries to perform multi-statement transactions,
you'll end up with an inconsistent database (if you are unlucky, and
programmers better not count on their luck).
HTH,
Ronald
On 20 Feb 2006 10:25:50 +0530
Ajay Dalvi <[EMAIL PROTECTED]> wrote:
> Hi Paul,
> First of all Thanks for your reply.
> I am still having one problem. I have to actually log the full error
> description. As in your case, the output of the sql command will be in
> mylog file, but it will contain other statements apart from errors, but
> I want to log only error messages.
> Grrepping E_ will be usefull only if the error description is of one
> line.
> If error description is more than one line for e.g.
>
> E_XF0019 There was a table or view specified on the command line that
> does
> not exist or is not owned by you, or has been supplied more than
> once.
>
> In this case, If we grep it using E_ then we will get only first line.
> For this I am trying to create regular expression which wll grep error
> msg with multiple lines description.
> If you can provide some help for this, it will be helpfull for me.
>
> -Ajay
>
>
--
independIT Integrative Technologies GmbH
Sitz der Gesellschaft: Schrobenhausen
HRB Neuburg B 1.521
Geschäftsführer:
Dieter Stubler, Dipl. Inform. (FH)
Ronald Jeninga, Diplom Mathematiker
_______________________________________________
Users mailing list
[email protected]
http://ingres.ca.com/mailman/listinfo/users