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 question.(5)

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

ITtutoria

ITtutoria Logo ITtutoria Logo

ITtutoria Navigation

  • Python
  • Java
  • Reactjs
  • JavaScript
  • R
  • PySpark
  • MYSQL
  • Pandas
  • QA
  • C++
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Python
  • Science
  • Java
  • JavaScript
  • Reactjs
  • Nodejs
  • Tools
  • QA
Home/Questions/How to fix the error: no function matches the given name and argument types. you might need to add explicit type casts.?
Next
Answered
Kennedy Koss
  • 3
Kennedy Koss
Asked: July 15, 20222022-07-15T11:45:42+00:00 2022-07-15T11:45:42+00:00In: Error

How to fix the error: no function matches the given name and argument types. you might need to add explicit type casts.?

  • 3

I used DBeaver to develop a stored procedure in PostgreSQL. And I’m attempting to invoke the method from DBeaver in order to enter data into the table.
However, I’m getting an error:
no function matches the given name and argument types. you might need to add explicit type casts.

Procedure:

CREATE OR REPLACE FUNCTION public.proc_insert_test(p_brndcode integer,
p_brndname varchar(100),
p_brndsname varchar(100),
p_prdtype char(1),
p_discontinue char(1),
p_crddate date,
p_status integer,
p_recstat integer,
p_brndgrpseqno integer,
p_wefrom date)
RETURNS char
LANGUAGE plpgsql
AS $body$
BEGIN
Insert into arc_mmstbrndgroup(brndcode, brndname, brndsname, prdtype, discontinue, crddate, status, recstat, brndgrpseqno, wefrom)
values(p_brndcode, p_brndname, p_brndsname, p_prdtype, p_discontinue, p_crddate, p_status, p_recstat, p_brndgrpseqno, p_wefrom);
END;
$body$
;

Calling the procedure:

select public.proc_insert_test(123, 'Test2', 'Test2', 'T', 'T', now(), 1, 9, 1234, now());

How can I fix this problem? Thanks

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

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Best Answer
    dttutoria Expert
    2022-07-15T12:03:45+00:00Added an answer on July 15, 2022 at 12:03 pm

    The cause: Implicit translation from timestamp to date data type is not supported by Postgres. The date type in Postgres differs from the date type in Oracle. That is why the error “no function matches the given name and argument types. you might need to add explicit type casts.” occurs.

    Solution:

    CREATE OR REPLACE FUNCTION public.test(v date)
    RETURNS void
    LANGUAGE plpgsql
    AS $function$
    BEGIN
    RAISE NOTICE '%', v;
    END;
    $function$
    
    postgres=# SELECT test(now());
    ERROR: function test(timestamp with time zone) does not exist
    LINE 1: SELECT test(now());
    ^
    HINT: No function matches the given name and argument types. You might need to add explicit type casts.
    postgres=# SELECT test(current_date);
    NOTICE: 2019-11-14
    +------+
    | test |
    +------+
    | |
    +------+
    (1 row)
    
    postgres=# SELECT test(now()::date);
    NOTICE: 2019-11-14
    +------+
    | test |
    +------+
    | |
    +------+
    (1 row)

    date conversions from timestamps (the result type of the now() function) are failing. It is by default disallowed. As a result, you could either enforce it (by explicitly casting) or utilise the pseudo constant current_date, which gives back date type and eliminates the need for conversion.

    • 3
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

Sidebar

Ask A Question

  • How to Split String by space in C++
  • How To Convert A Pandas DataFrame Column To A List
  • How to Replace Multiple Characters in A String in Python?
  • How To Remove Special Characters From String Python

Explore

  • Home
  • Tutorial

Footer

ITtutoria

ITtutoria

This website is user friendly and will facilitate transferring knowledge. It would be useful for a self-initiated learning process.

@ ITTutoria Co Ltd.

Tutorial

  • Home
  • Python
  • Science
  • Java
  • JavaScript
  • Reactjs
  • Nodejs
  • Tools
  • QA

Legal Stuff

  • About Us
  • Terms of Use
  • Privacy Policy
  • Contact Us

DMCA.com Protection Status

Help

  • Knowledge Base
  • Support

Follow

© 2022 Ittutoria. All Rights Reserved.

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.