Question regarding Function & Return table

From: suzuyam1102001(at)yahoo(dot)com (Suyam)
To: pgsql-sql(at)postgresql(dot)org
Subject: Question regarding Function & Return table
Date: 2001-10-24 19:58:21
Message-ID: 17e20f7a.0110241158.41dcf208@posting.google.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

All,

I am a beginner to learn Pl/ SQL.
How can I return either " Return Pl/SQL table" or "Return VARCHAR2"
simultaneously? The result is dependable on Count(Last_name)
condition.

Thanks,

The below is incomplete because I cannot understand the above
question.

===========================================================
create or replace function New_Rental(
P_last_name S_member.LAST_NAME%TYPE,
P_member_id S_member.Member_id%TYPE,
P_first_name S_member.FIRST_NAME%TYPE,
P_phone S_member.Phone%TYPE,
P_VALID_DATE In OUT Date)

Return VARCHAR2
Is
V_msg :='Expected due date is'||P_VALID_DATE;

Begin
If Count(Last_name)=1 then
Select VALID_DATE INTO P_VALID_DATE
from S_member
Where Last_Name:= P_Last_name;
return 'Expected due date is'||P_VALID_DATE;

ElSIF Count(Last_name)> 1 then
Select VALID_DATE INTO P_VALID_DATE
from S_member
Where Last_name:=P_last_name And Member_id:= P_member_id;
return 'Expected due date is'||P_VALID_DATE||'Person's record as
follows:'||P_last_name,P_first_name, P_phone, P_member_id ;

Else Count(Last_name)=0
return 'This person needs to be registered as a member'
End If;
End New_Rental;
======================================================================

Browse pgsql-sql by date

  From Date Subject
Next Message Joseph Shraibman 2001-10-24 21:12:31 Re: dropping foreign key
Previous Message Tom Lane 2001-10-24 18:43:48 Cross-posting (was Re: GUID in postgres)