Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

last comma in array

843853May 17 2005 — edited May 18 2005
I think that it wasn't possible in the previous versions of java. The next code compiles fine with jdk1.5.0:
public class Test {
    public static void main(String[] args) {
        int[] arr1 = {1, 2, 3,};  // <- last comma
        
        String[] arr2;
        arr2 = new String[]{"a", "b", "c",};  // <- last comma
        
        float[] arr3 = {,};  // <- last comma

    }
}
Is it a bug or a feature?

Comments

Gaz in Oz

Your update syntax suggests you are working with MYSQL db.

It always helps to format your code into a more readable and maintainable style, for example:

Update products,

       orderdetails,

       orders

set    products.UnitsInStock = (products.UnitsInStock - orderdetails.Quantity),

       ShippedDate = current_date()

where  products.ProductID = orderdetails.ProductID

and    orders.OrderID = orderdetails.OrderID

and   (ShippedDate is null and

       orderdetails.Quantity < UnitsInStock)

and    orders.OrderID  = 11039;

The fact the update is updating rows you don't want it to means you haven't got the join to the three tables correct.

Write it as a select statement first then convert it into an update when you are sure it will update the rows you want it to.

...and as this looks like a mysql question you be better off asking your question here or

here http://forums.mysql.com/

John Thorton

Gayathri Venugopal wrote:

Hi, I need to update UnitinStock and Shipped Date of products based on these conditions.

1)When the shipped date is null and

2) when Quantity < Unit in stock.

But my query is updating Shipped date of all the orders even when this condition Quantity < Unit in stock is not satisfied .

How do I satisfy these 2 conditions and update colums:

Update products,orderdetails,orders

set products.UnitsInStock = (products.UnitsInStock - orderdetails.Quantity), ShippedDate = current_date()

where products.ProductID =orderdetails .ProductID and orders.OrderID = orderdetails.OrderID

and (ShippedDate is null and orderdetails.Quantity < UnitsInStock) and orders.OrderID = 11039

Please click on URL below & provide details as stated in #5 - #9 inclusive

How do I ask a question on the forums?

Please post full results from SQL below

SELECT * FROM V$VERSION;

mathguy

You were told two days ago, in a different thread you started, that this is NOT A MySQL FORUM.   Repeat:  This is NOT A MySQL FORUM.  Is that hard to understand?

Timo Hahn

***Moderator action (Timo): User, I moved you thread to the MySql space as it isn't about OracleDB.***

1 - 4
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Jun 15 2005
Added on May 17 2005
1 comment
61 views