473,396 Members | 1,864 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

need some help in function

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
1 2523
rski
700 Expert 512MB
But your function returns varchar. So you can combine a varchar from both variables or change the returning type.
Sep 19 '08 #2

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

Similar topics

45
by: Joh | last post by:
hello, i'm trying to understand how i could build following consecutive sets from a root one using generator : l = would like to produce : , , , ,
0
by: Dale McGorman | last post by:
The following is some code that I am trying to bring over from VB 6.0, that I have working there. I am trying to get to where I can talk to a USB device. I am stuck on how to correctly pass params...
7
by: brian.digipimp | last post by:
Write a program that prompts the user to input a positive integer. It should then output a message indicating whether the number is a prime number. (Note: An even number is prime if it is 2. An odd...
7
by: Timothy Shih | last post by:
Hi, I am trying to figure out how to use unmanaged code using P/Invoke. I wrote a simple function which takes in 2 buffers (one a byte buffer, one a char buffer) and copies the contents of the byte...
2
by: Polyhedron_12 | last post by:
I am having problems calling functions in general in VB. I keep getting alot of errors. Can anybody help me out with this? I put the error message on the same line that it says it is at. I believe...
16
by: pamelafluente | last post by:
I am still working with no success on that client/server problem. I need your help. I will submit simplified versions of my problem so we can see clearly what is going on. My model: A client...
0
by: swtstrawberry | last post by:
here are the directions and below the direction is what I have so far. I need help with (B) the bisect function. I've only posted part of my program, if more information is needed please let me...
9
by: pic078 via AccessMonster.com | last post by:
I need serious help - I have a frontend/backend Access database (2 MDE Files) that remains stuck in task manager after exiting the application - you can't reopen database after exiting as a result...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.