To get a simple procedure involving MERGE statement to work.
I am able to test this code individually in worksheet and I am able to compile the procedure also, but Im not able to run it without errors. Its failing at the statement where it gets the RESULT_SCAN values to variables.
CREATE OR REPLACE PROCEDURE merge_source_to_target()
RETURNS VARCHAR
LANGUAGE SQL
EXECUTE AS CALLER -- Enables access to session variables
AS
$$
DECLARE
v_merge_query_id VARCHAR;
…
see more