给定一个Oracle存储过程:
我该如何在ColdFusion中调用这个呢?
CREATE TYPE stringlist AS TABLE OF VARCHAR2(100);
/
CREATE PROCEDURE test_proc(
list IN stringlist,
output OUT VARCHAR2
)
AS
BEGIN
IF list IS NULL OR list IS EMPTY THEN
RETURN;
END IF;
output := list(1);
FOR i IN 2 .. list.COUNT LOOP
output := output || ',' || list(i);
END LOOP;
END;
/
我该如何在ColdFusion中调用这个呢?
<cfscript>
arr = [ 'A', 'B', 'C' ];
sp = new StoredProc(
dataSource = "orcl",
procedure = "test_proc",
result = "NA",
parameters = [
{ cfsqltype = "CF_SQL_ARRAY", type="in", value = arr },
{ cfsqltype = "CF_SQL_VARCHAR", type="out", variable = "out" }
]
).execute();
// WriteDump( sp.getProcOutVariables().out );
</cfscript>
失败原因:
Error Executing Database Query
Fail to convert to internal representation: [A, B, C]