proc下使用OTT生成对象结构

create or replace type address_type as object(
street varchar2(50),
city varchar2(20),
state varchar2(20),
zipcode varchar2(6)
);
create table customer(
id number(6),
name varchar2(10),
address address_type
);
create or replace type employee_type as object(
id number(6),
name varchar2(10),
adress address_type

);


in.type

----------------------------------

  CASE=lower
  TYPE  address_type HFILE=employee.h

  TYPE  employee_type HFILE=employee.h

命令

ott  userid=llpaytest/llpaytest@ORA10  intype=./in.typ  outtype=./out.typ CODE=C

最后生成如下:

#ifndef EMPLOYEE_ORACLE   #这个生成和HFILE的路有关的,如果HFILE带上路径,则生成的也会是 带路径_ORACLE
# define EMPLOYEE_ORACLE

#ifndef OCI_ORACLE
# include <oci.h>
#endif

typedef OCIRef address_type_ref;
typedef OCIRef employee_type_ref;

struct address_type
{
   OCIString * street;
   OCIString * city;
   OCIString * state;
   OCIString * zipcode;
};
typedef struct address_type address_type;

struct address_type_ind
{
   OCIInd _atomic;
   OCIInd street;
   OCIInd city;
   OCIInd state;
   OCIInd zipcode;
};
typedef struct address_type_ind address_type_ind;

struct employee_type
{
   OCINumber id;
   OCIString * name;
   struct address_type adress;
};
typedef struct employee_type employee_type;

struct employee_type_ind
{
   OCIInd _atomic;
   OCIInd id;
   OCIInd name;
   struct address_type_ind adress;
};
typedef struct employee_type_ind employee_type_ind;

#endif



out.typ

-------

CASE = LOWER

TYPE LLPAYTEST.ADDRESS_TYPE AS address_type
  VERSION = "$8.0"
  HFILE = employee.h

TYPE LLPAYTEST.EMPLOYEE_TYPE AS employee_type
  VERSION = "$8.0"
  HFILE = employee.h


你可能感兴趣的:(oracle,c,struct,object,table,include)