Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2005
    Posts
    4

    Unanswered: postgresql procedure & returning affected row

    I like to know if a procedure function can be created to return the number of rows been affected from deleting rows from a table

    Code:
    CREATE OR REPLACE FUNCTION deleteTest(id INT) RETURNS INT AS $BODY$
    DECLARE
      deletedRow INT;
    BEGIN
      deletedRow := (DELETE FROM test WHERE test_id = id);
      RETURN deletedRow;
    END
    $BODY$ LANGUAGE plpgsql;
    However the above procedure does not work.

    Can some one help?

  2. #2
    Join Date
    Nov 2003
    Posts
    2,935
    Provided Answers: 12
    http://www.postgresql.org/docs/current/static/plpgsql-statements.html#PLPGSQL-STATEMENTS-DIAGNOSTICS

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •