X-Original-To: pgsql-sql@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 2D79E4758F1 for ; Wed, 9 Apr 2003 07:23:38 -0400 (EDT) Received: from rtlocal.trade-india.com (mail-relay.trade-india.com [203.196.129.235]) by postgresql.org (Postfix) with SMTP id D7B81474E42 for ; Wed, 9 Apr 2003 07:23:33 -0400 (EDT) Received: (qmail 1409 invoked from network); 9 Apr 2003 11:25:34 -0000 Received: from system67.trade-india-local.com (192.168.0.67) by infocom-236-129-del.trade-india.com with SMTP; 9 Apr 2003 11:25:34 -0000 From: Rajesh Kumar Mallah Organization: Infocom Network Limited To: "Yudha Setiawan" , Subject: Re: Language SQL, But Need Return PlPgSql Date: Wed, 9 Apr 2003 16:53:36 +0530 User-Agent: KMail/1.5 References: <018101c2fdb8$6e46d1e0$ea00a8c0@yudha> In-Reply-To: <018101c2fdb8$6e46d1e0$ea00a8c0@yudha> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200304091653.36745.mallah@trade-india.com> X-Spam-Status: No, hits=-33.1 required=5.0 tests=BAYES_01,EMAIL_ATTRIBUTION,IN_REP_TO,QUOTED_EMAIL_TEXT, REFERENCES,REPLY_WITH_QUOTES,SIGNATURE_SHORT_SPARSE, USER_AGENT autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200304/130 X-Sequence-Number: 12831 Is your problem finally solved? regds mallah. On Tuesday 08 Apr 2003 3:22 pm, Yudha Setiawan wrote: > Dear Expert; > Gimme your hand please, > I've been using function with "Language SQL" and combined with > "type" for the simply-one. Like this; > ------------------------------------- > create type simply_1 as( > fc_name char(20), > fn_codedept integer, > fc_descdept char(30) ); > > Create function F_Simple(integer) returns setof d_4developer.ty_rep_coba as > ' select a.fc_name, a.fn_codedept, b.fc_descdept > from Emplo_Corp a, Depart b > where a.fn_codedept = b.fn_codedept and > a.fn_codedept = $1; > ' language SQL; > -------------------------------------- > > That's running pretty good. But now i have more complicated condition. > There are hundreds combination of reports must be handled by me and > most of all have the same result. If i still using style of "Language > SQL", that's means I will have to make function as much as my report. > I Tried Using style "Language PlPgSql" but I got a Fully Confused > about what a kind of RETURN i will use ?? > ------------------------------------------------- > Create or replace function MultiRpt(integer,char(1)) > setof d_4developer.ty_rep_coba as > 'begin > -- View Corporate's Employee > If $2 = ''C'' Then > select a.fc_name, a.fn_codedept, b.fc_descdept > from Emplo_Corp a, depart b > where a.fn_codedept = b.fn_codedept and > a.fn_codedept = $1; > End If; > > -- View Branch'A' Employee > If $2 = ''A'' Then > select a.fc_name, a.fn_codedept, b.fc_descdept > from Emplo_BRANCH_A a, depart b > where a.fn_codedept = b.fn_codedept and > a.fn_codedept = $1; > End If; > > -- View Branch'B' Employee > If $2 = ''B'' Then > select a.fc_name, a.fn_codedept, b.fc_descdept > from Emplo_BRANCH_B a, depart b > where a.fn_codedept = b.fn_codedept and > a.fn_codedept = $1; > End If;' > Return (-- ?? --) > end;' language PlPgSql; > ------------------------------------------------- > > Some advice will be helpfull. Thank's > GOD Bless You All and Bravo Postgres !! > > > > Yudha Setiawan. > VoIP > No. : 628899911223344 -- Rajesh Kumar Mallah, Project Manager (Development) Infocom Network Limited, New Delhi phone: +91(11)6152172 (221) (L) ,9811255597 (M) Visit http://www.trade-india.com , India's Leading B2B eMarketplace.