• You're missing quotation marks around the second WHERE predicate:

    contentRepoHandle like % '+@ctype+ '%

    should be

    contentRepoHandle like ''%'+@ctype+ '%''

    The same applies to %pdf%

    -- Gianluca Sartori