473,382 Members | 1,202 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Improper result when number table is used to substitute the "IN" clause in oracle

Hi Guys

Need a help i am facing a sporadic issue when executing the query
using nested table of numbers

Here are the things which i did

1. I created a type as
CREATE TYPE NUMBERTABLE AS TABLE OF NUMBER;

2.In the JDBC Code
i declare a long[] longArray and populate the long array by going
through some query

3. Then i execute the following query
String str = "select id from table1 where id in (SELECT * FROM TABLE
(SELECT CAST(? AS NUMBERTABLE ) FROM DUAL))

OraclePreparedStatement pstmt = conn.prepareStatement(str)

//Create the ArrayDescriptor and array object
ArrayDescriptor desc = ArrayDescriptor.createDescriptor("NUMBERTABLE "
,conn);
ARRAY array_to_pass = new ARRAY(desc, conn, longArray );
pstmt.setARRAY(1,array_to_pass);

//Execute the Query

ResultSet rs = pstmt.executeQuery();

while(rs.next())
{
System.out.println("**** Id is : " + rs.getLong(1));
}

4.Guys the problem i am facing is that query is not displaying all the
results

For Ex:
if the longArray = {100,101,102,103,104} , if this array is bound and
the query executed, sometimes not all the 5 values are displayed ,
like this one happened to me

"**** Id is : 100
"**** Id is : 101
"**** Id is : 102

103,104 were not displayed even though the longArray contained them
,Plz dont suggest me to use "IN" clause instead since the longarray
size may exceed 1000 entries

Can anyone there tell why the last 2 entries are not
displayed(chopped),guys my work is stuck up ,pl help

sarith
Jul 19 '05 #1
0 1837

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: google_user | last post by:
Hi, I need to create a table in Oracle DB using SQL before which I need to check if it exists or not, where the dbuser will have CONNECT and RESOURCE privileges granted. All this needs to be...
3
by: premmehrotra | last post by:
I am using Access 2000 and Oracle 9.2.0.x on a Windows 2000. I have setup Oracle 9.2 ODBC Driver (I have not yet figured how to set Microsoft's Oracle ODBC driver). I am exporting a table from...
2
by: Johann Blake | last post by:
I posted a related problem today. The problem is this: string str1 = @""""; When I execute this code (even in a bare bones application), in the IDE it returns "\""" Why? Even in the...
1
by: chaticathe | last post by:
I am trying to determine the record number of a record in Oracle Forms so I can navigate to that record. I am using the code below but it only gives me the record number of the record I am currently...
5
kiss07
by: kiss07 | last post by:
Hi deba, What is the usage of dual table in oracle?Use any applications? what is difference between decode and if-the -else(any restrictions)between two:? pls explain.. ARUN..
0
by: jai83 | last post by:
hi, How can Stored procedures be used in oracle reports for creating reports instead of SQL queries? Thank you.
2
by: thakursdbest | last post by:
hi! do anybody know how to round of f a number in oracle such that 81 to 90 82 to 90 83 to 90 . . . . .
5
by: Naveen Kumar Srivastava | last post by:
Hi to All I want to create a table in oracle having name more than 16 character how i can? I know that oracle support table namt upto 28 character by default it support 15 character but i don't...
7
by: h13p | last post by:
How do I get columns displacement for a table or tables in Oracle? Is there a command for it? I am thinking about to write a COBOL program to do this by read in the output of SQL/PLUS DESC...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.