Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> Workaround for using NTILE function in Oracle8i
Hi Everyone,
I'm writing PL/SQL code which utilizes the NTILE function but have just
found out that due to a bug in Oracle8i the function
works from Sqlplus but not when called from PL/SQL.
I've run the following code in Oracle 8i and 9i and the results are given
below.
Unfortunately the database I need to run this on is Oracle 8i. Does anyone
know of
a workaround I could use to get this to work.
Cheers,
Kieran Murray
Database Administrator,
Norkom Technologies,
Dublin 2, Ireland
Tel:- +3531 2403221
declare
cursor cr_main is
select customer_id,
work_tn_extno,
ntile(4) over (order by work_tn_extno desc ) as quartile
from customer;
begin
for r1 in cr_main loop
dbms_output.put_line('customer_id = ' || r1.customer_id); dbms_output.put_line('work_tn_extno = ' || r1.work_tn_extno); dbms_output.put_line('quartile = ' || r1.quartile);end loop;
Oracle8i
*ERROR at line 6:
Oracle9i
customer_id = 1
work_tn_extno =
quartile = 1
PL/SQL procedure successfully completed.
The information contained in this e-mail transmission is confidential and may be privileged. It is intended only for the addressee(s) stated above. If you are not an addressee, any use, dissemination, distribution, publication, or copying of the information contained in this e-mail is strictly prohibited. If you have received this e-mail in error, please immediately notify our IT Department by telephone at 353-1-6769333 or e-mail internal.support_at_norkom.com and delete the e-mail from your system.
--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Kieran Murray
INET: kieran.murray_at_norkom.com
Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists --------------------------------------------------------------------To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). Received on Thu Mar 21 2002 - 04:03:25 CST