in reply to plperl RFC: (perl embedded in postgreSQL) An Oracle decode replacement

coalesce is actually supported by Oracle, and since it is the standard way to do it, that's the one I prefer to use whenever possible.
  • Comment on Re: plperl RFC: (perl embedded in postgreSQL) An Oracle decode replacement

Replies are listed 'Best First'.
Re^2: plperl RFC: (perl embedded in postgreSQL) An Oracle decode replacement
by Madams (Pilgrim) on Feb 06, 2007 at 02:44 UTC
    Actually "case x when bool then y when bool then z else zz end" is the standard compliant way to do oracle's decode

    However I do like the "speed" and conciseness of the decode vs case. But as stated in the OP, I hacked this up to use for "work emulation". We use an ERP that uses Oracle 8i and the code base is littered with decodes, so to stop being asked to explain why my code doesn't "look like" the code from the ERP company's coders, I've just caved...

    In my own code that doesn't "touch" the database directly (in a spreadsheet "solution" (ick..) or personal utility query) I use case.

    Plus it was gobs of fun to write the plperlu script and find out how they set up the Safe container for plperl....


    "All too often people confuse their being able to think with their actually having done so. A more pernicious mistake does not exist."

    --Moraven Tollo in Michael A. Stackpole's A Secret Atlas

    My Unitarian Jihad Name is: Sibling Pepper Spray of Loving Kindness. Get yours.

      Ah, yes, I was only talking about the nvl vs coalesce thing :)

      Maybe not that obvious since the rest of the post wasn't about that. Sorry about the confusion.

      /J