Skip to content Skip to sidebar Skip to footer

How To Pass A Record As Parameter For Pl/pgsql Function?

I keep looking for this answer online but I cannot find it. I am trying to pass one record over a PL/pgSQL function. I tried it in two ways. Fist way : CREATE OR REPLACE FUNCTION t

Solution 1:

Try this:

CREATEOR REPLACE FUNCTION translateToReadableDate(mRecord dim_date) RETURNS void AS $$

dim_date must be a table.

EDIT:

Ok, now I'm really really confused.

  1. A date should be a column, not a table. I can't understand why would you create a table with date values.
  2. You can format dates no problem with to_char. Read this: Data Type Formatting Functions to learn how to. That function you created makes zero sense.
  3. Are you outputting PL/pgSQL? Shouldn't the formatting be done by the middle tier? You should just return a Date from the database.

Lastly, I would recommend reading the PL/pgSQL Manual. There's lots of good stuff in there.

Post a Comment for "How To Pass A Record As Parameter For Pl/pgsql Function?"