0 Replies Latest reply: Mar 1, 2012 12:58 AM by 919465 RSS

    ORA-00932: inconsistent datatype: expected SYS.ALERT_TYPE

    919465
      Hi,
      I am developing a c# application for getting notifications from SYS.ALERT_QUE (maintained by oracle for alerts). When I try to enque something in queue(SYS.ALERT_QUE) it throws an exception "ORA-00932: inconsistent datatype: expected SYS.ALERT_TYPE". I tried the same code for different queue(cretaed by me in SYS) and it is running fine and getting notification messages too.Do I need to add some additional parameter to access SYS.ALERT_QUE? I am posting the code plz let me know what needs to be done to this code to work for SYS.ALERT_QUE.

      OracleConnection con = new OracleConnection(constr);

      // Create queue
      OracleAQQueue queue = new OracleAQQueue("sys.alert_que", con);

      try
      {
      // Open connection
      con.Open();

      // Set message type for the queue
      queue.MessageType = OracleAQMessageType.Xml;


      queue.NotificationConsumers = new string[1] { "SUBSCRIBER1" };
      // Add the event handler to handle the notification. The
      // MsgReceived method will be invoked when a message is enqueued
      queue.MessageAvailable +=
      new OracleAQMessageAvailableEventHandler(Notification.MsgReceived);

      Console.WriteLine("Notification registered...");

      // Begin txn for enqueue
      OracleTransaction txn = con.BeginTransaction();

      Console.WriteLine("Now enqueuing message...");

      // Prepare messages with XML payload
      OracleAQMessage[] enqMsgs = new OracleAQMessage[1];
      OracleXmlType msg1 = new OracleXmlType(con, "<PERSON><FIRSTNAME>Bob</FIRSTNAME></PERSON>");


      enqMsgs[0] = new OracleAQMessage(msg1);
      OracleAQAgent[] agent = new OracleAQAgent[1];
      agent[0] = new OracleAQAgent("SUBSCRIBER1");
      enqMsgs[0].Recipients = agent;
      enqMsgs[0].SenderId = new OracleAQAgent("SENDER1");

      // Prepare to Enqueue
      queue.EnqueueOptions.Visibility = OracleAQVisibilityMode.OnCommit;

      // Enqueue message array
      queue.EnqueueArray(enqMsgs);
      txn.Commit();



      // Loop while waiting for notification
      while (isNotified == false)
      {
      System.Threading.Thread.Sleep(2000);
      }
      }
      catch (Exception e)
      {
      Console.WriteLine("Error: {0}", e.Message);
      }