Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6077813
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:45:47+00:00 2026-05-23T10:45:47+00:00

I have got the following UDF drop function if exists getCurrency$$ create function getCurrency(dt

  • 0

I have got the following UDF

drop function if exists getCurrency$$

create function getCurrency(dt datetime, x decimal(19,4), y decimal(19, 4)) 
returns decimal(10,4) reads sql data
begin
     declare currencyval decimal(10,4);

     /* Some conditions */
     select case when dt = "2000-12-31" then 0 else round((x/y), 4) into currencyval;

     return currencyval;
end$$

Sometimes this UDF throws Data truncation error.
I can resolve the issue but the before even that I want some information regarding the Decimal data type and the significance of 10, 4 in the parameters.

It would be good if you give some examples with the boundary conditions.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T10:45:47+00:00Added an answer on May 23, 2026 at 10:45 am

    10, 4 means 6 digits (integer part) before point and 4 after (fractional part).

    So the biggest possible number you can return is 999999.9999

    In your particular case it is not possible to say what values are boundary for x and/or y, but you can check if the return value (currencyval) is out of -999999.9999 .. 999999.9999 range.

    Btw, if you’re asking about x and y in DECIMAL (x, y) records, then:

    • x = 1..65
    • y = 0..30 && y <= x

    References:

    • MySQL 5.7 Reference Manual :: 11.2.2 Fixed-Point Types (Exact Value) – DECIMAL, NUMERIC
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have got the following exception when try to select data from SQL Server
So far, I have got the following: $.getJSON('getinfo.php', { id:id }, parseInfo); function parseInfo(data)
I have got the following very simple code: function init() { var articleTabs =
Good Morning, I have got the following function: FUNCTION queryDatabaseCount(sqlStr) SET queryDatabaseCountRecordSet = databaseConnection.Execute(sqlStr)
I have got following folder structure for my domain (domain.com): /data/images (it´s subdomain name,
I have got the following SQL statement (SQL Server): DECLARE @atr nvarchar(255), @con nvarchar(1000),
i have got the following problem: I want to create a new Liferay Theme
So, I have got following data in a MySQL table: mysql> SELECT * FROM
I have got the following simplified schema: CREATE TABLE [file] ( id UNIQUEIDENTIFIER NOT
I have got the following issue, my function appends code to a string $string

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.