pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Karthikeyan Sundaram <skarthi98@hotmail.com>
To: pgsql-admin@postgresql.org
To: pgsql-sql@postgresql.org
Subject: exception handling in postgres plpgsql
Date: Tue, 3 Apr 2007 15:35:17 -0700
Message-ID: <BAY131-W11D9F51A1A2E1E3AEFB6D8B0670@phx.gbl> (raw)


Hi,
 
  I am having a function like this
 
create or replace function audio_format_func (    in p_bitrate audio_format.audio_bitrate%TYPE,    in p_sampling_rate audio_format.sampling_rate%type,    in p_bit_per_sample audio_format.bit_per_sample%type,    in p_audio_codec audio_format.audio_codec%type,    in p_mimetype audio_format.mimetype%type,    in p_mono_stero audio_format.number_of_channel%type) returns int as$$DECLARE  p_audio_id audio_format.audio_id%type;begin
   select  audio_id into a     from audio_format     where audio_bitrate = p_bitrate      and sampling_rate = p_sampling_rate      and mimetype = p_mimetype      and number_of_channel = p_mono_stero      and audio_code = p_audio_codec;
   return 1;  exception   when NO_DATA_FOUND   then      return 100;end;$$language 'plpgsql';
 
When I compile, I am getting an error message 
ERROR:  unrecognized exception condition "no_data_found"CONTEXT:  compile of PL/pgSQL function "audio_format_func" near line 15
 
How will I handle exceptions in postgres?
 
Please advise.
 
Regards
skarthi
 
_________________________________________________________________
i'm making a difference. Make every IM count for the cause of your choice. Join Now.
http://clk.atdmt.com/MSN/go/msnnkwme0080000001msn/direct/01/?href=http://im.live.com/messenger/im/ho...

view thread (4+ messages)  latest in thread

Message-ID: <BAY131-W11D9F51A1A2E1E3AEFB6D8B0670@phx.gbl>
Permalink:  ../BAY131-W11D9F51A1A2E1E3AEFB6D8B0670@phx.gbl/
Also on:    postgresql.org/message-id/BAY131-W11D9F51A1A2E1E3AEFB6D8B0670@phx.gbl

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: skarthi98@hotmail.com, pgsql-admin@postgresql.org
  Subject: Re: exception handling in postgres plpgsql
  In-Reply-To: <BAY131-W11D9F51A1A2E1E3AEFB6D8B0670@phx.gbl>
  References: <BAY131-W11D9F51A1A2E1E3AEFB6D8B0670@phx.gbl>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox