Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> How to handle object types in C external routines?
Does anybody know how to alter attributes of an object type within an
external C routine?
Whenever I alter attributes of a struct, these changes have no effect. Please see my following example:
Let's assume there is an object type
CREATE OR REPLACE TYPE person AS OBJECT (
NAME VARCHAR2(50), AGE NUMBER, LASTVISIT DATE, MEMBER PROCEDURE testProc(test BINARY_INTEGER),) NOT FINAL; The type body declares "testProc" as follows:
CREATE OR REPLACE TYPE BODY person AS
MEMBER PROCEDURE testProc(test BINARY_INTEGER) AS LANGUAGE C LIBRARY lib_extproc_demo NAME "person_testProc" WITH CONTEXT PARAMETERS ( CONTEXT, test int, test INDICATOR short, SELF, SELF INDICATOR struct );
void person_testProc (OCIExtProcContext * ctx, int test, short test_ind, person* self, person_ind* self_ind){
...
// write value of parameter test into attribute "age" of struct: OCINumber *agePtr = &self->age; error = OCINumberFromInt(err, &test, sizeof(test), OCI_NUMBER_UNSIGNED,agePtr);
...
}
My PL/SQL test script is:
DECLARE
p Person;
BEGIN
p := NEW Person ('Michael', 25, NULL); dbms_output.put_line(p.age); -- should print "25" p.testProc(42); dbms_output.put_line(p.age); -- should print "42", but prints "25", too!END; This script print "25" twice, although the testProc method is called and executed without errors...
I am currently runnign Oracle 10g on a Suse 9.1 Professional system
Any suggestions?
Michael Received on Mon Nov 15 2004 - 09:20:58 CST
![]() |
![]() |