Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Master/Detail Auto calculate column plsql expression

User_0KLNUAug 3 2022

Trying to do a simple: ":units * :cost" when user selects product drop-down and failing with conversion error. They're both number types and both work individually but can't seem to multiply them. Can't seem to find any working examples online either.
Thx

Comments

Adnan3114

Provide more details about the setup of your page. Is the region Interactive grid? Is the drop-down part of the Grid or is it a master item above it?
Better would be to post a photo of your page.

Schoony-Oracle

Posting a few pics.
This is the error after I select a product from the drop down.
error.jpgSetValue Code:
setvalue.jpgDB Table:
table.jpg

Adnan3114

I just tried it on my APEX using same method and it worked. I think the scale and precision difference between the two columns is causing the error? Use TO_NUMBER function with ROUND and see what happens.
EDIT: I think you are using Format Mask for one column (unit price). Try removing all format masking and see what happens.

Schoony-Oracle

Thx for the sanity check!
I think what is happening is that the Unit Price's dollar amount is being passed in as a string, e.g. :unit_price = '$475.00'. When I cast it using to_number the calculation works.
to_number(:unit_price, '$99999.99') * :quantity;
Again, I appreciate the help!
Just saw your edit. Yup, that (format mask) was it.

1 - 4

Post Details

Added on Aug 3 2022
4 comments
149 views