Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Using ALERT in a ProC program

Using ALERT in a ProC program

From: Lendvary Gyurika <gyurika_at_prolan.hu>
Date: Tue, 22 Jul 2003 11:03:41 +0200
Message-Id: <25988.338865@fatcity.com>


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? Received on Tue Jul 22 2003 - 04:03:41 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US