From: Ken Wilson <ken.wilson@homeNOSPAM.com>
Subject: PLS-00231: function 'TO_DOLLAR_STR' may not be used in SQL
Date: 2000/02/02
Message-ID: <38980CE1.744C2A5B@homeNOSPAM.com>#1/1
Content-Transfer-Encoding: 7bit
X-Accept-Language: en
Content-Type: text/plain; charset=us-ascii
X-Complaints-To: abuse@home.net
X-Trace: news1.gvcl1.bc.home.com 949488895 24.66.169.211 (Wed, 02 Feb 2000 02:54:55 PST)
Organization: @Home Network Canada
MIME-Version: 1.0
NNTP-Posting-Date: Wed, 02 Feb 2000 02:54:55 PST
Newsgroups: comp.databases.oracle.misc,comp.databases.oracle


I am getting the above message and cannot figure out what is wrong with
the code that's generating it.  The sql script is being run under SQL
Plus 3.3

Bear in mind I am a student at this time and the coded is basically more
of academic interest for learning than anything of substance.  I have
appended the code to this message.  If anyone can steer me in the right
direction it would be greatly appreciated.

Ken Wilson
First Law of Optimization: The speed of a non-working program is
irrelevant
(Steve Heller, 'Efficient C/C++ Programming')

< code snippet>
declare

/**
 * This function will build a string of dollar signs
 * and return it based on the number input
 **/
function To_Dollar_Str (Dollar_Count IN number)
         return varchar2 is

Dollar_Str Course.Dollar%type;
i positive := 1;

begin

for i IN 1..Dollar_Count loop
    Dollar_Str := Dollar_Str || '$';
end loop;

return Dollar_Str;

end;

-- Main body of script starts here

begin

update Course
set Dollar = To_Dollar_Str(floor(Additional_Fees / 10)) 
where
  Department_ID = upper('&Dept_ID_In') and
  Course_ID = upper('&Course_ID_In') and
  Additional_Fees >= 10;

commit;

end;

<code ends>


