Subject | Re: [firebird-support] Procedur In Select |
---|---|
Author | Alexandre Benson Smith |
Post date | 2011-07-27T03:25:48Z |
Em 27/7/2011 00:06, wiyono escreveu:
Why don't you just JOIN the tables ????
SELECT
t.indate,
t.cuscd,
c.CusNm,
t.Indate,
t.qty
FROM
takein t join
Customer c on (c.cuscd = t.cuscd)
see you !
> Deal All, Please Help meFirebird does not have stored functions yet
>
>
>
> My SQL is
>
>
>
> SELECT a.indate,
>
> a.cuscd,
>
> F_GetCustNm(a.CusCd) custname,
>
> a.Indate,
>
> a.qty
>
> FROM takein
>
>
>
>
>
>
>
> With Table Name
>
> 1. Customer (CusCd, CusNm, Addr, Telp)
>
> 2. Takein (Indate, CusCd, Qty)
>
> 3. Procedur F_GetCustNm
>
>
>
>
>
> Procedur F_GetCustNm is
>
>
>
> SET TERM ^ ;
>
>
>
> CREATE OR ALTER PROCEDURE F_GetCustNm (
>
> sCusCd varchar(10))
>
> returns (
>
> sCusNm varchar(50))
>
> as
>
> begin
>
>
>
> SELECT TRIM(coalesce(CusNm,'')) CusNm
>
> FROM Customer
>
> WHERE CusCd = :sCusCd
>
> INTO sCusNm;
>
> suspend;
>
> end^
>
>
>
> SET TERM ; ^
>
>
>
> GRANT SELECT ON Customer TO PROCEDURE F_GetCustNm;
>
>
>
> GRANT EXECUTE ON PROCEDURE F_GetCustNm TO SYSDBA;
>
>
>
>
>
> Thanks
>
Why don't you just JOIN the tables ????
SELECT
t.indate,
t.cuscd,
c.CusNm,
t.Indate,
t.qty
FROM
takein t join
Customer c on (c.cuscd = t.cuscd)
see you !