Round function overload
Hello,
I am doing EDB Postrgres migration portal. I saw that because of my structure of databese none of calls in views for function ROUND works (Acording to documentation ROUND(NUMERIC, INTEGER). So I wrote function:
CREATE OR REPLACE FUNCTION MINERVA.ROUND ( N IN NUMBER , D IN NUMBER ) RETURN NUMBER AS tmp INTEGER; tmp2 NUMBER; BEGIN TMP:=TRUNC(D,0); tmp2:= round(N, TMP); RETURN TMP2; END ROUND; /
And for that i get errors:
- Incompatible expression found line 1, char 35
- Error in syntax recognition line 13, char 4
I guess because of name. So I tryed diferent name:
CREATE OR REPLACE FUNCTION MINERVA.EDB_ROUND ( N IN NUMBER , D IN NUMBER ) RETURN NUMBER AS tmp INTEGER; tmp2 NUMBER; BEGIN TMP:=TRUNC(D,0); tmp2:= round(N , TMP); RETURN TMP2; END EDB_ROUND; /
And here I got error:
- Incompatible NUMERIC function line 11, char 18
Don't understand what is wrong. I tryed all typecasting found in documentation and nothing helps.
any ideas welcome. thank you, Marko
Accepted Solutions (0)
Answers (5)
Answers (5)
- Report Inappropriate Content
Hi mhorvat81,
We have a new release for "EDB Migration Portal 2.3.0".
This release has the resolution for your reported issue on this thread. Please test and let us know your feedback.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Email to a Friend
- Report Inappropriate Content
Hi mhorvat81,
We have escalated this issue to our development team.
We will update you once the issue is fixed.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Email to a Friend
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Email to a Friend
- Report Inappropriate Content
Hi mhorvat81,
Thank you for rasing your query on PostgresRocks.
Currently, we are working on your issue and we will reply to you soon.
Regards,
Dhananjay
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Email to a Friend
- Report Inappropriate Content
Another intresting thing:
CREATE OR REPLACE FUNCTION EDB_ROUND ( N IN NUMBER , D IN NUMBER ) RETURN NUMBER AS tmp INTEGER; tmp2 NUMBER; BEGIN TMP:=TRUNC(D,0); tmp2:= ROUND(N , 2); RETURN TMP2; END EDB_ROUND; /
If I add fixed value of decimals (2 for example) it works also.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Email to a Friend
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Email to a Friend
- Report Inappropriate Content
Interesting thing if i change call from round to trunc it works:
CREATE OR REPLACE FUNCTION EDB_ROUND ( N IN NUMBER , D IN NUMBER ) RETURN NUMBER AS tmp INTEGER; tmp2 NUMBER; BEGIN TMP:=TRUNC(D,0); tmp2:= trunc(N , TMP); RETURN TMP2; END EDB_ROUND;