Home » Developer & Programmer » Precompilers, OCI & OCCI » [RESOLVED] Pro*C compilation error / Object type / AQ
[RESOLVED] Pro*C compilation error / Object type / AQ [message #275754] Mon, 22 October 2007 10:29 Go to next message
ydelanoe
Messages: 4
Registered: October 2007
Junior Member
Hi

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;
..........1
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;
.......................................1
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>
#endif

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;

#endif
-------------------------------------------------------------------------------------------
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;

EXEC SQL EXECUTE
DECLARE
message_properties dbms_aq.message_properties_t;
enqueue_options dbms_aq.enqueue_options_t;
msgid RAW(16);
BEGIN
dbms_aq.enqueue(queue_name => 'ydel_queue',
message_properties => message_properties,
enqueue_options => enqueue_options,
payload => :message:imsg, /* indicator must be specified */
msgid => msgid);
END;
END-EXEC;
EXEC SQL COMMIT;
return(0);
}

-------------------------------------------------------------------------------------------------------------------
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
Yd

[Updated on: Mon, 22 October 2007 11:33]

Report message to a moderator

Re: Pro*C compilation error / Object type / AQ [message #275777 is a reply to message #275754] Mon, 22 October 2007 11:32 Go to previous messageGo to next message
ydelanoe
Messages: 4
Registered: October 2007
Junior Member
RESOLVED :
Dont forget the proc param :
proc intyp=message_o.typ

with message_o.typ beeing the output file of the ott command.

Regards
Yd
Re: Pro*C compilation error / Object type / AQ [message #275778 is a reply to message #275777] Mon, 22 October 2007 11:36 Go to previous message
Michel Cadot
Messages: 68625
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Thanks for the feedback.

Regards
Michel
Previous Topic: OCI: retrieving string-like data from output parameters effectively
Next Topic: The Best way for connecting solaris c program
Goto Forum:
  


Current Time: Fri Mar 29 04:42:52 CDT 2024