249: fa_debug_pkg.ADD('FAXGFR','+++ stmt:', h_formula_parsed, p_log_level_rec => p_log_level_rec);
250: END IF;
251:
252: -- Open the cursor for processing.
253: h_cursor := dbms_sql.open_cursor;
254:
255: -- Parse the query.
256: dbms_sql.parse(h_cursor,h_formula,1);
257:
252: -- Open the cursor for processing.
253: h_cursor := dbms_sql.open_cursor;
254:
255: -- Parse the query.
256: dbms_sql.parse(h_cursor,h_formula,1);
257:
258: -- Bind X_asset_id to the placeholder.
259: dbms_sql.bind_variable (h_cursor, ':v1', X_Asset_ID);
260: dbms_sql.bind_variable (h_cursor, ':v2', X_Book_Type_Code);
255: -- Parse the query.
256: dbms_sql.parse(h_cursor,h_formula,1);
257:
258: -- Bind X_asset_id to the placeholder.
259: dbms_sql.bind_variable (h_cursor, ':v1', X_Asset_ID);
260: dbms_sql.bind_variable (h_cursor, ':v2', X_Book_Type_Code);
261:
262: -- Define the output variable, rate.
263: dbms_sql.define_column (h_cursor, 1, X_Rate);
256: dbms_sql.parse(h_cursor,h_formula,1);
257:
258: -- Bind X_asset_id to the placeholder.
259: dbms_sql.bind_variable (h_cursor, ':v1', X_Asset_ID);
260: dbms_sql.bind_variable (h_cursor, ':v2', X_Book_Type_Code);
261:
262: -- Define the output variable, rate.
263: dbms_sql.define_column (h_cursor, 1, X_Rate);
264:
259: dbms_sql.bind_variable (h_cursor, ':v1', X_Asset_ID);
260: dbms_sql.bind_variable (h_cursor, ':v2', X_Book_Type_Code);
261:
262: -- Define the output variable, rate.
263: dbms_sql.define_column (h_cursor, 1, X_Rate);
264:
265: -- Execute the statement. We don't care about the
266: -- return value, but we do need to declare a variable
267: -- for it.
264:
265: -- Execute the statement. We don't care about the
266: -- return value, but we do need to declare a variable
267: -- for it.
268: h_return_code := dbms_sql.EXECUTE(h_cursor);
269:
270: -- This is the fetch loop.
271: LOOP
272: IF dbms_sql.fetch_rows (h_cursor) = 0 THEN
268: h_return_code := dbms_sql.EXECUTE(h_cursor);
269:
270: -- This is the fetch loop.
271: LOOP
272: IF dbms_sql.fetch_rows (h_cursor) = 0 THEN
273: EXIT;
274: END IF;
275:
276: dbms_sql.column_value (h_cursor, 1, X_rate);
272: IF dbms_sql.fetch_rows (h_cursor) = 0 THEN
273: EXIT;
274: END IF;
275:
276: dbms_sql.column_value (h_cursor, 1, X_rate);
277: END LOOP;
278:
279: -- Close the cursor.
280: dbms_sql.close_cursor (h_cursor);
276: dbms_sql.column_value (h_cursor, 1, X_rate);
277: END LOOP;
278:
279: -- Close the cursor.
280: dbms_sql.close_cursor (h_cursor);
281:
282: ---Added by Satish Byreddy For Method Code JP-250DB XX
283: IF X_rate is NULL THEN
284:
284:
285: h_formula := 'SELECT ' || h_formula_parsed || ' rate FROM dual';
286:
287: -- Open the cursor for processing.
288: h_cursor := dbms_sql.open_cursor;
289:
290: -- Parse the query.
291: dbms_sql.parse(h_cursor,h_formula,1);
292:
287: -- Open the cursor for processing.
288: h_cursor := dbms_sql.open_cursor;
289:
290: -- Parse the query.
291: dbms_sql.parse(h_cursor,h_formula,1);
292:
293: -- Bind X_asset_id to the placeholder.
294:
295: -- Define the output variable, rate.
292:
293: -- Bind X_asset_id to the placeholder.
294:
295: -- Define the output variable, rate.
296: dbms_sql.define_column (h_cursor, 1, X_Rate);
297:
298: -- Execute the statement. We don't care about the
299: -- return value, but we do need to declare a variable
300: -- for it.
297:
298: -- Execute the statement. We don't care about the
299: -- return value, but we do need to declare a variable
300: -- for it.
301: h_return_code := dbms_sql.EXECUTE(h_cursor);
302:
303: -- This is the fetch loop.
304: LOOP
305: IF dbms_sql.fetch_rows (h_cursor) = 0 THEN
301: h_return_code := dbms_sql.EXECUTE(h_cursor);
302:
303: -- This is the fetch loop.
304: LOOP
305: IF dbms_sql.fetch_rows (h_cursor) = 0 THEN
306: EXIT;
307: END IF;
308:
309: dbms_sql.column_value (h_cursor, 1, X_rate);
305: IF dbms_sql.fetch_rows (h_cursor) = 0 THEN
306: EXIT;
307: END IF;
308:
309: dbms_sql.column_value (h_cursor, 1, X_rate);
310: END LOOP;
311:
312: -- Close the cursor.
313: dbms_sql.close_cursor (h_cursor);
309: dbms_sql.column_value (h_cursor, 1, X_rate);
310: END LOOP;
311:
312: -- Close the cursor.
313: dbms_sql.close_cursor (h_cursor);
314: END IF;
315: ---End OF Addition by Satish Byreddy For Method Code JP-250DB XX
316:
317: -- Fix for Bug #2421998. For a formula that uses remaining life, we