Xref: alice comp.databases.oracle:77169 comp.databases.oracle.misc:52324
Path: alice!news-feed.fnsi.net!netnews.com!nntp.abs.net!newshub2.home.com!news.home.com!news1.gvcl1.bc.home.com.POSTED!not-for-mail
Message-ID: <38980CE1.744C2A5B@homeNOSPAM.com>
From: Ken Wilson <ken.wilson@homeNOSPAM.com>
X-Mailer: Mozilla 4.7 [en]C-AtHome0407  (Win95; U)
X-Accept-Language: en
MIME-Version: 1.0
Newsgroups: comp.databases.oracle.misc,comp.databases.oracle
Subject: PLS-00231: function 'TO_DOLLAR_STR' may not be used in SQL
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 53
Date: Wed, 02 Feb 2000 10:54:55 GMT
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)
NNTP-Posting-Date: Wed, 02 Feb 2000 02:54:55 PST
Organization: @Home Network Canada

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>
