Re: Using ALERT in a ProC program

2003-07-22 Thread Lendvary Gyurika
On Tue, 22 Jul 2003, you wrote:
 Hi Gyuri,
 
 Why not dispense with the dbms_output in main() and simply use printf or
 fprintf? If you want to keep it then you need to call
 dbms_output.enable(100); before you call put_line, i have found that
 you also need to call dbms_output.disable; first before the enable
 (never found out why?).
 
 Also in your fAlertWatch function you use printf(buff) to print out the
 buffer in the case of a timeout but when you receive a message you use
 sprintf to format your buffer but then don't print it out?.
 
 hth
 
 kind regards
 
 Pete

Hi Pete,

I use DBMS_OUTPUT because I am curious how it works. When I use printf, there is
no problem with printing on terminal (dbms_output.enable(100); doesn't
help). But my main problem is about using alert. I'd like to catch an alert
with a ProC program, but I can't catch. It works in a PL/SQL script, but not in
ProC. Why?

Thanks: Gyuri
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: Lendvary Gyurika
  INET: [EMAIL PROTECTED]

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: [EMAIL PROTECTED] (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).



RE: Using ALERT in a ProC program

2003-07-22 Thread Jamadagni, Rajendra
Title: RE: Using ALERT in a ProC program





stupid_question
are you commiting after you send the alert? dbms_alert is transactional ...


/stupid_question


Raj

Rajendra dot Jamadagni at nospamespn dot com
All Views expressed in this email are strictly personal.
QOTD: Any clod can have facts, having an opinion is an art !



-Original Message-
From: Lendvary Gyurika [mailto:[EMAIL PROTECTED]]
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;
 END-EXEC;


 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 ;
 }
 sprintf ( buff, \nAlert %s Received :%s / %d\n, 
 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: [EMAIL PROTECTED]


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: [EMAIL PROTECTED] (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).



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


RE: Using ALERT in a ProC program

2003-07-22 Thread Goulet, Dick
Folks,

Unless I'm totally wrong I believe I remember seeing an article on DBMS_OUTPUT 
on Metalink that specifically states that it's for use in SQL*Plus for debuging PL/SQL 
programs only.  Therefore it's rather useless anywhere else.

Dick Goulet
Senior Oracle DBA
Oracle Certified 8i DBA

-Original Message-
Sent: Tuesday, July 22, 2003 10:04 AM
To: Multiple recipients of list ORACLE-L


On Tue, 22 Jul 2003, you wrote:
 Hi Gyuri,
 
 Why not dispense with the dbms_output in main() and simply use printf or
 fprintf? If you want to keep it then you need to call
 dbms_output.enable(100); before you call put_line, i have found that
 you also need to call dbms_output.disable; first before the enable
 (never found out why?).
 
 Also in your fAlertWatch function you use printf(buff) to print out the
 buffer in the case of a timeout but when you receive a message you use
 sprintf to format your buffer but then don't print it out?.
 
 hth
 
 kind regards
 
 Pete

Hi Pete,

I use DBMS_OUTPUT because I am curious how it works. When I use printf, there is
no problem with printing on terminal (dbms_output.enable(100); doesn't
help). But my main problem is about using alert. I'd like to catch an alert
with a ProC program, but I can't catch. It works in a PL/SQL script, but not in
ProC. Why?

Thanks: Gyuri
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: Lendvary Gyurika
  INET: [EMAIL PROTECTED]

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: [EMAIL PROTECTED] (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).

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: Goulet, Dick
  INET: [EMAIL PROTECTED]

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: [EMAIL PROTECTED] (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).


RE: Using ALERT in a ProC program

2003-07-22 Thread Lendvary Gyuri
-Original Message-
 are you commiting after you send the alert? dbms_alert is transactional ...

Yes, of course I execute a commit after sending an alert. Here is my sql
script, that sends an alert:

set serveroutput on size 100
set echo off
set term on
set lines 80

DECLARE

 message  VARCHAR2(50);
 status   VARCHAR2(50);

BEGIN

 sys.dbms_alert.signal( 'prolan_alert','prolan_comment' );
 commit;
END;
/

When I try to catch an alert from another sql script (running in an sqlplus
terminal), there is no problem. It can catch the alert. When I try to catch
from a ProC program (listed in my first letter), it doesn't work. The program
doesn't get the alert.

Thanks: Gyuri

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: Lendvary Gyuri
  INET: [EMAIL PROTECTED]

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: [EMAIL PROTECTED] (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).