Newbie here. I am trying to execute stored procedure located at DBLINK. Here's my code:
DECLARE
TYPE ARRAY_VARCHAR2 IS TABLE OF VARCHAR2(32767);
Vparams ARRAY_VARCHAR2 := ARRAY_VARCHAR2('p1', 'p2', 'p3');
Vvalues ARRAY_VARCHAR2 := ARRAY_VARCHAR2('v1', 'v2', 'v3');
o_result_clob CLOB;
o_result VARCHAR2(32767);
result_cursor SYS_REFCURSOR;
BEGIN
EXECUTE IMMEDIATE 'CREATE TYPE ARRAY_VARCHAR2 AS TABLE OF VARCHAR2(32767)';
EXECUTE IMMEDIATE '
DECLARE
p_result CLOB;
BEGIN
PACKAGE.PROCEDURE@DBLINK(
Icommand=> ''MY_COMMAND'',
Iparam_List => :arr,
Ivalue_List => :arrv,
O_RESULT => p_result
);
:res := p_result;
END;'
USING IN Vparams, IN Vvalues, OUT o_result_clob;
o_result := DBMS_LOB.SUBSTR(o_result_clob, 4000, 1);
DBMS_OUTPUT.PUT_LINE('Result: ' || o_result);
CLOSE result_cursor;
END;
And this is what's happening (the error):
ORA-06550: line 12, column 22:
PLS-00457: expressions have to be of SQL types
ORA-06550: line 1, column 402:
PL/SQL: Statement ignored
For someone like me this is so much complex code, it would be a great pleasure if you could assist me, thanks in advance. (At least to give some structural template)