dbTalk Databases Forums  

Capturing the result status of an ALTER command in plpgsql

comp.databases.postgresql.novice comp.databases.postgresql.novice


Discuss Capturing the result status of an ALTER command in plpgsql in the comp.databases.postgresql.novice forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
jarednevans@yahoo.com
 
Posts: n/a

Default Capturing the result status of an ALTER command in plpgsql - 08-17-2004 , 12:08 PM






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;
-------------------


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.