dbTalk Databases Forums  

[BUGS] diff value retuns, debug mode and play mode

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] diff value retuns, debug mode and play mode in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
ALİ ÇELİK
 
Posts: n/a

Default [BUGS] diff value retuns, debug mode and play mode - 02-20-2005 , 11:54 PM







I have a postgresql function at the bottom , when i run at EMS POSTGRESQL
debug mode with F8 step by step. Its work great but when i use with play
button it returns null what is the different about debug mode and run mode.

BEST REGARDS.


CREATE OR REPLACE FUNCTION "public"."allocatedamount" (varchar, integer)
RETURNS numeric AS
$body$
/* allocatedamount (varchar,integer)
raporlarda kullan?lmak ?zere belirli bir sold un nekadar?n?n allocate
edildi?ini bulmak i?in
$1: Varchar: Tablo ismi.(SOCIAL,ACCOMODATION,vs)
$2: Integer: Soldid.
*/
declare
res numeric(15,2);
_pida integer[4];
_pid integer;
_rec record;
begin
if $1 = 'REGISTRATION' then begin
_pid:=1;
for _rec in select personaldetails.id from personaldetails where
personaldetails.id=$2 or personaldetails.masterid=$2 loop
_pida[_pid]:=_rec.id;
_pid:=_pid+1;
end loop;

select into res sum(allocatedpayments.amount) from allocatedpayments
where allocatedpayments.tablename='REGISTRATION' and
allocatedpayments.tableid = ANY (_pida::integer[]);
res=888;
end;
ELSIF $1 = 'MASTER-REGISTRATION' then
select into res sum(allocatedpayments.amount) from allocatedpayments
where allocatedpayments.tablename='REGISTRATION' and
allocatedpayments.tableid=$2;


ELSIF $1 = 'ACC-REGISTRATION' then
select into res sum(allocatedpayments.amount) from allocatedpayments
where allocatedpayments.tablename='REGISTRATION' and
allocatedpayments.tableid=$2;


else
select into res sum(allocatedpayments.amount) from allocatedpayments
where allocatedpayments.tablename=$1 and allocatedpayments.tableid=$2;

end if;

if res is null then
res:=0;
end if;


return res;

end;
$body$
LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER;



---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Reply With Quote
  #2  
Old   
ALİ ÇELİK
 
Posts: n/a

Default Re: [BUGS] diff value retuns, debug mode and play mode - 05-09-2005 , 09:16 AM






it is about null problem
.........
declare
res numeric(15,2);
_pida integer[4]; <------------ Problem is here must be ---> pida
integer[4]='{}';
_pid integer;
_rec record;
...................




"ALİ ÇELİK" <ali (AT) verus (DOT) com.tr>, haber iletisinde şunları
yazdı:cv1rau$1djf$3 (AT) news (DOT) hub.org...
Quote:
I have a postgresql function at the bottom , when i run at EMS POSTGRESQL
debug mode with F8 step by step. Its work great but when i use with play
button it returns null what is the different about debug mode and run
mode.

BEST REGARDS.


CREATE OR REPLACE FUNCTION "public"."allocatedamount" (varchar, integer)
RETURNS numeric AS
$body$
/* allocatedamount (varchar,integer)
raporlarda kullan?lmak ?zere belirli bir sold un nekadar?n?n allocate
edildi?ini bulmak i?in
$1: Varchar: Tablo ismi.(SOCIAL,ACCOMODATION,vs)
$2: Integer: Soldid.
*/
declare
res numeric(15,2);
_pida integer[4]; _pid integer;
_rec record;
begin
if $1 = 'REGISTRATION' then begin
_pid:=1;
for _rec in select personaldetails.id from personaldetails where
personaldetails.id=$2 or personaldetails.masterid=$2 loop
_pida[_pid]:=_rec.id;
_pid:=_pid+1;
end loop;

select into res sum(allocatedpayments.amount) from allocatedpayments
where allocatedpayments.tablename='REGISTRATION' and
allocatedpayments.tableid = ANY (_pida::integer[]);
res=888;
end;
ELSIF $1 = 'MASTER-REGISTRATION' then
select into res sum(allocatedpayments.amount) from allocatedpayments
where allocatedpayments.tablename='REGISTRATION' and
allocatedpayments.tableid=$2;


ELSIF $1 = 'ACC-REGISTRATION' then
select into res sum(allocatedpayments.amount) from allocatedpayments
where allocatedpayments.tablename='REGISTRATION' and
allocatedpayments.tableid=$2;


else
select into res sum(allocatedpayments.amount) from allocatedpayments
where allocatedpayments.tablename=$1 and allocatedpayments.tableid=$2;

end if;

if res is null then
res:=0;
end if;


return res;

end;
$body$
LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER;




---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq


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.