problem executing a procedure [message #293795] |
Tue, 15 January 2008 01:54 |
dinuka
Messages: 30 Registered: January 2008 Location: Sri Lanka
|
Member |
|
|
Hi,
I wrote the following procedure.
CREATE OR REPLACE PROCEDURE sequence_no(pref IN char, lotsize IN integer, newseqno OUT integer)
AS
seqnew integer:=0;
BEGIN
SELECT SEQ_NO INTO newseqno from SEQUENCENUMBERS WHERE PREFIX = pref;
seqnew:= newseqno + lotsize;
UPDATE SEQUENCENUMBERS SET SEQ_NO=seqnew WHERE PREFIX = pref;
END sequence_no;
/
what this does is basically get the sequence number from the table and then update that value to the 'seqnew' value. And i have written the following code in c++ to call this procedure. But i get a segmentation fault when i try to do this. Is the procedure wrong?
Statement * seqst;
seqst = conn->createStatement();
seqst->setAutoCommit(true);
int seqno = 0;
seqst->setSQL("BEGIN sequence_no(:1, :2,:3); END:");
int quantity;
int sq = 100;
seqst->setString(1, "orders");
seqst->setInt(2,sq);
seqst->registerOutParam(3,OCCIINT, sizeof(quantity));
seqst->executeUpdate();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: problem executing a procedure [message #293848 is a reply to message #293795] |
Tue, 15 January 2008 04:49 |
vicenzo
Messages: 28 Registered: December 2007 Location: Paris
|
Junior Member |
|
|
What tool are you using (GCC, MS Visual studio, borland ?)
Are you using the correct dlls for your compiler ? (Because occi is provided for specifics compilers and versions).
Make sure the dll you're using are the ones made for your compiler and its version.
Are you using unicode / ansi ?
As Michel said, first correct your pl/sql block (ending by ';' and not ':')
Your problem is still the same than the getString() one and i think it must linked to the dlls or the charset for getting an seg fault with the given code...
|
|
|
|
|
|