Обсуждение: On_error_stop
Hello All,
I want to run few DDL's from scripts and want the script to halt if any error ocuurs, this can be done by on_error_stop
But what I want to do is to display a message something like
If on_error_stop =1
{
echo "DDL failed";
exit();
}
else "DDL passed";
end
is there any way to do this?
Thanks in advance
Ashish...
On 7/3/07, Ashish Karalkar <ashish.karalkar@info-spectrum.com> wrote: > > > Hello All, > > I want to run few DDL's from scripts and want the script to halt if any > error ocuurs, this can be done by on_error_stop > > But what I want to do is to display a message something like > > If on_error_stop =1 > { > echo "DDL failed"; > exit(); > } > > else "DDL passed"; > > end > > is there any way to do this? > > Thanks in advance > Ashish... > AFAIK you cannot write conditional logic within psql. Similar behavior however can be achieved if you run the sql script from within a shell script (via psql) and then check the result status of that command. regards, -- Sibte Abbas EnterpriseDB http://www.enterprisedb.com