Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Oracle heap_sort

2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

CREATE OR REPLACE PACKAGE heap_sort_pkg

AS

TYPE num_arr_tt IS TABLE OF PLS_INTEGER INDEX BY PLS_INTEGER

PROCEDURE add_nums (num_arr_inst IN OUT num_arr_tt, dvalue INT)

PROCEDURE del_nums (num_arr_inst IN OUT num_arr_tt)

FUNCTION get_maxval (num_arr_int IN OUT num_arr_tt) RETURN INT

END heap_sort_pkg

CREATE OR REPLACE PACKAGE BODY heap_sort_pkg

AS

PROCEDURE add_nums (num_arr_inst IN OUT num_arr_tt, dvalue INT)

AS

Dest_loc INT: = num_arr_inst.count + 1

Tmp_loc INT: = trunc (dest_loc / 2)

BEGIN

WHILE (tmp_loc > 0 AND dvalue > num_arr_inst (tmp_loc)) LOOP

Num_arr_inst (dest_loc): = num_arr_inst (tmp_loc)

Dest_loc: = tmp_loc

Tmp_loc: = trunc (dest_loc / 2)

END LOOP

Num_arr_inst (dest_loc): = dvalue

END add_nums

PROCEDURE del_nums (num_arr_inst IN OUT num_arr_tt)

AS

Lvalue INT

Rvalue INT

Umark INT: = 1

Tmark INT: = umark

Tvalue INT: = num_arr_inst (num_arr_inst.count)

BEGIN

IF (num_arr_inst.count

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 240

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report