Help get this topic noticed by sharing it on Twitter, Facebook, or email.

SOQL TYPEOF clause

Does DBAmp support the TYPEOF construct? See:

https://developer.salesforce.com/docs...

Thanks,

Ron
1 person has
this question
+1
Reply
  • No. There is a paradigm mismatch with this concept and SQL because the TYPEOF lets you dynamically modify the number of columns in the Select list by row. It is not possible to have a SQL Select that returns 2 column for one row and 3 columns for the next.

    We are trying to figure out how to "shoehorn" this in but do not have a great solution at this time.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. happy, confident, thankful, excited kidding, amused, unsure, silly indifferent, undecided, unconcerned sad, anxious, confused, frustrated

  • Figured...it's kind of a weird paradigm. I also thought I read somewhere that streaming API and bulk API don't support it anyway, but that was back in '13.

    In case others have the same question, I think I manage to come up with (a very scary) way (i.e. in terms of performance and API call count):

    SELECT
    CASE fi.Parent_Type
    WHEN 'Opportunity' THEN
    (
    SELECT AccountId FROM OPENQUERY(SFDCLINKEDSERVER, 'SELECT Id, AccountId FROM Opportunity') WHERE Id = fi.ParentId
    )
    ELSE NULL
    END [AccountId]
    FROM OPENQUERY(SFDCLINKEDSERVER, '
    SELECT
    ParentId,
    Parent.Type
    FROM FeedItem
    ') fi


    If you have any input on the above, let everyone know. YMMV so use at your own risk.

    Thanks for the help,

    Ron
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. happy, confident, thankful, excited kidding, amused, unsure, silly indifferent, undecided, unconcerned sad, anxious, confused, frustrated