Question

Passing Varray to procedure and use in query

Rating9.4Excellent

How can I use a pl/sql array in a sql-statement?
I want to do something like (shortened):

   BEGIN find_objects(grouplist('A','B','C','D','E','F'), :returned);

   CREATE OR REPLACE TYPE grouplist AS varray(20) OF varchar2(20);
   PROCEDURE find_objects (price_group_in IN grouplist, return_value IN OUT objectlist);
      SELECT * FROM objects WHERE objects.price_group IN price_group_in

But when I try to create the procedure it throws me this error.
ORA-00932: inconsistent datatypes: expected NUMBER got MYUSER.GROUPLIST

It works if I replace the select-line with this:
      SELECT * FROM objects WHERE objects.price_group IN ('A','B','C','D')

  1. Create a select all stored procedure.
    I need to implement the following: PROCEDURE select_all_price_list_hdr ( SELECT * FROM INIT_PRICE.PRICE_LIST_HDR order by PRICE_LIST_HDR_ID [WebMethod] public DataSet GetPriceListHeader() { //All .NET DB connectivity requires a connection, adapter, and dataset. System…
  2. Hirarchical select list / query
    Hey guys! I am working with Oracle Apex and need to create a select list with hirarchical order. Assuming I have a table "TBL_ARBEITSSCHRITTE" containing 130 rows, there are 4 rows, which should stand out. All others should be inline and related to those 4 main records. Is it somehow possible using the primary key and a…
  3. Oracle Select Statement  ?
    Hi, I'm not sure what's wrong with me this seem to be very simple but i keep getting error messages. I'm trying to create a query using only AND and OR operators on a table call BOOK_CUSTOMER. The goal is to select all customer information where the REFERRENCE column is NULL and the customer lives in either NJ or FL which is indicated in the "…
  4. Oracle SQL - select in a select
    I have a table called A091007DEV_AJOB. In a second table I have an entry with 091007DEV_A I need to do a select within a select and do not know how it will work. I need to do this with the correct syntax. select * from A(select ACTIVE_NET_NAME from comm)JOB; How do I add the A to the front and J…
  5. select columns outside MINUS query
    I am writing a oracle sql that selects the rows from first query minus the rows from second query and that works great but I want to select corresponding columns from the same table not impacting the results of the query.. for example select productA from product_table where product_catalog = 'CUSTOM' minus select productA from product_table …

Solution

Sign up now to view this solution! It's quick, easy, and secure to subscribe. We will return you to this solution, unlocked, when you’re done.

About this Solution
View This Solution - Start Your 30 Day Free Trial
Zone
General
Tags
array procedure varray
Participating Experts
1
Solution Grade
A

Replies

 
by:

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 
by: zreak

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 
by: RCorfman

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 
by: zreak

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 
by: RCorfman

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

Stay Connected

Oracle Around the Web

The latest Oracle news, tips, and tricks

Oracle Unveils Netra SPARC T3 Servers

New Carrier-Grade Blade and Rackmount Servers Deliver Better Performance, Density and Power Efficiency for the Communications Industry ...

read more

Oracle fixes 21 flaws in Java SE, Java for Business

Oracle is fixing 21 flaws in its Java SE and Java for Business products in its February critical patch update issued this week ...

read more

Obama’s Silicon Valley “Tech Supper”

Why was he there? Who wasn’t invited and why? What did they talk about? Why was he really there? These are the questions being debated ...

read more

Featured Oracle Experts

slightwv

slightwv has answered more than 2,000 Oracle questions and oversees database management within the U.S. Government. Slightwv

sdstuber

A regular presenter at the Collaborate conference, Oracle developer sdstuber is a top expert in PL/SQL and Oracle 9, 10 and 11. sdstuber

Testimonials

What users are saying about our experts

"The Oracle gurus provide answers, solutions and valuable workarounds"

User: schwertner

"Wow! Excellent, valuable explanation. Hats off to you"

User: aseshu70

"Solution worked fantastic and performs excellent! Thanks heaps"

User: klausbrandlhuber

Top Experts

  1. slightwv

    2,000

    0 points yesterday

    Profile

BrowseBecome an Expert