Subject | One SP that can return any kind of value? |
---|---|
Author | |
Post date | 2014-01-07T07:49:11Z |
Hi all
I have a few SPs (see two examples below), I have a field that defines which field's value is to be returned but as the SP needs a RETURN specified to a type (that what I believe), I wrote separate SPs for each return type, but is it possible to have one SP and unknown RETURN value?
Please advise.
Thanks and regards
Bhavbhuti
SET TERM ^ ;
CREATE PROCEDURE MSETVALUE (
CKEY1 CHAR(30),
CKEY2 CHAR(30) )
RETURNS (
MVALUE BLOB SUB_TYPE 1 )
AS
BEGIN
FOR
SELECT US1.mValue
FROM uSettings US1
JOIN uSettings US2
ON US2.iID = US1.iPID
WHERE US2.CKEY = :CKEY1
AND US1.CKEY = :CKEY2
INTO :MVALUE
DO BEGIN
SUSPEND;
END
END^
SET TERM ; ^
GRANT EXECUTE
ON PROCEDURE BSETVALUE TO SYSDBA;
SET TERM ^ ;
CREATE PROCEDURE DSETVALUE (
CKEY1 CHAR(30),
CKEY2 CHAR(30) )
RETURNS (
DVALUE DATE )
AS
BEGIN
FOR
SELECT US1.dValue
FROM uSettings US1
JOIN uSettings US2
ON US2.iID = US1.iPID
WHERE US2.CKEY = :CKEY1
AND US1.CKEY = :CKEY2
INTO :DVALUE
DO BEGIN
SUSPEND;
END
END^
SET TERM ; ^
GRANT EXECUTE
ON PROCEDURE DSETVALUE TO SYSDBA;
I have a few SPs (see two examples below), I have a field that defines which field's value is to be returned but as the SP needs a RETURN specified to a type (that what I believe), I wrote separate SPs for each return type, but is it possible to have one SP and unknown RETURN value?
Please advise.
Thanks and regards
Bhavbhuti
SET TERM ^ ;
CREATE PROCEDURE MSETVALUE (
CKEY1 CHAR(30),
CKEY2 CHAR(30) )
RETURNS (
MVALUE BLOB SUB_TYPE 1 )
AS
BEGIN
FOR
SELECT US1.mValue
FROM uSettings US1
JOIN uSettings US2
ON US2.iID = US1.iPID
WHERE US2.CKEY = :CKEY1
AND US1.CKEY = :CKEY2
INTO :MVALUE
DO BEGIN
SUSPEND;
END
END^
SET TERM ; ^
GRANT EXECUTE
ON PROCEDURE BSETVALUE TO SYSDBA;
SET TERM ^ ;
CREATE PROCEDURE DSETVALUE (
CKEY1 CHAR(30),
CKEY2 CHAR(30) )
RETURNS (
DVALUE DATE )
AS
BEGIN
FOR
SELECT US1.dValue
FROM uSettings US1
JOIN uSettings US2
ON US2.iID = US1.iPID
WHERE US2.CKEY = :CKEY1
AND US1.CKEY = :CKEY2
INTO :DVALUE
DO BEGIN
SUSPEND;
END
END^
SET TERM ; ^
GRANT EXECUTE
ON PROCEDURE DSETVALUE TO SYSDBA;