How would I set up a function in plpgsql that chec...
# sql
j
How would I set up a function in plpgsql that checks to see if a row already exists and then executes procedures conditionally based on that query?
j
your function body:
Copy code
BEGIN
  IF EXISTS(SELECT FROM my_table WHERE my_row_exists)
  THEN
    INSERT INTO...;
    UPDATE...;
    ...;
  END IF;
END;
j
You always have the best takes!