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


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值