Re: Problem with PL/SQL code - Please help.

From: Sybrand Bakker <postbus_at_sybrandb.demon.nl>
Date: Tue, 5 Dec 2000 21:11:42 +0100
Message-ID: <90jrq4$1edq2$3_at_ID-62141.news.dfncis.de>


Correct code
 DECLARE
      v_BillToCoid companydir.billcoid%TYPE; -- allows you to change the column without changing the pl/sql

      v_BillToName companydir.Coname%TYPE;  BEGIN
   v_BillToCoid := :CompanyDir.billcoid;   if v_BillToCoid is not null then

       select CompanyDir.CoName
       into v_BillToName
       from CompanyDir
       where CompanyDir.BillTocoid = v_billtoCoid;
   end if;

  if v_BillToName is not null then

      :CompanyDir.BillCoName := v_BillToName;   End if

 END; "Lesley" <lesley_at_vimich.com> wrote in message news:h5bX5.38132$i%4.1084072_at_news20.bellglobal.com...
> Can someone tell me what I'm doing wrong.
> It seems to fail where the asterisk is. I'm new so forgive my ignorance.
>
> All I want to do is populate a display item with a company name
> corresponding with an id in the same table.
> The BILLTOCOID is a foreign key to COID, both in the COMPANYDIR table.
>
> Is there an easier way to do this??
> Thanks.
>
> This is in the WHEN_NEW_RECORD_INSTANCE trigger of the CompanyDir
 datablock.
>
> DECLARE
> v_BillToCoid number(8);
> v_BillToName Varchar2(30);
> BEGIN
> v_BillToCoid := :CompanyDir.billcoid;
> if v_BillToCoid is not null then
> select :CompanyDir.CoName *
> into v_BillToName
> from CompanyDir
> where CompanyDir.BillTocoid = CompanyDir.coid;
> end if;
>
> if v_BillToName is not null then
> :CompanyDir.BillCoName := v_BillToName;
> End if
>
> END;
>
>
>
>
>
Received on Tue Dec 05 2000 - 21:11:42 CET

Original text of this message