1 Reply Latest reply: Oct 22, 2007 4:36 PM by ydelanoe RSS

    [RESOLVED] AQ enqueuing with Pro*C compilation error


      I'm trying to do a C program to enqueue something in a queue.

      I've got error message at compilation :
      Semantic error at line 32, column 11, file enqueue.ec:
      EXEC SQL ALLOCATE :message;
      PCC-S-02319, expression type does not match usage

      Semantic error at line 37, column 40, file enqueue.ec:
      EXEC SQL OBJECT SET subject, text OF :message TO :sujetMsg, :texteMsg;
      PCC-S-02408, Expecting an expression of some Object type

      I'm working on Oracle 10.2.0 Standard edition.
      Here is the code :

      ora_usertype.h (generated by ott) :
      #ifndef USERTYPE_ORACLE
      # define USERTYPE_ORACLE
      #ifndef OCI_ORACLE
      # include <oci.h>

      typedef OCIRef ydel_typ_ref;

      struct ydel_typ
      OCIString * subject;
      OCIString * text;
      typedef struct ydel_typ ydel_typ;

      struct ydel_typ_ind
      OCIInd _atomic;
      OCIInd subject;
      OCIInd text;
      typedef struct ydel_typ_ind ydel_typ_ind;

      My program :
      #include <stdio.h>
      #include <sql2oci.h>
      #include <sqlca.h>
      #include "ora_usertype.h"

      int main()
           ydel_typ          message=(ydel_typ)0;
           ydel_typ_ind     *imsg;
           char                    sujetMsg[30];
           char                    texteMsg[100];     

           char *sql_connect = "John/Doe";
           EXEC SQL CONNECT :sql_connect;          
           EXEC SQL ALLOCATE :message;
           strcpy(sujetMsg,"THE SUBJECT");
           strcpy(texteMsg,"The message text");     
           EXEC SQL OBJECT SET subject, text OF :message TO :sujetMsg, :texteMsg;          

                message_properties dbms_aq.message_properties_t;
                enqueue_options dbms_aq.enqueue_options_t;
                msgid RAW(16);
                     dbms_aq.enqueue(queue_name => 'ydel_queue',
                     message_properties => message_properties,
                     enqueue_options => enqueue_options,
                     payload => :message:imsg, /* indicator must be specified */
                     msgid => msgid);
           EXEC SQL COMMIT;     
      My compile script :
      proc parse=full sqlcheck=full userid=john/doe mode=oracle release_cursor=
      no maxopencursors=30 unsafe_null=yes dbms=V8 dynamic=ansi type_code=ansi code=ansi_c char_map=STRING include=/products/oracle/precomp/public include=/products/oracle/rdbms/public include=/products/oracle/rdbms/demo include=/products/oracle/plsql/public include=/products/oracle/network/public define=ORA iname=$1 oname=$1.c

      I spent a lot of time searching what's going on but did not found ....
      Help would be .... greatly appreciated.

      Regards all

      Message was edited by: