- 论坛徽章:
- 0
|
CREATE PROCEDURE "informix".GETOBJECTNAME(pObjectType varchar(40),pObjectNo varchar(40))
returning varchar(250);
--传入参数说明:pObjectType-项目类型varchar2、pObjectNo-项目编号varchar2
--返回值类型:varchar(250)
--功能逻辑:获得所给项目的项目名称
DEFINE pObjectName varchar(80) ;
DEFINE pKeyColumn varchar(40) ;
DEFINE pNameColumn varchar(80) ;
DEFINE pTable varchar(80) ;
DEFINE pDMLString varchar(250);
select ObjectTable,KeyCol,KeyColName into pTable,pKeyColumn,pNameColumn from OBJECTTYPE_CATALOG where ObjectType = pObjectType;
if(pTable is not null and pKeyColumn is not null and pNameColumn is not null) then
--pDMLString = 'select '||pNameColumn||' from '||pTable||' where '||pKeyColumn||' =:ObjectNo';
select pNameColumn from pTable where pKeyColumn = ObjectNo;
end if;
if(pKeyColumn == null) then
return pObjectNo;
else
return pObjectName;
end if;
end procedure;
ErrNo : 201 |
|