how to pass javascript array to oracle store procedure by ado parameter object

天涯浪子 提交于 2019-12-11 13:22:48

问题


I am working on a asp+oracle web project, and I need a multiple user select function.

1, use javascript build up a string array :

 var userArray = ["Simon","Sheng","Cheng"];

2, pass it by ado parameter object,but I don't know how to fill Parameter ojbect :

var cmd = Server.CreateObject("ADODB.Command");
var param = cmd.CreateParameter("par",????????????)<--I don't know how to fill;

3, create store procedure in oracle

    create or replace package demo_pkg
    as
       type charArray is table of varchar2(255) index by binary_integer;
       type t_cursor is ref cursor;
    procedure p_test(p_id in charArray,p_cursor out t_cursor );
    end;

    create or replace package body demo_pkg
    as
    procedure p_test (p_id in charArray,p_cursor out t_cursor )
    AS
v_cursor t_cursor;
    BEGIN
open v_cursor for
      select last_name from employees where last_name in (select * from table(cast(p_id as charArray)))
p_cursor := s_test;
    end;
    end;

After 3 days google, I still here, so who can help me?


回答1:


The format is:

CreateParameter( name, type, direction, size, value )

The values you'll need are:

adVarChar = 200
AdArray = 0x2000
adParamInput = 1

And you'll call it like:

var param = cmd.CreateParameter( 'par', adVarChar + AdArray, adParamInput, 255, userArray )


来源:https://stackoverflow.com/questions/11419308/how-to-pass-javascript-array-to-oracle-store-procedure-by-ado-parameter-object

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!