Skip to Main Content
  • Questions
  • Alternative of Excel Yield function in Oracle PL/SQL

Breadcrumb

Question and Answer

Chris Saxon

Thanks for the question, Sandeep.

Asked: January 28, 2021 - 6:10 pm UTC

Last updated: January 29, 2021 - 8:51 am UTC

Version: 12.2

Viewed 1000+ times

You Asked

Hi Tom,
Is there any alternative to develop Or use Excel Yield function in Oracle PLSQL. Basically I want to use excel yield function in my Plsql program.

and Chris said...

I'm not aware of an in-built alternative; I'm sure you could write your own though!

The Microsoft support site gives a detailed description of how it works:

https://support.microsoft.com/en-us/office/yield-function-f5f5ca43-c4bd-434f-8bd2-ed3c9727a4fe

This has a complex formula and finishes with this:

If there is more than one coupon period until redemption, YIELD is calculated through a hundred iterations. The resolution uses the Newton method, based on the formula used for the function PRICE. The yield is changed until the estimated price given the yield is close to price

If you'd like an example of implementing the Newton method, we show you how in 21c with the new loop controls:

https://blogs.oracle.com/plsql-and-ebr/better-loops-and-qualified-expressions-array-constructors-in-plsql#listing-16

Is this answer out of date? If it is, please let us know via a Comment

More to Explore

SQL

The Oracle documentation contains a complete SQL reference.