Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: Using ALERT in a ProC program
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------=_NextPartTM-000-d14e89f0-38e2-4647-b306-251589d8f852 Content-Type: multipart/alternative;
boundary="----_=_NextPart_001_01C35054.43CA7775"
------_=_NextPart_001_01C35054.43CA7775
Content-Type: text/plain;
charset="iso-8859-1"
<stupid_question>
are you commiting after you send the alert? dbms_alert is transactional ...
</stupid_question>
Raj
-----Original Message-----
From: Lendvary Gyurika [mailto:gyurika_at_prolan.hu]
Sent: Tuesday, July 22, 2003 6:19 AM
To: Multiple recipients of list ORACLE-L
Subject: Using ALERT in a ProC program
Hi,
Thank you very much for your help, I can compile my program, but
unfortulately
it doesn't work. I'd like to use ALERT to notify my program about an event.
Alert works, when I run two sql scripts in two sqlplus terminals. One of
them is
listening for an alert and the other one sends an alert.
But now, my C program is listening for an alert, and I send an alert by my
sql script. The C program doesn't get the alert. The other problem is, that
dbms_output.putline doesn't work also. It writes nothing to the terminal.
Here
is a part of my program:
static void fAlertRegister ()
{
printf("\nAlert Register\n");
EXEC SQL EXECUTE
BEGIN
sys.dbms_alert.register( 'prolan_alert' );
END;
END-EXEC;
EXEC SQL COMMIT WORK;
}
static void fAlertWatch ()
{
char buff[256];
printf("\nAlert Watch\n");
h_timer = 35 ; /* initial timeout in sec */
while ( 1 )
{
EXEC SQL EXECUTE
BEGIN sys.dbms_alert.waitany( :h_name, :h_message, :h_status, :h_timer); END;
h_name.arr[h_name.len]='\0'; h_message.arr[h_message.len]='\0'; h_timer = 35 ; /* sec the subsequent timeouts - default */if ( h_status != 0 ) /* timeout */
sprintf ( buff, "\nAlert (%d sec) Timed Out. / %d\n", (int)h_timer, (int)h_status ); printf(buff); continue ;
h_name.arr, h_message.arr, (int)h_status );
}
}
int main(int argc, char **argv)
{
EXEC SQL EXECUTE
BEGIN
SYS.DBMS_OUTPUT.PUT_LINE('It's a demo program');
END;
END-EXEC;
fAlertRegister ();
fAlertWatch ();
}
Does anybody have an idea, what the solution is?
Thanks a lot:
Gyuri
-- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Lendvary Gyurika INET: gyurika_at_prolan.hu Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services --------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). ------_=_NextPart_001_01C35054.43CA7775 Content-Type: text/html; charset="iso-8859-1"Received on Tue Jul 22 2003 - 08:22:14 CDT
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2654.45">
<TITLE>RE: Using ALERT in a ProC program</TITLE>
</HEAD>
<BODY>
<P><FONT SIZE=2><stupid_question></FONT>
<BR><FONT SIZE=2>are you commiting after you send the alert? dbms_alert is transactional ...</FONT>
</P>
<P><FONT SIZE=2></stupid_question></FONT>
</P>
<P><FONT SIZE=2>Raj</FONT>
<BR><FONT SIZE=2>--------------------------------------------------------------------------------</FONT>
<BR><FONT SIZE=2>Rajendra dot Jamadagni at nospamespn dot com</FONT>
<BR><FONT SIZE=2>All Views expressed in this email are strictly personal.</FONT>
<BR><FONT SIZE=2>QOTD: Any clod can have facts, having an opinion is an art !</FONT>
</P>
<BR>
<P><FONT SIZE=2>-----Original Message-----</FONT>
<BR><FONT SIZE=2>From: Lendvary Gyurika [<A HREF="mailto:gyurika_at_prolan.hu">mailto:gyurika_at_prolan.hu</A>]</FONT>
<BR><FONT SIZE=2>Sent: Tuesday, July 22, 2003 6:19 AM</FONT>
<BR><FONT SIZE=2>To: Multiple recipients of list ORACLE-L</FONT>
<BR><FONT SIZE=2>Subject: Using ALERT in a ProC program</FONT>
</P>
<BR>
<P><FONT SIZE=2>Hi,</FONT>
</P>
<P><FONT SIZE=2>Thank you very much for your help, I can compile my program, but unfortulately</FONT>
<BR><FONT SIZE=2>it doesn't work. I'd like to use ALERT to notify my program about an event.</FONT>
<BR><FONT SIZE=2>Alert works, when I run two sql scripts in two sqlplus terminals. One of them is</FONT>
<BR><FONT SIZE=2>listening for an alert and the other one sends an alert. </FONT>
<BR><FONT SIZE=2>But now, my C program is listening for an alert, and I send an alert by my</FONT>
<BR><FONT SIZE=2>sql script. The C program doesn't get the alert. The other problem is, that</FONT>
<BR><FONT SIZE=2>dbms_output.putline doesn't work also. It writes nothing to the terminal. Here</FONT>
<BR><FONT SIZE=2>is a part of my program:</FONT>
</P>
<P><FONT SIZE=2>static void fAlertRegister ()</FONT>
<BR><FONT SIZE=2>{</FONT>
<BR><FONT SIZE=2> printf("\nAlert Register\n");</FONT>
<BR><FONT SIZE=2> EXEC SQL EXECUTE</FONT>
<BR><FONT SIZE=2> BEGIN</FONT>
<BR><FONT SIZE=2> sys.dbms_alert.register( 'prolan_alert' );</FONT>
<BR><FONT SIZE=2> END;</FONT>
<BR><FONT SIZE=2> END-EXEC;</FONT>
<BR><FONT SIZE=2> EXEC SQL COMMIT WORK;</FONT>
<BR><FONT SIZE=2>}</FONT>
</P>
<P><FONT SIZE=2>static void fAlertWatch ()</FONT>
<BR><FONT SIZE=2>{</FONT>
<BR><FONT SIZE=2> char buff[256];</FONT>
</P>
<P><FONT SIZE=2> printf("\nAlert Watch\n");</FONT>
<BR><FONT SIZE=2> h_timer = 35 ; /* initial timeout in sec */</FONT>
<BR><FONT SIZE=2> while ( 1 )</FONT>
<BR><FONT SIZE=2> {</FONT>
<BR><FONT SIZE=2> EXEC SQL EXECUTE</FONT>
<BR><FONT SIZE=2> BEGIN</FONT>
<BR><FONT SIZE=2> sys.dbms_alert.waitany( :h_name, :h_message, :h_status, :h_timer);</FONT>
<BR><FONT SIZE=2> END;</FONT>
<BR><FONT SIZE=2> END-EXEC;</FONT>
</P>
<P><FONT SIZE=2> h_name.arr[h_name.len]='\0';</FONT>
<BR><FONT SIZE=2> h_message.arr[h_message.len]='\0';</FONT>
<BR><FONT SIZE=2> h_timer = 35 ; /* sec the subsequent timeouts - default */</FONT>
<BR><FONT SIZE=2> if ( h_status != 0 ) /* timeout */</FONT>
<BR><FONT SIZE=2> {</FONT>
<BR><FONT SIZE=2> sprintf ( buff, "\nAlert (%d sec) Timed Out. / %d\n",</FONT>
<BR><FONT SIZE=2> (int)h_timer, (int)h_status );</FONT>
<BR><FONT SIZE=2> printf(buff);</FONT>
<BR><FONT SIZE=2> continue ;</FONT>
<BR><FONT SIZE=2> }</FONT>
<BR><FONT SIZE=2> sprintf ( buff, "\nAlert <%s> Received :%s / %d\n", </FONT>
<BR><FONT SIZE=2> h_name.arr, h_message.arr, (int)h_status );</FONT>
<BR><FONT SIZE=2> }</FONT>
<BR><FONT SIZE=2>}</FONT>
</P>
<P><FONT SIZE=2>int main(int argc, char **argv)</FONT>
<BR><FONT SIZE=2>{</FONT>
<BR><FONT SIZE=2> EXEC SQL EXECUTE</FONT>
<BR><FONT SIZE=2> BEGIN</FONT>
<BR><FONT SIZE=2> SYS.DBMS_OUTPUT.PUT_LINE('It's a demo program');</FONT>
<BR><FONT SIZE=2> END;</FONT>
<BR><FONT SIZE=2> END-EXEC;</FONT>
<BR><FONT SIZE=2> </FONT>
<BR><FONT SIZE=2> fAlertRegister ();</FONT>
<BR><FONT SIZE=2> fAlertWatch ();</FONT>
<BR><FONT SIZE=2>}</FONT>
</P>
<P><FONT SIZE=2>Does anybody have an idea, what the solution is?</FONT>
</P>
<P><FONT SIZE=2>Thanks a lot: </FONT>
<BR><FONT SIZE=2> Gyuri</FONT>
<BR><FONT SIZE=2>-- </FONT>
<BR><FONT SIZE=2>Please see the official ORACLE-L FAQ: http://www.orafaq.net</FONT>
<BR><FONT SIZE=2>-- </FONT>
<BR><FONT SIZE=2>Author: Lendvary Gyurika</FONT>
<BR><FONT SIZE=2> INET: gyurika_at_prolan.hu</FONT>
</P>
<P><FONT SIZE=2>Fat City Network Services -- 858-538-5051 http://www.fatcity.com</FONT>
<BR><FONT SIZE=2>San Diego, California -- Mailing list and web hosting services</FONT>
<BR><FONT SIZE=2>---------------------------------------------------------------------</FONT>
<BR><FONT SIZE=2>To REMOVE yourself from this mailing list, send an E-Mail message</FONT>
<BR><FONT SIZE=2>to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in</FONT>
<BR><FONT SIZE=2>the message BODY, include a line containing: UNSUB ORACLE-L</FONT>
<BR><FONT SIZE=2>(or the name of mailing list you want to be removed from). You may</FONT>
<BR><FONT SIZE=2>also send the HELP command for other information (like subscribing).</FONT>
</P>
</BODY>
</HTML>
------_=_NextPart_001_01C35054.43CA7775-- ------=_NextPartTM-000-d14e89f0-38e2-4647-b306-251589d8f852 Content-Type: text/plain; name="ESPN_Disclaimer.txt" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="ESPN_Disclaimer.txt" ********************************************************************This e-mail message is confidential, intended only for the named recipient(s) above and may contain information that is privileged, attorney work product or exempt from disclosure under applicable law. If you have received this message in error, or are not the named recipient(s), please immediately notify corporate MIS at (860) 766-2000 and delete this e-mail message from your computer, Thank you.*********************************************************************2
![]() |
![]() |