36: removing the Full table scan
37: from the cursor query cur_database_item_exists.
38: Removed the use of UPPER function from the cursor query.
39: 13-Dec-2011 115.6 emunisek 13484606 Changed parameter specification to
40: FF_ROUTES.TEXT%TYPE
41: ====================================================================*/
42:
43: function create_route(
44: p_route_name varchar2,
42:
43: function create_route(
44: p_route_name varchar2,
45: p_description varchar2,
46: p_text ff_routes.text%TYPE) return number is
47: begin
48:
49: declare
50:
48:
49: declare
50:
51: cursor cur_route_exists is
52: select route_id from ff_routes
53: where route_name = p_route_name;
54:
55: cursor cur_ff_routes_s is
56: select ff_routes_s.nextval
51: cursor cur_route_exists is
52: select route_id from ff_routes
53: where route_name = p_route_name;
54:
55: cursor cur_ff_routes_s is
56: select ff_routes_s.nextval
57: from dual;
58:
59: l_route_id ff_routes.route_id%TYPE;
52: select route_id from ff_routes
53: where route_name = p_route_name;
54:
55: cursor cur_ff_routes_s is
56: select ff_routes_s.nextval
57: from dual;
58:
59: l_route_id ff_routes.route_id%TYPE;
60:
55: cursor cur_ff_routes_s is
56: select ff_routes_s.nextval
57: from dual;
58:
59: l_route_id ff_routes.route_id%TYPE;
60:
61: begin
62:
63: open cur_route_exists;
68: if cur_route_exists%notfound then
69:
70: close cur_route_exists;
71:
72: open cur_ff_routes_s;
73: fetch cur_ff_routes_s
74: into l_route_id;
75: close cur_ff_routes_s;
76:
69:
70: close cur_route_exists;
71:
72: open cur_ff_routes_s;
73: fetch cur_ff_routes_s
74: into l_route_id;
75: close cur_ff_routes_s;
76:
77: insert into ff_routes
71:
72: open cur_ff_routes_s;
73: fetch cur_ff_routes_s
74: into l_route_id;
75: close cur_ff_routes_s;
76:
77: insert into ff_routes
78: (
79: route_id,
73: fetch cur_ff_routes_s
74: into l_route_id;
75: close cur_ff_routes_s;
76:
77: insert into ff_routes
78: (
79: route_id,
80: route_name,
81: user_defined_flag,
106:
107: hr_utility.trace(p_route_name || ' route already exists.');
108: hr_utility.trace('Updating route .... ' || p_route_name);
109:
110: update ff_routes
111: set text = p_text
112: where route_id = l_route_id;
113:
114: return l_route_id;