Subject Re: [firebird-support] UUID (CHAR(16) OCTETS) in conditional expression
Author Zoltán Török
Ok guys, here is the complete procedure:

SET TERM ^ ;

CREATE PROCEDURE GET_OBJECT_PATH (OBJECT_ID UUID)
RETURNS (PATH VARCHAR(2048))
AS
DECLARE VARIABLE V_PARENT UUID;
DECLARE VARIABLE V_CURR_OBJ UUID;
DECLARE VARIABLE V_NAME VARCHAR(255);
BEGIN
PATH = '';
V_CURR_OBJ = OBJECT_ID;

SELECT
O.PARENT,
IIF(OP.VALUE_SHORTSTRING IS NULL, ZUDF_GUID_TO_CHAR(O.PARENT),
OP.VALUE_SHORTSTRING)
FROM
OBJECTS O
LEFT JOIN OBJECTPROPERTIES OP ON OP.OBJECT = O.PARENT AND
OP.PROPERTY = ZUDF_CHAR_TO_GUID('00000000-0000-0000-0002-000000000001')
WHERE
O.ID = :V_CURR_OBJ
INTO
:V_PARENT, :V_NAME;

WHILE (V_PARENT IS NOT NULL) DO -- this line causes the malformed
string error
BEGIN
PATH = V_NAME || PATH;
PATH = '/' || PATH;
V_CURR_OBJ = V_PARENT;

SELECT
O.PARENT,
IIF(OP.VALUE_SHORTSTRING IS NULL, ZUDF_GUID_TO_CHAR(O.PARENT),
OP.VALUE_SHORTSTRING)
FROM
OBJECTS O
LEFT JOIN OBJECTPROPERTIES OP ON OP.OBJECT = O.PARENT AND
OP.PROPERTY = ZUDF_CHAR_TO_GUID('00000000-0000-0000-0002-000000000001')
WHERE
O.ID = :V_CURR_OBJ
INTO
:V_PARENT, :V_NAME;
END

SUSPEND;
END^

SET TERM ; ^


[Non-text portions of this message have been removed]