In java :
Date d[] = new Date[2];
Date temp[] = {new Date(),new Date()};
In Oracle
temp date = (sysdate,sysdate);--it works
but how to define size of temp as 2 as we do in java code.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I’m not quite sure that I understand the question. You’ve tagged it for PL/SQL so I assume that your “in Oracle” code is intended to be syntactically correct PL/SQL code but what you’ve posted isn’t valid syntax.
In PL/SQL, you have three different types of collections. You have nested tables, associative arrays, and varrays. You do not declare a size for nested tables or associative arrays at compile time– they will use whatever space they need. You do declare a size for varrays at compile time so you can declare a varray that stores two dates. I can’t envision a case where I would ever want to declare a varray of size 2 rather than using a nested table, though, since you get no benefit from limiting yourself to a 2 element collection. If you want to, though, you can declare the varray as I do below.