====== pears.CollectionDeleteAllowed ====== Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace. ===== Original SQL ===== COMMENT TO PRESERVE FORMAT ON PROCEDURE "pears"."CollectionDeleteAllowed" IS {create function CollectionDeleteAllowed /* Application Maintained Function / Procedure - DO NOT EDIT*/ (pCollectionid char(20)) returns long varchar begin declare rv long varchar; declare collectioncount Integer; set rv=''; if not exists(select * from collection where collectionid = pCollectionid) then return "string"('Collection not found'); end if; select count(*) into collectioncount from collection where parent = pCollectionid; if collectioncount>0 then set rv = string('Collection has ',collectioncount,' children'); end if; select count(*) into collectioncount from collectionchat where collectionid = pcollectionid; if collectioncount>0 then set rv = trim( string( rv , char(13), char(10), 'Collection has ',collectioncount,' messages')); end if; return rv; end }