By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,963 Members | 1,061 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,963 IT Pros & Developers. It's quick & easy.

need some help in function

P: 53
i have a function:

Expand|Select|Wrap|Line Numbers
  1. CREATE OR REPLACE FUNCTION fn_confirm_sms("varchar", "varchar", "varchar", "varchar", "varchar")
  2.   RETURNS "varchar" AS
  3. $BODY$
  4. declare
  5.  v_user_mobile_no varchar(30);
  6.  v_return varchar;
  7.  v_paying_agent_cd varchar(30);
  8.  v_user_agent_cd varchar(30);
  9.  v_amt numeric(12,2);
  10.  v_amount numeric(12,2);
  11.  v_stage varchar(1);
  12.  v_benef varchar(50);
  13.  v_remit_by varchar(50);
  14.  
  15.  
  16. begin
  17.  
  18.  select user_mobile_no,paying_agent_cd 
  19.  into v_user_mobile_no,v_user_agent_cd
  20.  from users
  21.  where name = $1;
  22.  
  23.  if v_user_mobile_no = $4 then
  24.  
  25.  
  26.  
  27.   select paying_agent_code,to_number(amount,999999999.99),stage,benef_name,remit_by
  28.   into v_paying_agent_cd,v_amt,v_stage,v_benef ,v_remit_by
  29.   from remittance_info 
  30.  where rad_no = $2;
  31.  
  32. if v_stage = '1' then
  33.     v_amount = v_amt-500;
  34.  
  35.   if v_paying_agent_cd = v_user_agent_cd then
  36.     if v_amt = to_number($3,999999999.99) then
  37.     update remittance_info set stage=3,remittance_confirm_dt=now(),info_id=$5 where rad_no=$2;
  38.  
  39.  
  40.     if v_remit_by = 'web' then
  41.     insert into diposit (paying_agent_code,amount,diposit_entry_date,diposit_by,diposit_type,
  42.     remarks,rad_no,benef_name,comm,media) values(v_paying_agent_cd,v_amt,now(),$1,'dr','',$2,v_benef,'100.00',$4);
  43.     else
  44.     insert into diposit (paying_agent_code,amount,diposit_entry_date,diposit_by,diposit_type,
  45.     remarks,rad_no,benef_name,comm,media) values(v_paying_agent_cd,v_amount,now(),$1,'dr','',$2,v_benef,'0.00',$4);
  46.     end if;
  47.  
  48.       return 'Confirmed Successfully to'||'  '||v_benef;
  49.  
  50.     else
  51.       return 'Invalid Amount';
  52.     end if;
  53.  
  54.   else
  55.     return 'Paying Agent Not Found';
  56.   end if;
  57.  
  58.  elsif v_stage='3' then
  59.   return 'Already Confirmed';
  60. else 
  61. return 'Not Authorized';
  62.  end if;
  63. else
  64. return 'N/A';
  65. end if;
  66.  
  67. end$BODY$
  68.   LANGUAGE 'plpgsql' VOLATILE;


i want to return two values after confirmed successfully like
return 'Confirmed Successfully to'||' '||v_benef ,$5;

but i don't have the idea
please help me

thanks in advance
Sep 19 '08 #1
Share this Question
Share on Google+
1 Reply


Expert 100+
P: 700
But your function returns varchar. So you can combine a varchar from both variables or change the returning type.
Sep 19 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.