470,647 Members | 1,096 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,647 developers. It's quick & easy.

Capturing the result status of an ALTER command in plpgsql

How does one capture the result status of an ALTER command inside
plpgsql code block?
For example:
-----------------
CREATE OR REPLACE FUNCTION public."Setup_Primary_Keys"()
RETURNS SETOF varchar AS
'DECLARE

BEGIN
ALTER TABLE public."HCM00101" ADD CONSTRAINT "hcm00101-pk" PRIMARY
KEY("CUSTNMBR");
-- Capture Success or Failure here of the ALTER command
IF [how do I determine success here?] THEN
return next \'HCM00101 primary key set\';
ELSE [eat the failure exception here and continue]
return next \'HCM00101 primary key was not set, continuing with more
code below\';
END IF;
........ more code ........
return;
END;'
LANGUAGE 'plpgsql' VOLATILE;
-------------------

Jul 19 '05 #1
0 1646

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Mark Wilson CPU | last post: by
5 posts views Thread by Oksana Yasynska | last post: by
reply views Thread by CatrinaJones | last post: by
reply views Thread by warner | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.