Re: Pro *C
Date: Wed, 01 Sep 1999 15:33:48 GMT
Message-ID: <37d346b4.104215674_at_newshost.us.oracle.com>
A copy of this was sent to sgundu_at_tdcs.tel.gte.com (sgundu) (if that email address didn't require changing) On 1 Sep 1999 14:48:33 GMT, you wrote:
>Hello everyone,
>
> I am using the DBMS_PIPE to send an e-mail from database.
>The Pro*C program is working fine and sending the e-mails. What's
>happening is suppose if the database is shutdown, it is keep sending the
>last email infinetly, till i kill the process.
>
>Does anybody know what kind of error handling i have to implement...to
>stop sending emails infinetly..when the database shutsdown?
>
>
>Thanks
what kind of error handling do you have now (sounds like none)....
try putting
EXEC SQL WHENEVER SQLERROR DO sqlerror();
before your EXEC SQL statement for reading on the pipe and then code:
#define sqlerror() sqlerror_hard( __LINE__, __FILE__, sqlstm.stmt )
static void sqlerror_hard( lineno, filename, sqlstmt )
int lineno;
char * filename;
{
char errmsg[513];
int length; int real_length = sizeof(errmsg);
EXEC SQL WHENEVER SQLERROR CONTINUE;
printf("\nORACLE error detected (%s, %d):", filename, lineno ); printf("\n%s\n", sqlstmt ); sqlglm( errmsg, &real_length, &length );errmsg[length] = 0;
printf("\n%s\n", errmsg );
exit(1);
}
that should catch the error, report it and bail out of the program.
-- See http://govt.us.oracle.com/~tkyte/ for my columns 'Digging-in to Oracle8i'... Current article is "Part I of V, Autonomous Transactions" updated June 21'st Thomas Kyte tkyte_at_us.oracle.com Oracle Service Industries Reston, VA USA Opinions are mine and do not necessarily reflect those of Oracle CorporationReceived on Wed Sep 01 1999 - 17:33:48 CEST