在postgresql中打印变量的值

时间:2014-05-05 05:31:43

标签: sql postgresql

我有一个postgresql函数

CREATE OR REPLACE FUNCTION fixMissingFiles() RETURNS VOID AS $$
DECLARE
    deletedContactId integer;
    BEGIN
            SELECT INTO deletedContactId contact_id FROM myContacts WHERE id=206351;

            -- print the value of deletedContactId variable to the console

    END;
$$ LANGUAGE plpgsql;

如何将deletedContactId的值打印到控制台?

1 个答案:

答案 0 :(得分:147)

提出通知:

raise notice 'Value: %', deletedContactId;

http://www.postgresql.org/docs/current/static/plpgsql-errors-and-messages.html