From: suzuyam1102001@yahoo.com
To: pgsql-sql@postgresql.org
Subject: Question regarding Function & Return table
Date: 24 Oct 2001 12:58:21 -0700
Message-ID: <17e20f7a.0110241158.41dcf208@posting.google.com> (raw)
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;
======================================================================
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: suzuyam1102001@yahoo.com
Subject: Re: Question regarding Function & Return table
In-Reply-To: <17e20f7a.0110241158.41dcf208@posting.google.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox