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).

Reply via email to