Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 6BEDE9FB8D9; Tue, 3 Apr 2007 19:35:27 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 13660-01; Tue, 3 Apr 2007 19:35:15 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 Received: from bay0-omc3-s29.bay0.hotmail.com (bay0-omc3-s29.bay0.hotmail.com [65.54.246.229]) by postgresql.org (Postfix) with ESMTP id D0C5F9FB452; Tue, 3 Apr 2007 19:35:18 -0300 (ADT) Received: from BAY131-W11 ([65.55.136.46]) by bay0-omc3-s29.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.2668); Tue, 3 Apr 2007 15:35:17 -0700 Message-ID: Content-Type: multipart/alternative; boundary="_9f3191c3-5d5f-4037-96f2-5f5261a80110_" X-Originating-IP: [67.116.31.14] From: Karthikeyan Sundaram To: , Subject: exception handling in postgres plpgsql Date: Tue, 3 Apr 2007 15:35:17 -0700 Importance: Normal MIME-Version: 1.0 X-OriginalArrivalTime: 03 Apr 2007 22:35:17.0430 (UTC) FILETIME=[5AA81D60:01C77640] X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.502 tagged_above=0 required=5 tests=AWL=-0.792, BAYES_05=-1.11, DNS_FROM_RFC_ABUSE=0.2, DNS_FROM_RFC_POST=1.708, HTML_40_50=0.496, HTML_MESSAGE=0.001, SPF_PASS=-0.001 X-Spam-Level: X-Archive-Number: 200704/25 X-Sequence-Number: 25089 --_9f3191c3-5d5f-4037-96f2-5f5261a80110_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi, =20 I am having a function like this =20 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_cod= ec audio_format.audio_codec%type, in p_mimetype audio_format.mimetype%ty= pe, 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 = =3D p_bitrate and sampling_rate =3D p_sampling_rate and mimetype = =3D p_mimetype and number_of_channel =3D p_mono_stero and audio_c= ode =3D p_audio_codec; return 1; exception when NO_DATA_FOUND then return 100;end;$$l= anguage 'plpgsql'; =20 When I compile, I am getting an error message=20 ERROR: unrecognized exception condition "no_data_found"CONTEXT: compile o= f PL/pgSQL function "audio_format_func" near line 15 =20 How will I handle exceptions in postgres? =20 Please advise. =20 Regards skarthi =20 _________________________________________________________________ i'm making a difference.=A0Make every IM count for the cause of your choice= . Join Now. http://clk.atdmt.com/MSN/go/msnnkwme0080000001msn/direct/01/?href=3Dhttp://= im.live.com/messenger/im/home/?source=3Dwlmailtagline= --_9f3191c3-5d5f-4037-96f2-5f5261a80110_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hi,
 
  I am having a function like this
 
create or replace function audio_format_func (
    in p_b= itrate audio_format.audio_bitrate%TYPE,
    in p_sampling= _rate audio_format.sampling_rate%type,
    in p_bit_per_s= ample audio_format.bit_per_sample%type,
    in p_audio_co= dec audio_format.audio_codec%type,
    in p_mimetype audi= o_format.mimetype%type,
    in p_mono_stero audio_format.= number_of_channel%type) returns int as
$$
DECLARE
  p_audio_i= d audio_format.audio_id%type;
begin
   select  audio_id into a
     from = audio_format
    where audio_bitrate =3D p_bitrate
&n= bsp;     and sampling_rate =3D p_sampling_rate
 = ;     and mimetype =3D p_mimetype
   =    and number_of_channel =3D p_mono_stero
   &n= bsp;  and audio_code =3D p_audio_codec;
   return 1;
  exception
   when NO_DATA_FOU= ND
   then
      return 100;
en= d;
$$
language 'plpgsql';
 
When I compile, I am getting an error message
ERROR:  unrecognized exception condition "no_data_found"
CONTEXT:&n= bsp; 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.=A0Make every IM count for th= e cause of your choice. Join Now. = --_9f3191c3-5d5f-4037-96f2-5f5261a80110_--