Re: Collections

From: Malcolm Dew-Jones <yf110_at_vtn1.victoria.tc.ca>
Date: 3 Feb 2010 14:25:15 -0700
Message-ID: <4b69f7cb$1_at_news.victoria.tc.ca>



The Magnet (art_at_unsu.com) wrote:

: Hi,

: Can you call a procedure from SQLPLUS that takes a collection as
: input?

: INSERT_PORTFOLIO_ARR (
: p_customer_id NUMBER,
: p_price IN_ARR,
: p_shares IN_ARR,
: p_date IN_ARR,
: p_product VARCHAR2 DEFAULT NULL)

: IN_ARR is defined as:

: CREATE OR REPLACE TYPE "IN_ARR"
: AS VARRAY (100) OF VARCHAR2(100)

: Not sure how to do that. I'm looking around for some examples, but
: has anyone ever attempted this?

Presumably you could use a declare/begin/end block, something like

	declare
	  the_in_arr IN_ARR;
	begin
	  the_in_arr := IN_ARR('first line goes here');
	  INSERT_PORTFOLIO_ARR( ... the_in_arr ... );
	end;

Of course in my example I am assuming there is an IN_ARR() constructor that accepts that single string parameter, you would use whatever is appropriate. The EXEC sqlplus command is really just a short cut for begin/end, and I asusme you could use exec something like this.

        EXEC INSERT_PORTFOLIO_ARR(... IN_ARR('first line goes here') ...) Received on Wed Feb 03 2010 - 15:25:15 CST

Original text of this message