0

Can anyone help me to resolve the issue ??

    CREATE OR REPLACE FUNCTION func_maj_get_new_user(in_date numeric)
      RETURNS integer AS
    $BODY$
    declare

    count_newusr integer;

    begin


    SELECT count(a.app_uid) 
      INTO count_newusr 
    FROM 
    (SELECT s_start.app_uid 
       FROM devdba.s_maj_sdk_bs s_start 
      WHERE s_start.app_rts::date = current_date - in_date
       AND (s_start.app_uid,s_start.app_key) NOT IN(SELECT app_uid,app_key 
                                                      FROM datemp.maj_usr_mstr)
     )a;

return count_newusr;
end;
$BODY$
  LANGUAGE plpgsql VOLATILE;

The below function throws an error like ,

ERROR: operator does not exist: date - text LINE 1: ..._start WHERE s_start.app_rts::date = current_date - $1 AND...

3
  • The code shown in the error message does not exist in the posted function. Fix it Commented Sep 6, 2014 at 10:12
  • Sorry Code is app_rtc = current_date - in_date ,Thanks for Quick reply... app_rts is date column , I want to substract current_date - In_date(numeric argument) and check against app_rtc date column .. if i do it in normal query it works but in function its not working Commented Sep 6, 2014 at 10:17
  • So if app_rtc is already a date what's the point in casting it to a date? Commented Sep 6, 2014 at 10:21

1 Answer 1

1

in_date must be integer

current_date - in_date::integer

Or just pass it as integer

func_maj_get_new_user(in_date integer)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.