Re: [GENERAL] Capturing return value of a function

2007-07-16 Thread George Weaver
- Original Message - From: Jasbinder Singh Bali To: pgsql-general@postgresql.org Sent: Monday, July 16, 2007 3:55 PM Subject: [GENERAL] Capturing return value of a function I was wondering what would the function return if insert fails. I want it to return 'success

Re: [GENERAL] Capturing return value of a function

2007-07-16 Thread Gregory Stark
"Jasbinder Singh Bali" <[EMAIL PROTECTED]> writes: > I was wondering what would the function return if insert fails. It would abort immediately and abort your transaction as well unless something higher up catches the error. > I want it to return 'success' upon a successful insert and 'failure

Re: [GENERAL] Capturing return value of a function

2007-07-16 Thread Michael Glaesemann
On Jul 16, 2007, at 15:55 , Jasbinder Singh Bali wrote: I was wondering what would the function return if insert fails. I want it to return 'success' upon a successful insert and 'failure' if insert fails. Depends on what you mean by "failed". Do you mean an error was raised? Then you'l

[GENERAL] Capturing return value of a function

2007-07-16 Thread Jasbinder Singh Bali
Hi, I have a function like this CREATE OR REPLACE FUNCTION sp_insert(text, text, text, text) RETURNS text AS $BODY$ BEGIN INSERT INTO tbl(a,b,c,d) VALUES ($1,$2, $3, $4); RETURN 'success'; END; $BODY$ LANGUAGE 'plpgsql' VOLATILE; I was wondering what would the fu

Re: [GENERAL] Capturing return value of a function in Pl/Perl

2007-07-06 Thread Greg Sabino Mullane
-BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 > I'm calling a plpgsql function in a plperl function. > plpgsql function is a simple select query returning a single row of records. > How can i retrieve the values of different fields in my plperl function? Please check out the page: http://

[GENERAL] Capturing return value of a function in Pl/Perl

2007-07-06 Thread Harpreet Dhaliwal
Hi, I'm calling a plpgsql function in a plperl function. plpgsql function is a simple select query returning a single row of records. How can i retrieve the values of different fields in my plperl function? If i write something like my $query = "SELECT sp_select"; my $exec = spi_exec_query($sp_