Comparing dates for equality using API

Hello,
I was wondering if you could help me understand if it is possible for me to compare two dates for equality.
I am looking to only compare the date and the month. So, if I am checking "today" with another objects Date for equality, it obviously fails because the compareTo and the equals method of both Date and Calendar, I think, are comparing even the timestamps.
here is something I wrote for testing, which obviously is of no use
Calendar today = Calendar.getInstance();
Calendar later = Calendar.getInstance();
later.set(Calendar.HOUR, 03);
System.out.println(today.getTime());
System.out.println(later.getTime());
if(today.equals(later)){
   System.out.println("BIG BANG");
if(today.compareTo(later)<0)
   System.out.println("Today Date is Lesser than my Date");
else if(today.compareTo(later)>0)
   System.out.println("Today Date is Greater than my date");
else
   System.out.println("Both Dates are equal");   
Date today = new Date();
Date myDate = new Date();
myDate.setHours(23);
System.out.println(today);
System.out.println(myDate);
if(today.compareTo(myDate)<0)
   System.out.println("Today Date is Lesser than my Date");
else if(today.compareTo(myDate)>0)
   System.out.println("Today Date is Greater than my date");
else
   System.out.println("Both Dates are equal");   
   So is then the only way left, is using the simple date formatter and going about things ?

package forums;
import java.util.Calendar;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
public class CalendarExample
  private static final DateFormat DF = new SimpleDateFormat("yyyy-MM-dd");
  public static void main(String[] args) {
    Calendar today = Calendar.getInstance();
    Calendar later = Calendar.getInstance();
    later.set(Calendar.HOUR, 3);
    System.out.println("today="+DF.format(today.getTime()));
    System.out.println("later="+DF.format(later.getTime()));
    System.out.println("isSameDayAndMonth(today, later) = "+isSameDayAndMonth(today, later));
    System.out.println("\n");
    Calendar tomorrow = Calendar.getInstance();
    tomorrow.set(Calendar.DATE, tomorrow.get(Calendar.DATE)+1);
    System.out.println("today="+DF.format(today.getTime()));
    System.out.println("tomorrow="+DF.format(tomorrow.getTime()));
    System.out.println("isSameDayAndMonth(today, tomorrow) = "+isSameDayAndMonth(today, tomorrow));
    System.out.println("\n");
  public static boolean isSameDayAndMonth(Calendar a, Calendar b) {
    return a.get(Calendar.DATE) == b.get(Calendar.DATE)
        && a.get(Calendar.MONTH) == b.get(Calendar.MONTH)
}You're welcome... Javas standard date libraries leave a lot be desired. I recommend you try Joda, which is [a long standing JSR, which has never gotten up|http://www.theserverside.com/news/thread.tss?thread_id=44248].

Similar Messages

  • Comparing layers for equality

    Is it possible to compare two different layers to see if they are in fact the same image?
    I'm actually working on a game at the moment. The game map was created by using game sprites created by other people. For example, I found 5 different pictures of trees, and copy pasted them into photoshop multiple times to create a forest. I have 100 trees in my photoshop document, but in reality, they are all made up of only 5 images. I want to save out each of these trees into a format usable by my game engine. I want to save each layer as an image, but avoid saving duplicates. Thus the need to compare layers for equality.
    Is it possible to do this within a photoshop script? Thanks for any help you can provide.

    but wouldn't this only work in the instance of them being on top of each other?
    That bit of code presumes:
    The layers are in the same document
    The layers are the only two layers visible
    The content of the layers is aligned.
    The layers have simple content (no layer masks, vector masks, layer styles)
    There may be other assumptions that I'm making, but this is all that I can think of.
    For the trees/forest problem, I would iterate though the tree-layers.
    Create a new document that is as large as the largest tree-layer in the forest.
    Hide the background layer.
    Copy the first layer to the new document.
    Copy the second layer to the new doc
    Do the layer comparison code from above my previous post
    If the layers are the same, delete the new one.
    Go to the next layer in the forest document.
    Copy and compare the new layer against each layer in the new document.
    Delete it if it's a dupe.
    When you're done, the new document should have only the unique trees.

  • Extract data from Essbase using APIs

    Hi All
    I was going through the API documentation for Essbase and data extraction from Essbase using API.
    It seems APIs make use of Report script to extract data from Essbase. This would increae the overhead of writing a report script everytime you need to extract data from Essbase.
    Is there any other method to extract/export whole or specific data from essbase using APIs?
    How does Excel Add-in retrieves data from essbase without any report script?
    Can Provider services be helpful in any way to achieve this?
    Please help

    Hi,
    Its hard to say if there is a faster way without knowing how you're doing it now. A few questions:
    - why are you using the API to get at Essbase Data, especially if you've already defined a (some) report scripts?
    - if you want to use provider services, vs having to ensure all the libraries and the client are present, why not use the JAPI?
    - Without seeing your code, its hard to know why you're getting out of memory errors. What are you doing with the data as you're parsing it from the report?
    Grid API exists for the C API, and more noteable the JAPI, but not VB(I'm surprised the VB api still exists).
    Why not just use the Java API?
    Robb

  • Setting Due Date for task using business days

    While this may not be new news to many, I found little information on how to add a certain number of business days to determine the due date for a task to be used in a workflow.  For SharePoint 2010 environments that cannot run custom code, I have
    found a solution that utilizes two additional columns in the task list.  The first column I named
    Deadline (a number with no decimal places), which will contain the number of business days until a task is to be completed.
    The second I named Business Deadline (a calculated column returning a
    Date and Time).  The formula for the calculated column is:
    =[Modified]+INT(ROUNDDOWN([Deadline]/5,0)*7)+ IF(WEEKDAY([Modified]+MOD([Deadline],5))<MOD([Deadline],5), IF(WEEKDAY([Modified]+MOD([Deadline],5)+2)=7,MOD([Deadline],5)+4, IF(WEEKDAY([Modified]+MOD([Deadline],5)+2)=1,MOD([Deadline],5)+3,MOD([Deadline],5)+2)), IF(WEEKDAY([Modified]+MOD([Deadline],5))=7,MOD([Deadline],5)+2, IF(WEEKDAY([Modified]+MOD([Deadline],5))=1,MOD([Deadline],5)+1,MOD([Deadline],5))))
    The workflow on create in the task list then is:
    Set Deadline to {number of business days}
    then Wait for Deadline to equal {number of business days} 'Necessary to ensure the Business Deadline has been set
    'then Set Due Date to CurrentItem:Business Deadline
    Hope this helps a few others that are beating their heads against their desks like I was.

    Hi,
    Glad to hear that you solve this issue, thanks for your sharing.
    Thanks,
    Linda Li
    Linda Li
    TechNet Community Support

  • On iPhone 5c iOS 8.2, I go to settings, cellular, use cellular data for: Under "use cell data for are my apps but they are greyed out how can I ungrey them??

    iOS 8.2 on iPhone 5c, goto settings, cellular, use cellular data for: all my apps under "use cellular data for" are greyed out. I've restart and hard reset. Looked thru all settings. Can someone help??

    Did you try to reset the phone by holding the sleep and home button for about 10sec, until the Appel logo comes back again? You will not lose data by resetting.
    If this does not work, did you try to switch off Cellular Data, restart the phone and switch it back on again?

  • How to handle HTTP-POST encrypted data for ECC Using proxy or RFC

    I have a scenario HTTP-POST ->PI->ECC.sender is HTTP Post  send encrypted data i need to handle the data and stored in to SAP ECC  with out decrypt using PI .what should i take for receiver  can i use inbound proxy or RFC  and how can handle the encrypted data  for decrypt.
    Regards
    Ravi

    1. my sender is HTTP POST . what should i configure in sender communication channel in SAP PI .like SOAP or HTTP .What are the parameters i need to pass .
    >>>
    If you are on PI 7.3 and above, configure the HTTP AAE adapter - Configuring the Java HTTP Adapter on the Sender Channel - Advanced Adapter Engine - SAP Library
    2.while using inbound proxy for encrypted data  i need  store the data in to table , the same proxy can i call  another outbound  service for decrypt  same data.
    >>>>
    Yes you can always a proxy within a proxy.

  • How to upload data for me01 using LSMW BDC METHOD

    *hi export please tell me the complete procedure for uploading data in me01 using LSMW BDC METHOD*
    Moderator message: please search for available information/documentation.
    Edited by: Thomas Zloch on May 8, 2011 10:06 PM

    Hi,
    To be honest I don't understand your question. When You execute LSMW and create project, then all steps are shown in a very clear way with good description. With which one you have problems?
    Best regards
    Marcin Cholewczuk

  • Create new survey data for opportunity using abap code

    Hello to all,
    I have one requirement.
    create survey data for given opportunity ID using abap code. or copy survey data from one opportunity to another opportunity using abap.
    any ideas..
    many thanks
    Babu

    Hello Babu,
    You can do this through the CRM_ORDER_MAINTAIN FM, this is the generic FM to edit any transaction in CRM.
    The FM contains an internal table IT_SURVEY that must be filled. Actually, this table will only contain a reference to the (completed) survey, it doesn't store the data of the survey itself.
    For some example coding, take a look at the SrvTSurvey.do controller. If you want to see what data is stored in the IT_SURVEY table, create a transaction and attach a completed survey to it (you can easily do it in the standard views of the webclient) and take a look at the survey structure in the CRM_ORDER_READ FM/Report.
    Let me know if you need more guidance,
    Reward points if useful,
    Regards,
    Joost

  • Comparing objects for equality with UDT's

    Hi.
    I was wondering how Oracle does comparison for equality of objects that contains parameters of user defined types.
    Suppose I have an object with a parameters whose types are:
    1) number,
    2) varchar2,
    3) nested table type,
    4) associative array
    and I want to compare two such objects for equality. Would Oracle compare all parameters of this 2 compared objects field-by-field (and dig recursive to "leafs"), or would it compare only 1), 2) and doas nothing with 3) and 4)?
    Must I declare an order method for such comparison?

    You didn't specify a version - this is correct for 10.2, I'm not sure if it has changed in 11g.
    By default it will compare for exact equality - i.e that every attribute is the same. You can also only do it in SQL, not PL/SQL. Also can only do = and <> - you cannot do < or > etc.
    You need to create a MAP or ORDER method on the type to do any more sophisticated comparison (Same as in most object oriented languages). Documentation is here http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14260/adobjbas.htm#sthref211

  • Changing DN for GROUPS using API

    I have such code that I change GROUP attributes in OID with:
    ModPropertySet m=new ModPropertySet();
    Group mygroup;
    mygroup=new Group ( Util.IDTYPE_DN,groupName );
    m.addProperty(LDIF.RECORDCHANGE_TYPE_MODDN,"distinguishedname",newDN);_
    m.addProperty(LDIF.ATTRIBUTE_CHANGE_TYPE_REPLACE,"displayname",newDisplayName);
    m.addProperty(LDIF.ATTRIBUTE_CHANGE_TYPE_REPLACE,"description",newDescription);
    mygroup.setProperties(dirctx,m);
    The above piece of code works well if I exclude the line with distinguishedname or DN.
    otherwise it returns this exception:
    NamingException encountered in ldapModify [LDAP: error code 65  Failed to find distinguishedname in mandatory or optional attribute list]
    Interestingly, if I put a bad newDN there, such as "hello", (not in the form of cn= .. , ...) it says:
    NamingException encountered in ldapModify cn=tester,cn=groups,dc=pooyaco,dc=com: [LDAP: error code 34 - Invalid DN Syntax]
    My question is that whether I can change DN using APIs like this or not? and how?
    Thank you.
    Farbod

    To change the RDN or DN you will need a modRDN/modDN operation, and not a direct LDAP modify.
    For this you can use the Java JNDI API, see:
    http://java.sun.com/docs/books/tutorial/jndi/ldap/rename.html
    BR,
    Octavian

  • How to set default payment method for Supplier using API

    Hi All,
    I am doing data conversion and loading suppliers using ap_vendor_pub_pkg.create_vendor api. But, I cannot see any payment_method_lookup_code column in the RECORD type AP_VENDOR_PUB_PKG.r_vendor_rec_type.
    how do I assign a default payment method to a vendor ?
    Thanks
    Shankar

    Seems like an ER with Oracle Support.
    Bug 11895105: ADDING PAYMENT_METHOD_LOOKUP_CODE FOR AP_VENDOR_PUB_PKG.UPDATE_VENDOR_SITE
    Currently system doesnt allow you to update the PAYMENT_METHOD_LOOKUP_CODE in AP_VENDOR_PUB_PKG.Update_Vendor_Site.Because above column does not define in l_vendor_site_rec regardless other procedure.

  • Retraction of MM and SD data for planning use in R/3

    Hello
    Is it possible to retract Material management data and sales and distribution data to R/3  ?
    Do we have any slandered method to retract the data ?
    I do not have any experience in retraction , so please help me with steps , how to create custom retractor if std is not available to support above retraction .
    Regards

    Hi Jain,
    A retractor is an SAP NetWeaver BI process to extract data and load it into SAP ERP (and R/3). Standard retractors are available for Profitability Analysis (CO-PA), Budget Control System (BCS), Cost Center Accounting (CCA), and Project Planning and Investment Management (PS/IM).
    In the development of planning solutions, you often need to send planned or calculated data to SAP ERP. The target for this data may be SAP standard tables or custom tables. SAP provides some standard retractors, but does not provide a framework to retract data outside of these areas to your SAP ERP or R/3 system.
    As of now SAP dosent have standard retractors in BI for SD and MM data.
    As said you can use the Open Hub Destination for the same.
    Cheers,
    Tanish.

  • Generating Data for INSERT using a Stored Procedure, Function and Cursor

    I've written a function that I finally got to compile, but was not successful in importing and inserting the data needed to populate a table with at least 1800 rows. Here's what I needed to do:
    -- Generate a random test score ranging from 20 to 100 (already done)
    -- Generate a random final grade for the course ranging from 4 to 0 (representing A to F) (already done, but question below.
    -- Use conditional statements based on the counter to assign three courses (already done -- see SQL statements)
    -- Process no more than 95% of the students (300) for test 1.
    -- For test 2, process no more than 80% of the students who took test 1. Student cannot take test 2 unless the student takes test 1 (does this require a trigger? If so, how would I go about doing this?)
    -- Use a function or another subprocedure to process the grade using IF-ELSIF statements
    For example, I've tried the following statements:
    For procedures
    IF birth_date BETWEEN to_date('01-Jan-89 AND to_date('31-Dec-89','dd-Mon-yy') THEN
    school_grade := 6;
    AND for functions:
    IF birth_date BETWEEN to_date('01-Jan-89 AND to_date('31-Dec-89','dd-Mon-yy') THEN
    RETURN (6);
    RETURN;
    - or -
    IF birth_date BETWEEN to_date('01-Jan-89','dd-Mon-yy') AND to_date('31-Dec-89','dd-Mon-yy') THEN
    school_grade := 9
    RETURN school_grade;
    -- Read the birth_date into the main procedure so that the value returned from the subprocedure or function can populate the birth_date column.
    To give you an idea of what I've already done:
    SQL>
    SQL> CREATE OR REPLACE PROCEDURE add_tests (v_school_grade IN NUMBER) AS
    2
    3 v_counter NUMBER(3) := 0;
    4 v_num_students CONSTANT NUMBER(3) := 300;
    5 v_students_test1 NUMBER := 0;
    6 v_students_test2 NUMBER := 0;
    7 v_student_id VARCHAR2(5);
    8 v_course1 VARCHAR2(2);
    9 v_course2 VARCHAR2(2);
    10 v_course3 VARCHAR2(2);
    11 v_course4 VARCHAR2(2);
    12 v_student_grade NUMBER(1) := 0;
    13 v_test_score NUMBER(3) := 0;
    14 v_course_final_grade NUMBER(1) := 0;
    15 v_birth_date DATE;
    16
    17 FUNCTION pkg_get_grade RETURN NUMBER
    18 IS
    19
    20 v_birth_date DATE;
    21 v_school_grade NUMBER(1) :=0;
    22
    23 CURSOR grade_cur IS
    24 SELECT birth_date FROM students;
    25
    26 BEGIN
    27 OPEN grade_cur;
    28 LOOP
    29 FETCH grade_cur INTO v_birth_date;
    30
    31 EXIT WHEN grade_cur%NOTFOUND;
    32
    33 -- Assign student grade
    34
    35 -- 9th Grade
    36
    37 IF v_birth_date < TO_DATE('01-Jan-87','DD-Mon-YY') THEN
    38 v_school_grade := 9;
    39
    40 -- 8th grade
    41
    42 ELSIF v_birth_date BETWEEN
    43 TO_DATE('01-Jan-87','DD-Mon-YY') AND
    44 TO_DATE('31-Dec-87','DD-Mon-YY') THEN
    45
    46 v_school_grade := 8;
    47
    48 -- 7th grade
    49
    50 ELSIF v_birth_date BETWEEN
    51 TO_DATE('01-Jan-88','DD-Mon-YY') AND
    52 TO_DATE('31-Dec-88','DD-Mon-YY') THEN
    53
    54 v_school_grade := 7;
    55
    56 -- 6th grade
    57
    58 ELSIF v_birth_date BETWEEN
    59 TO_DATE('01-Jan-89','DD-Mon-YY') AND
    60 TO_DATE('31-Dec-89','DD-Mon-YY') THEN
    61
    62 v_school_grade := 6;
    63
    64 -- 5th grade
    65
    66 ELSIF v_birth_date > TO_DATE('31-Dec-89','DD-Mon-YY') THEN
    67
    68 v_school_grade := 5;
    69
    70 END IF; -- end if loop for student's grade
    71 END LOOP; -- end loop for grade_cur
    72 CLOSE grade_cur; -- close cursor for assigning grade
    73 RETURN v_school_grade;
    74
    75 END pkg_get_grade;
    76
    77 PROCEDURE delete_test_info AS
    78
    79 BEGIN
    80
    81 DELETE FROM student_facts;
    82
    83 END delete_test_info;
    84
    85 BEGIN
    86
    87 -- Process student for tests
    88
    89 WHILE (v_counter <= v_num_students) LOOP
    90 v_counter := v_counter + 1; -- initialize counter
    91
    92 -- Set student id
    93
    94 v_student_id := 'S'&#0124; &#0124;v_counter;
    95
    96 -- portion of students taking beginning of year tests
    97
    98 v_students_test1 := v_num_students * .95;
    99
    100
    101 -- Portion of students taking end of year tests
    102
    103 v_students_test2 := v_students_test1 * .80;
    104
    105
    106 -- Est. test scores between 20 and 100
    107
    108 v_test_score := random.rand_max(80) + 20;
    109
    110
    111 -- Est. final grade for course between 0 and 4
    112
    113 v_course_final_grade := random.rand_max(4);
    114
    115
    116 -- Process tests for courses
    117
    118 IF v_counter < ROUND(v_num_students * .20) THEN
    119 v_course1 := 'C1';
    120 v_course2 := 'C2';
    121 v_course3 := 'C3';
    122
    123 ELSIF v_counter BETWEEN ROUND(v_num_students * .20)
    124 AND ROUND(v_num_students * .40) THEN
    125
    126 v_course1 := 'C2';
    127 v_course2 := 'C1';
    128 v_course3 := 'C3';
    129
    130 ELSE IF v_counter BETWEEN ROUND(v_num_students * .40)
    131 AND ROUND(v_num_students * .60) THEN
    132
    133 v_course1 := 'C3';
    134 v_course2 := 'C1';
    135 v_course3 := 'C2';
    136
    137 ELSE IF v_counter BETWEEN (v_num_students * .60)
    138 AND ROUND(v_num_students * .80) THEN
    139
    140 v_course1 := 'C3';
    141 v_course2 := 'C1';
    142 v_course3 := 'C2';
    143
    144 ELSE
    145 v_course1 := 'C4';
    146 v_course2 := 'C2';
    147 v_course3 := 'C3';
    148
    149 END IF;
    150 END IF;
    151 END IF;
    152
    153 -- Input test information for students
    154
    155 -- Beginning of year test for Course 1
    156
    157 IF v_counter <= v_students_test1 THEN
    158 INSERT INTO studentfacts
    159 VALUES(v_student_id, v_course1, 'ACH1999',
    160 TO_DATE('01-SEP-1999','DD-MON-YYYY'),
    161 v_student_grade, v_course_final_grade, v_test_score);
    162 ELSE
    163 INSERT INTO studentfacts
    164 VALUES(v_student_id, v_course1, 'ACH1999',
    165 TO_DATE('01-SEP-1999','DD-MON-YYYY'),
    166 v_student_grade, v_course_final_grade, NULL);
    167 END IF;
    168
    169
    170 -- End of year test for Course 1
    171
    172 IF v_counter <= v_students_test2 THEN
    173 INSERT INTO studentfacts
    174 VALUES(v_student_id, v_course1,'ACH2000',
    175 TO_DATE('01-JUN-2001','DD-MON-YYYY'),
    176 v_student_grade, v_course_final_grade, v_test_score);
    177 ELSE
    178 INSERT INTO studentfacts
    179 VALUES(v_student_id, v_course1, 'ACH2000',
    180 TO_DATE('01-JUN-2001','DD-MON-YYYY'),
    181 v_student_grade, v_course_final_grade, NULL);
    182 END IF;
    183
    184
    185 -- Beginning of year test for Course 2
    186
    187 IF v_counter <= v_students_test1 THEN
    188 INSERT INTO studentfacts
    189 VALUES(v_student_id, v_course2, 'ACH1999',
    190 TO_DATE('01-SEP-1999','DD-MON-YYYY'),
    191 v_student_grade, v_course_final_grade,
    192 v_test_score);
    193 ELSE
    194 INSERT INTO studentfacts
    195 VALUES(v_student_id, v_course2, 'ACH1999',
    196 TO_DATE('01-SEP-1999','DD-MON-YYYY'),
    197 v_student_grade, v_course_final_grade, NULL);
    198 END IF;
    199
    200
    201 -- End of year test for Course 2
    202
    203 IF v_counter <= v_students_test2 THEN
    204 INSERT INTO studentfacts
    205 VALUES(v_student_id, v_course2,'ACH2000',
    206 TO_DATE('01-JUN-2001''DD-MON-YYYY'),
    207 v_student_grade, v_course_final_grade,
    208 v_test_score);
    209 ELSE
    210 INSERT INTO studentfacts
    211 VALUES(v_student_id, v_course2, 'ACH2000',
    212 TO_DATE('01-JUN-2001','DD-MON-YYYY'),
    213 v_student_grade, v_course_final_grade, NULL);
    214 END IF;
    215
    216
    217 -- Beginning of year test for Course 3
    218
    219 IF v_counter <= v_students_test1 THEN
    220 INSERT INTO studentfacts
    221 VALUES(v_student_id, v_course3, 'ACH1999',
    222 TO_DATE('01-SEP-1999','DD-MON-YYYY'),
    223 v_student_grade, v_course_final_grade,
    224 v_test_score);
    225 ELSE
    226 INSERT INTO studentfacts
    227 VALUES(v_student_id, v_course3, 'ACH1999',
    228 TO_DATE('01-SEP-1999','DD-MON-YYYY'),
    229 v_student_grade, v_course_final_grade, NULL);
    230 END IF;
    231
    232
    233 -- End of year test for Course 3
    234
    235 IF v_counter <= v_students_test2 THEN
    236 INSERT INTO studentfacts
    237 VALUES(v_student_id, v_course3,'ACH2000',
    238 TO_DATE('01-JUN-2001','DD-MON-YYYY'),
    239 v_student_grade, v_course_final_grade,
    240 v_test_score);
    241 ELSE
    242 INSERT INTO studentfacts
    243 VALUES(v_student_id, v_course3, 'ACH2000',
    244 TO_DATE('01-JUN-2001','DD-MON-YYYY'),
    245 v_student_grade, v_course_final_grade, NULL);
    246 END IF;
    247
    248
    249 -- Beginning of year test for Course 4
    250
    251 IF v_counter <= v_students_test1 THEN
    252 INSERT INTO studentfacts
    253 VALUES(v_student_id, v_course4, 'ACH1999',
    254 TO_DATE('01-SEP-1999','DD-MON-Y YYY'),
    255 v_student_grade, v_course_final_grade,
    256 v_test_score);
    257 ELSE
    258 INSERT INTO studentfacts
    259 VALUES(v_student_id, v_course4, 'ACH1999',
    260 TO_DATE('01-SEP-1999','DD-MON-YYYY'),
    261 v_student_grade, v_course_final_grade, NULL);
    262 END IF;
    263
    264
    265 -- End of year test for Course 4
    266
    267 IF v_counter <= v_students_test2 THEN
    268 INSERT INTO studentfacts
    269 VALUES(v_student_id, v_course4,'ACH2000',
    270 TO_DATE('01-JUN-2001', 'DD-MON-YYYY'),
    271 v_student_grade, v_course_final_grade, v_test_score);
    272 ELSE
    273 INSERT INTO studentfacts
    274 VALUES(v_student_id, v_course4, 'ACH2000',
    275 TO_DATE('01-JUN-2001','DD-MON-YYYY'),
    276 v_student_grade, v_course_final_grade, NULL);
    277
    278 END IF;
    279 END LOOP;
    280 END add_tests;
    281 /
    Procedure created.
    SQL>
    SQL> show errors
    No errors.
    SQL>
    SQL> Input truncated to 9 characters
    spool off
    When I executed the main procedure, no data populated the student_table. I've tried several things, but I was not still able to populate the student_fact table (I've been at this for more than a week now, but haven't figured a way to populate the student_facts table with at least 1800 rows). Can you tell me what I need to change (if anything) whether if I need to structure things differently? I'm thinking that I missed something in calling the birth_date into the main procedure or returning the value from either a function or subprocedure. Related to the random final grade -- is there a way to sum the totals of the test scores (each student will have three), and generate a final grade from these values.
    I also compiled successfully a package containing this same information, but don't know how to execute it to see whether this approach works.
    Many thanks to anyone who can help.
    null

    ldsw,
    I am not sure if I totally understand everything that you are trying to do, but I tried to clean up your code and what is listed below is what I came up with. Please see if you can make use of any of it.
    SQL> EDIT ldsw
    CREATE OR REPLACE PACKAGE ldsw
    AS
    CURSOR grade_cur
    IS
    SELECT birth_date
    FROM students;
    PROCEDURE delete_test_info;
    FUNCTION get_grade
    (v_birth_date IN DATE)
    RETURN NUMBER;
    PRAGMA RESTRICT_REFERENCES (get_grade, WNDS, WNPS, RNDS, RNPS);
    PROCEDURE add_tests;
    END ldsw;
    CREATE OR REPLACE PACKAGE BODY ldsw
    AS
    v_student_grade NUMBER (1) := 0;
    PROCEDURE delete_test_info
    IS
    BEGIN
    DELETE FROM studentfacts;
    END delete_test_info;
    FUNCTION get_grade
    (v_birth_date IN DATE)
    RETURN NUMBER
    IS
    v_school_grade NUMBER (1) := 0;
    BEGIN
    IF v_birth_date < TO_DATE ('01-Jan-1987', 'DD-Mon-YYYY')
    THEN
    v_school_grade := 9;
    ELSIF v_birth_date BETWEEN TO_DATE ('01-Jan-1987', 'DD-Mon-YYYY') AND TO_DATE ('31-Dec-1987', 'DD-Mon-YYYY')
    THEN
    v_school_grade := 8;
    ELSIF v_birth_date BETWEEN TO_DATE ('01-Jan-1988', 'DD-Mon-YYYY') AND TO_DATE ('31-Dec-1988', 'DD-Mon-YYYY')
    THEN
    v_school_grade := 7;
    ELSIF v_birth_date BETWEEN TO_DATE ('01-Jan-1989', 'DD-Mon-YYYY') AND TO_DATE ('31-Dec-1989', 'DD-Mon-YYYY')
    THEN
    v_school_grade := 6;
    ELSIF v_birth_date > TO_DATE ('31-Dec-1989', 'DD-Mon-YYYY')
    THEN
    v_school_grade := 5;
    END IF;
    RETURN v_school_grade;
    END get_grade;
    PROCEDURE add_tests
    IS
    v_num_students CONSTANT NUMBER (3) := 300;
    v_students_test1 NUMBER := 0;
    v_students_test2 NUMBER := 0;
    v_counter NUMBER (3) := 0;
    v_student_id VARCHAR2 (5);
    v_test_score NUMBER (3) := 0;
    v_course_final_grade NUMBER (1) := 0;
    v_course1 VARCHAR2 (2) := NULL;
    v_course2 VARCHAR2 (2) := NULL;
    v_course3 VARCHAR2 (2) := NULL;
    v_course4 VARCHAR2 (2) := NULL;
    BEGIN
    ldsw.delete_test_info;
    v_students_test1 := v_num_students * .95;
    v_students_test2 := v_students_test1 * .80;
    FOR rec IN grade_cur
    LOOP
    v_counter := v_counter + 1;
    IF v_counter <= v_num_students
    THEN
    v_student_id := 'S' &#0124; &#0124; TO_CHAR (v_counter);
    v_test_score := random.rand_max (80) + 20;
    v_course_final_grade := random.rand_max (4);
    IF v_counter < ROUND (v_num_students * .20)
    THEN
    v_course1 := 'C1';
    v_course2 := 'C2';
    v_course3 := 'C3';
    ELSIF v_counter BETWEEN ROUND (v_num_students * .20) AND ROUND (v_num_students * .40)
    THEN
    v_course1 := 'C2';
    v_course2 := 'C1';
    v_course3 := 'C3';
    ELSIF v_counter BETWEEN ROUND (v_num_students * .40) AND ROUND (v_num_students * .60)
    THEN
    v_course1 := 'C3';
    v_course2 := 'C1';
    v_course3 := 'C2';
    ELSIF v_counter BETWEEN ROUND (v_num_students * .60) AND ROUND (v_num_students * .80)
    THEN
    v_course1 := 'C3';
    v_course2 := 'C1';
    v_course3 := 'C2';
    ELSE
    v_course1 := 'C4';
    v_course2 := 'C2';
    v_course3 := 'C3';
    END IF;
    SELECT ldsw.get_grade (rec.birth_date)
    INTO v_student_grade
    FROM DUAL;
    IF v_counter <= v_students_test1
    THEN
    INSERT INTO studentfacts
    VALUES (v_student_id,
    v_course1,
    'ACH1999',
    TO_DATE ('01-SEP-1999', 'DD-MON-YYYY'),
    v_student_grade,
    v_course_final_grade,
    v_test_score);
    ELSE
    INSERT INTO studentfacts
    VALUES (v_student_id,
    v_course1,
    'ACH1999',
    TO_DATE ('01-SEP-1999', 'DD-MON-YYYY'),
    v_student_grade,
    v_course_final_grade,
    NULL);
    END IF;
    IF v_counter <= v_students_test2
    THEN
    INSERT INTO studentfacts
    VALUES (v_student_id,
    v_course1,
    'ACH2000',
    TO_DATE ('01-JUN-2001', 'DD-MON-YYYY'),
    v_student_grade,
    v_course_final_grade,
    v_test_score);
    ELSE
    INSERT INTO studentfacts
    VALUES (v_student_id,
    v_course1,
    'ACH2000',
    TO_DATE ('01-JUN-2001', 'DD-MON-YYYY'),
    v_student_grade,
    v_course_final_grade,
    NULL);
    END IF;
    IF v_counter <= v_students_test1
    THEN
    INSERT INTO studentfacts
    VALUES (v_student_id,
    v_course2,
    'ACH1999',
    TO_DATE ('01-SEP-1999', 'DD-MON-YYYY'),
    v_student_grade,
    v_course_final_grade,
    v_test_score);
    ELSE
    INSERT INTO studentfacts
    VALUES (v_student_id,
    v_course2,
    'ACH1999',
    TO_DATE ('01-SEP-1999', 'DD-MON-YYYY'),
    v_student_grade,
    v_course_final_grade,
    NULL);
    END IF;
    IF v_counter <= v_students_test2
    THEN
    INSERT INTO studentfacts
    VALUES (v_student_id,
    v_course2,
    'ACH2000',
    TO_DATE ('01-JUN-2001', 'DD-MON-YYYY'),
    v_student_grade,
    v_course_final_grade,
    v_test_score);
    ELSE
    INSERT INTO studentfacts
    VALUES (v_student_id,
    v_course2,
    'ACH2000',
    TO_DATE ('01-JUN-2001', 'DD-MON-YYYY'),
    v_student_grade,
    v_course_final_grade,
    NULL);
    END IF;
    IF v_counter <= v_students_test1
    THEN
    INSERT INTO studentfacts
    VALUES (v_student_id,
    v_course3,
    'ACH1999',
    TO_DATE ('01-SEP-1999', 'DD-MON-YYYY'),
    v_student_grade,
    v_course_final_grade,
    v_test_score);
    ELSE
    INSERT INTO studentfacts
    VALUES (v_student_id,
    v_course3,
    'ACH1999',
    TO_DATE ('01-SEP-1999', 'DD-MON-YYYY'),
    v_student_grade,
    v_course_final_grade,
    NULL);
    END IF;
    IF v_counter <= v_students_test2
    THEN
    INSERT INTO studentfacts
    VALUES (v_student_id,
    v_course3,
    'ACH2000',
    TO_DATE ('01-JUN-2001', 'DD-MON-YYYY'),
    v_student_grade,
    v_course_final_grade,
    v_test_score);
    ELSE
    INSERT INTO studentfacts
    VALUES (v_student_id,
    v_course3,
    'ACH2000',
    TO_DATE ('01-JUN-2001', 'DD-MON-YYYY'),
    v_student_grade,
    v_course_final_grade,
    NULL);
    END IF;
    IF v_counter <= v_students_test1
    THEN
    INSERT INTO studentfacts
    VALUES (v_student_id,
    v_course4,
    'ACH1999',
    TO_DATE ('01-SEP-1999', 'DD-MON-YYYY'),
    v_student_grade,
    v_course_final_grade,
    v_test_score);
    ELSE
    INSERT INTO studentfacts
    VALUES (v_student_id,
    v_course4,
    'ACH1999',
    TO_DATE ('01-SEP-1999', 'DD-MON-YYYY'),
    v_student_grade,
    v_course_final_grade,
    NULL);
    END IF;
    IF v_counter <= v_students_test2
    THEN
    INSERT INTO studentfacts
    VALUES (v_student_id,
    v_course4,
    'ACH2000',
    TO_DATE ('01-JUN-2001', 'DD-MON-YYYY'),
    v_student_grade,
    v_course_final_grade,
    v_test_score);
    ELSE
    INSERT INTO studentfacts
    VALUES (v_student_id,
    v_course4,
    'ACH2000',
    TO_DATE ('01-JUN-2001', 'DD-MON-YYYY'),
    v_student_grade,
    v_course_final_grade,
    NULL);
    END IF;
    END IF;
    END LOOP;
    END add_tests;
    END ldsw;
    Save the file.
    SQL> START ldsw
    Package created.
    Package body created.
    SQL> EXECUTE ldsw.add_tests
    PL/SQL procedure successfully completed.
    SQL> SELECT * FROM student_facts;
    null

  • How to upload data for me01 using lsmw recording method

    *dear expert please tell me the complete procedure for how to upload data in me01 transaction using lsmw recording method.
    Moderator Message: Duplicate post locked.
    Edited by: Vinod Kumar on May 8, 2011 7:56 PM

    Hi,
    To be honest I don't understand your question. When You execute LSMW and create project, then all steps are shown in a very clear way with good description. With which one you have problems?
    Best regards
    Marcin Cholewczuk

  • Need to submit request for revoke using API

    Hi,
    I need to submit request for revoke application instance using the OIM API, so that once the request is raised OIM approvals should get trigger.
    Could you please share some sample code to achieve this, I am able to raise the request for provisioning but facing issue while raising request for revoke.
    Thanks.

    Hi,
    Refer this : OIMService (Oracle Fusion Middleware Java API Reference for Oracle Identity Manager)
    Specify operation as RequestConstants.MODEL_REMOVE_ROLES_OPERATION
    Reference : RequestConstants (Oracle Fusion Middleware Java API Reference for Oracle Identity Manager)
    Thanks,
    Pallavi

Maybe you are looking for