NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

sqlException : "Invalid scale size. Cannot be less than zero." when executing script with UNION

 
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Users
View previous topic :: View next topic  
Author Message
kazeopeia



Joined: 07 Jul 2011
Posts: 1

PostPosted: Thu Jul 07, 2011 4:09 pm    Post subject: sqlException : "Invalid scale size. Cannot be less than zero." when executing script with UNION Reply with quote

I received this sqlException while debugging : Invalid scale size. Cannot be less than zero.
I was executing this script :

select trunc(A.ft_dt) - trunc(sysdate) from table_name A
UNION
select trunc(A.bp_dt) - trunc(sysdate) from other_table_name A

note : FT_DT and BP_DT are both of type DATE
The exception occurs on
CachedRowSet.populate(ResultSet)

The script works fine when ran on pl/sql but not when I'm debugging in netbeans.

I tried the following for work around:
1. added ojdbc14.jar in my library
2. (CASE When trunc(A.ft_dt) - trunc(sysdate) < 0 Then 0 Else trunc(A.ft_dt) - trunc(sysdate) END) -> I did
this because I thought it's because of the negative number that I'm getting when subtracting dates.
3. Also tried decode()
4. I wanted to try
FilteredRowSet frs = new OracleFilteredRowSet()
but i can't find OracleFilteredRowSet in ojdbc14.jar

But the weird and frustrating thing is when I tried running the statements separately... without the UNION,
they both worked so the statements are actually working, but when I put them in UNION the above
sqlException would happen.

I am using Oracle 10g
jdk 1.5
netbeans ide 6.9
Back to top
tkellerer



Joined: 15 Aug 2008
Posts: 475

PostPosted: Fri Jul 08, 2011 8:50 am    Post subject: Re: sqlException : "Invalid scale size. Cannot be less than zero." when executing script with UNION Reply with quote

kazeopeia wrote:
I received this sqlException while debugging : Invalid scale size. Cannot be less than zero.
I was executing this script :

select trunc(A.ft_dt) - trunc(sysdate) from table_name A
UNION
select trunc(A.bp_dt) - trunc(sysdate) from other_table_name A
This forum / mailing list is for discussing problems with the usage of the NetBeans IDE. It's not for general Java questions and definitely not for SQL problems.

Please post this either to Oracle's JDBC Forum or to another Java programming related forum.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo