Here is my code-
CREATE OR REPLACE PROCEDURE some_proc_name("LOAD_MONTH" INTEGER, "LOAD_YEAR" INTEGER)
RETURNS VARCHAR(16777216)
LANGUAGE SQL
EXECUTE AS CALLER
AS declare
result string;
v_EXTRACT_DATE DATE;
cur CURSOR FOR
SELECT distinct EXTRACT_DATE
FROM some_table_name
where month(EXTRACT_DATE) = :LOAD_MONTH and year(EXTRACT_DATE) = :LOAD_YEAR;
begin
return 'SUCCESS';
end;
This stored procedure gets create successfully.
But when i call this with below code, it throws me error.
Code -
call some_proc_name(1,2025);
I have also tried multiple other ways like-
- replace :LOAD_MONTH with identifier(:LOAD_MONTH)
- removed "" from LOAD_MONTH proc argument
- put cur variable inside begin block with let cur <all_details>
But, all are throwing same error as before.
:
. Colons are used for parameters to prepared statements, not variables.