日期:2014-05-16 浏览次数:20478 次
CREATE OR REPLACE TYPE PropertyValue AS OBJECT ( number_value number, string_value varchar2(2000), date_value date, MEMBER FUNCTION getNumberValue RETURN number, MEMBER FUNCTION getStringValue RETURN varchar2, MEMBER FUNCTION getDateValue RETURN date );
CREATE OR REPLACE TYPE BODY PropertyValue AS MEMBER FUNCTION getNumberValue RETURN number AS BEGIN RETURN number_value; END getNumberValue; MEMBER FUNCTION getStringValue RETURN varchar2 AS BEGIN RETURN string_value; END getStringValue; MEMBER FUNCTION getDateValue RETURN date AS BEGIN RETURN date_value; END getDateValue; END;
create table IGRP_SYS_PROPERTIES ( nid number primary key, propertyKey varchar2(2000), propertyValue PropertyValue, propertyType varchar2(2000), description varchar2(2000), createUserId number, modifyUserId number, createDate date, modifyDate date); CREATE SEQUENCE SQ_IGRP_PROPERTYID START WITH 1 INCREMENT BY 1 MAXVALUE 1E27 MINVALUE 1 NOCYCLE CACHE 20 NOORDER; -- Add comments to the columns comment on column IGRP_SYS_PROPERTIES.nid is 'PK唯一值'; comment on column IGRP_SYS_PROPERTIES.propertyKey is '属性键'; comment on column IGRP_SYS_PROPERTIES.propertyValue is '属性值'; comment on column IGRP_SYS_PROPERTIES.propertyType is '属性类型'; comment on column IGRP_SYS_PROPERTIES.description is '描述'; comment on column IGRP_SYS_PROPERTIES.createUserId is '创建用户ID'; comment on column IGRP_SYS_PROPERTIES.modifyUserId is '修改用户ID'; comment on column IGRP_SYS_PROPERTIES.createDate is '创建日期'; comment on column IGRP_SYS_PROPERTIES.modifyDate is '修改日期';
insert into IGRP_SYS_PROPERTIES VALUES (SQ_IGRP_PROPERTYID.nextval, 'xxx', PropertyValue(10, null,null), 'number', 'xxx', 101, 101, sysdate, sysdate); commit;
select isp.propertyValue.getNumberValue() as myValues from IGRP_SYS_PROPERTIES isp where isp.propertyKey = 'xxx' and isp.propertyType = 'number';